# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2026 Łukasz Kozak <lakis.kozak@gmail.com>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/kplymouththemeinstaller
@{att} = ""
profile kplymouththemeinstaller /{,usr/}bin/kplymouththemeinstaller {
  include <abstractions/base-strict>
  include <abstractions/bus/system/org.freedesktop.PolicyKit1>
  include <abstractions/kde-strict>
  include <abstractions/nameservice-strict>

  #aa/dbus talk bus=system name=org.kde.kcontrol.kcmplymouth path=/ interface+=org.kde.kf[56]auth label=kauth-plymouthhelper
  # Unix: allow connection to the profile
  unix type=stream peer=(label=kauth-plymouthhelper),
  # org.kde.kcontrol.kcmplymouth: send and receive anything to the interface on the specific peer label
  dbus (send receive) bus=system path=/
       interface=org.kde.kcontrol.kcmplymouth{,.*}
       peer=(name="{@{busname},org.kde.kcontrol.kcmplymouth{,.*},org.freedesktop.DBus}", label=kauth-plymouthhelper),
  dbus send bus=system path=/
       interface=org.kde.kcontrol.kcmplymouth{,.*}
       peer=(name="org.kde.kcontrol.kcmplymouth{,.*}"),
  # org.kde.kcontrol.kcmplymouth: send and receive anything to the interface on the specific peer label
  dbus (send receive) bus=system path=/
       interface=org.kde.kf[56]auth
       peer=(name="{@{busname},org.kde.kcontrol.kcmplymouth{,.*},org.freedesktop.DBus}", label=kauth-plymouthhelper),
  dbus send bus=system path=/
       interface=org.kde.kf[56]auth
       peer=(name="org.kde.kcontrol.kcmplymouth{,.*}"),
  # DBus.Properties: read and send properties
  dbus (send receive) bus=system path=/
       interface=org.freedesktop.DBus.Properties
       member={Get,GetAll,Set,PropertiesChanged}
       peer=(name="{@{busname},org.kde.kcontrol.kcmplymouth{,.*},org.freedesktop.DBus}", label=kauth-plymouthhelper),
  # DBus.Introspectable: allow service introspection
  dbus send bus=system path=/
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="{@{busname},org.kde.kcontrol.kcmplymouth{,.*},org.freedesktop.DBus}", label=kauth-plymouthhelper),
  # DBus.ObjectManager: allow clients to enumerate sources
  dbus send bus=system path=/
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name="{@{busname},org.kde.kcontrol.kcmplymouth{,.*},org.freedesktop.DBus}", label=kauth-plymouthhelper),
  dbus receive bus=system path=/
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.kde.kcontrol.kcmplymouth{,.*},org.freedesktop.DBus}", label=kauth-plymouthhelper),


  @{exec_path} mr,

  owner @{user_share_dirs}/kplymouththemeinstaller/*.@{archive_ext} r,

  owner @{tmp}/#@{int} rw,

  /dev/tty r,

  include if exists <local/kplymouththemeinstaller>
}

# vim:syntax=apparmor
