# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2023-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/nm-online
profile nm-online @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/bus/org.freedesktop.NetworkManager>

  dbus receive bus=system path=/org/freedesktop/NetworkManager/ActiveConnection/@{int}
       interface=org.freedesktop.NetworkManager.Connection.Active
       member=StateChanged
       peer=(name=:*, label=NetworkManager),
  
  dbus send bus=system path=/org/freedesktop/NetworkManager/Settings/@{int}
       interface=org.freedesktop.NetworkManager.Settings.Connection
       member=GetSettings
       peer=(name=:*, label=NetworkManager),

  @{exec_path} mr,

  include if exists <local/nm-online>
}
