# 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-environment-generators/*
@{att} = /att/systemd-generator-user-environment/
profile systemd-generator-user-environment /{,usr/}lib{,exec,32,64}/systemd/user-environment-generators/*  flags=(attach_disconnected,attach_disconnected.path=@{att},complain) {
  include <abstractions/attached/base>
  include <abstractions/common/systemd>
  include <abstractions/nameservice-strict>

  capability net_admin,

  ptrace read peer=@{p_systemd},

  @{exec_path} mr,

  @{sh_path}         rix,
  @{bin}/flatpak     rpux,
  @{bin}/gpgconf     rpx,
  @{bin}/{m,g,}awk   rix,

  @{etc_ro}/environment r,
  @{etc_ro}/environment.d/{,**} r,

  /snap/snapd/@{int}/usr/lib/environment.d/{,*.conf} r,

  owner @{user_config_dirs}/environment.d/{,*.conf} r,

  /dev/tty rw,

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

# vim:syntax=apparmor
