# 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/4.0>,

include <tunables/global>

@{exec_path} = @{lib}/systemd/user-generators/systemd-xdg-autostart-generator
@{att} = /att/systemd-generator-user-autostart/
profile systemd-generator-user-autostart /{,usr/}lib{,exec,32,64}/systemd/user-generators/systemd-xdg-autostart-generator  flags=(attach_disconnected,attach_disconnected.path=@{att},complain) {
  include <abstractions/attached/base>
  include <abstractions/common/systemd>
  include <abstractions/desktop-files>
  include <abstractions/nameservice-strict>

  capability net_admin,

  ptrace read peer=@{p_systemd},

  @{exec_path} mr,

  @{etc_ro}/xdg/autostart/{,*.desktop} r,

  owner @{user_config_dirs}/autostart/{,*.desktop} r,
  owner @{run}/user/@{uid}/systemd/generator.late/{,**} rw,

  owner @{PROC}/@{pid}/cgroup r,

  include if exists <local/systemd-generator-user-autostart>
}

# vim:syntax=apparmor
