# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 valoq <valoq@mailbox.org>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/ouch
@{att} = ""
profile ouch /{,usr/}bin/ouch flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/user-read-strict>
  include <abstractions/user-write-strict>

  @{exec_path} mr,

  owner @{HOME}/.tmp@{rand6}/{,**} rw,
  owner @{HOME}/.tmp-ouch@{rand6}/{,**} rw,

  owner /tmp/ w,
  owner /tmp/.tmp@{rand6}/{,**} rw,
  owner /tmp/.tmp-ouch@{rand6}/{,**} rw,

  @{sys}/fs/cgroup/user.slice/cpu.max r,
  @{sys}/fs/cgroup/user.slice/user-@{uid}.slice/cpu.max r,
  @{sys}/fs/cgroup/user.slice/user-@{uid}.slice/session-@{word}.scope/cpu.max r,

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

  include if exists <local/ouch>
}

# vim:syntax=apparmor
