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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{lib}/ubuntu-advantage-desktop-daemon
profile ubuntu-advantage-desktop-daemon @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/bus-system>
  include <abstractions/nameservice-strict>

  capability sys_nice,

  dbus bind bus=system name=com.canonical.UbuntuAdvantage,

  dbus receive bus=system path=/
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name=:*, label=software-properties-gtk),

  dbus receive bus=system
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=:*, label=software-properties-gtk),

  @{exec_path} mr,

  @{bin}/ubuntu-advantage rPx,

  /var/lib/ubuntu-advantage/{,**} r,

  include if exists <local/ubuntu-advantage-desktop-daemon>
}

# vim:syntax=apparmor
