# 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-rfkill
profile gsd-rfkill @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/bus-system>
  include <abstractions/bus/org.freedesktop.hostname1>
  include <abstractions/bus/org.freedesktop.ModemManager1>
  include <abstractions/bus/org.freedesktop.NetworkManager>
  include <abstractions/bus/org.gnome.SessionManager>

  signal (receive) set=(term, hup) peer=gdm*,

  network netlink raw,

  #aa:dbus own bus=session name=org.gnome.SettingsDaemon.Rfkill

  dbus receive bus=session
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=:*, label=gnome-shell),

  @{exec_path} mr,

  @{sys}/devices/virtual/misc/rfkill/uevent r,

  @{run}/udev/data/c10:@{int} r,          # for non-serial mice, misc features

  owner /dev/tty@{int} rw,

  /dev/rfkill rw,

  include if exists <local/gsd-rfkill>
}

# vim:syntax=apparmor
