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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/iotop
profile iotop @{exec_path} {
  include <abstractions/base>
  include <abstractions/python>
  include <abstractions/nameservice-strict>

  # Needed?
  audit deny capability net_admin,

  # To set processes' priorities
  capability sys_nice,

  @{exec_path} r,
  @{bin}/python3.@{int} r,

  @{bin}/file rix,

  @{bin}/ r,

        @{PROC}/ r,
        @{PROC}/vmstat r,
  owner @{PROC}/@{pid}/mounts r,
  owner @{PROC}/@{pid}/fd/ r,
        @{PROC}/@{pids}/cmdline r,
        @{PROC}/@{pids}/task/ r,
        @{PROC}/sys/kernel/pid_max r,

  # For file
  /etc/magic r,

  include if exists <local/iotop>
}

# vim:syntax=apparmor
