# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2021 Mikhail Morfikov
# 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} = @{bin}/w
profile w @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/nameservice-strict>
  include <abstractions/wutmp>

  capability sys_ptrace,

  ptrace (read),

  @{exec_path} mr,

  @{sys}/devices/system/node/ r,
  @{sys}/devices/system/node/node@{int}/meminfo r,

  @{run}/systemd/sessions/ r,
  @{run}/systemd/sessions/@{int} r,

  @{PROC}/ r,
  @{PROC}/@{pids}/cmdline r,
  @{PROC}/@{pids}/stat r,
  @{PROC}/loadavg r,
  @{PROC}/sys/kernel/osrelease r,
  @{PROC}/uptime r,

  include if exists <local/w>
}

# vim:syntax=apparmor
