# 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}/sddmthemeinstaller
@{att} = ""
profile sddmthemeinstaller /{,usr/}bin/sddmthemeinstaller {
  include <abstractions/base-strict>
  include <abstractions/audio-client>
  include <abstractions/bus/system/org.freedesktop.PolicyKit1>
  include <abstractions/common/kde>

  #aa/dbus talk bus=system name=org.kde.kcontrol.kcmsddm path=/ interface+=org.kde.kf[56]auth label=kauth-kcmsddm_authhelper
  # Unix: allow connection to the profile
  unix type=stream peer=(label=kauth-kcmsddm_authhelper),
  # org.kde.kcontrol.kcmsddm: send and receive anything to the interface on the specific peer label
  dbus (send receive) bus=system path=/
       interface=org.kde.kcontrol.kcmsddm{,.*}
       peer=(name="{@{busname},org.kde.kcontrol.kcmsddm{,.*},org.freedesktop.DBus}", label=kauth-kcmsddm_authhelper),
  dbus send bus=system path=/
       interface=org.kde.kcontrol.kcmsddm{,.*}
       peer=(name="org.kde.kcontrol.kcmsddm{,.*}"),
  # org.kde.kcontrol.kcmsddm: 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.kcmsddm{,.*},org.freedesktop.DBus}", label=kauth-kcmsddm_authhelper),
  dbus send bus=system path=/
       interface=org.kde.kf[56]auth
       peer=(name="org.kde.kcontrol.kcmsddm{,.*}"),
  # 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.kcmsddm{,.*},org.freedesktop.DBus}", label=kauth-kcmsddm_authhelper),
  # DBus.Introspectable: allow service introspection
  dbus send bus=system path=/
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="{@{busname},org.kde.kcontrol.kcmsddm{,.*},org.freedesktop.DBus}", label=kauth-kcmsddm_authhelper),
  # 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.kcmsddm{,.*},org.freedesktop.DBus}", label=kauth-kcmsddm_authhelper),
  dbus receive bus=system path=/
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.kde.kcontrol.kcmsddm{,.*},org.freedesktop.DBus}", label=kauth-kcmsddm_authhelper),


  @{exec_path} mr,

        @{HOMEDIRS}/ r,
  owner @{HOME}/ r,

  owner @{tmp}/*.@{archive_ext} rw,

  @{PROC}/sys/kernel/random/boot_id r,

  /dev/tty r,

  include if exists <local/sddmthemeinstaller>
}

# vim:syntax=apparmor
