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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/aa-unconfined
profile aa-unconfined @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/python>

  capability dac_read_search,
  capability sys_ptrace,

  ptrace read,

  @{exec_path} mr,

  @{bin}/          r,
  @{bin}/netstat  Px,
  @{bin}/ss       Px,

  /usr/share/terminfo/** r,

  /etc/apparmor/logprof.conf r,
  @{etc_ro}/inputrc r,

  owner @{tmp}/@{rand8} rw,
  owner @{tmp}/apparmor-bugreport-@{rand8}.txt rw,
  owner /var/tmp/@{rand8} rw,

        @{PROC}/ r,
        @{PROC}/@{pid}/cmdline r,
        @{PROC}/@{pids}/attr/apparmor/current r,
        @{PROC}/@{pids}/attr/current r,
  owner @{PROC}/@{pid}/mounts r,

  include if exists <local/aa-unconfined>
}

# vim:syntax=apparmor
