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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/udisksctl
@{att} = ""
profile udisksctl /{,usr/}bin/udisksctl flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/bus-system>
  include <abstractions/consoles>

  unix type=stream addr=none peer=(label=udisksd, addr=none),

  dbus (send receive) bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.UDisks2{,.*}
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus (send receive) bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.Properties
       member={Get,GetAll,Set,PropertiesChanged}
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus send bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus send bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus receive bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),

  @{exec_path} mr,

  @{sh_path}        rix,

  @{pager_path} rpx -> child-pager,

  /dev/tty rw,

  include if exists <local/udisksctl>
}

# vim:syntax=apparmor
