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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{lib}/gsd-printer
profile gsd-printer @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/bus-system>
  include <abstractions/bus/org.gnome.SessionManager>
  include <abstractions/nameservice-strict>

  signal (receive) set=(term, hup) peer=gdm*,
  signal (receive) set=(hup) peer=gsd-print-notifications,

  #aa:dbus own bus=system name=com.redhat.NewPrinterNotification
  #aa:dbus own bus=system name=com.redhat.PrinterDriversInstaller
  
  dbus receive bus=session
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=:*, label=gnome-shell),

  @{exec_path} mr,

  owner @{PROC}/@{pid}/cgroup r,

  owner /dev/tty@{int} rw,

  include if exists <local/gsd-printer>
}
