# 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/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/networkd-dispatcher
profile networkd-dispatcher @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/nameservice-strict>
  include <abstractions/python>

  dbus receive bus=system path=/org/freedesktop/network1{,/link/*}
       interface=org.freedesktop.DBus.Properties
       member=PropertiesChanged
       peer=(name=:*, label=systemd-networkd),

  @{exec_path} mr,

  @{bin}/ r,
  @{bin}/networkctl  rPx,
  @{bin}/ls          rix,
  @{bin}/sed         rix,

  @{lib}/networkd-dispatcher/routable.d/postfix rix,

  /etc/networkd-dispatcher/{,**} r,

  /var/spool/postfix/pid/master.pid r,

  @{run}/systemd/notify rw,

  owner @{PROC}/@{pid}/fd/ r,
  owner @{PROC}/@{pid}/mounts r,

  include if exists <local/networkd-dispatcher>
}

# vim:syntax=apparmor
