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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/nmcli
profile nmcli @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/consoles>

  capability dac_read_search,
  capability sys_nice,

  #aa:dbus talk bus=system name=org.freedesktop.NetworkManager label=NetworkManager

  @{exec_path} mr,

  @{pager_path}          rPx -> child-pager,

  owner @{HOME}/.nm-vpngate/*.ovpn r,
  owner @{HOME}/.cert/nm-openvpn/*.pem rw,

  @{run}/udev/data/+pci:* r,              # Identifies all PCI devices (CPU, GPU, Network, Disks, USB, etc.)
  @{run}/udev/data/n@{int} r,

  @{sys}/devices/virtual/net/{,**} r,
  @{sys}/devices/@{pci}/net/*/{,**} r,

  include if exists <local/nmcli>
}

# vim:syntax=apparmor
