apparmor.d/profiles/htop

111 lines
3 KiB
Text
Raw Normal View History

# vim:syntax=apparmor
# ------------------------------------------------------------------
#
2021-01-10 16:35:07 +01:00
# Copyright (C) 2019-2021 Mikhail Morfikov
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
2020-12-10 22:33:39 +01:00
abi <abi/3.0>,
2020-12-10 22:33:39 +01:00
include <tunables/global>
@{exec_path} = /{usr/,}bin/htop
profile htop @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/nameservice-strict>
# To be able to read the /proc/ files of all processes in the system.
capability dac_read_search,
# To manage priorities.
capability sys_nice,
# To terminate other users' processes when htop is started as root.
capability kill,
capability sys_ptrace,
2021-03-21 17:04:10 +01:00
# Needed? (for system state)
2020-12-24 13:55:12 +01:00
audit deny capability net_admin,
2020-12-10 22:33:39 +01:00
signal (send),
ptrace (read),
2020-12-10 22:33:39 +01:00
network netlink raw,
@{exec_path} mr,
@{PROC}/ r,
@{PROC}/loadavg r,
@{PROC}/uptime r,
@{PROC}/tty/drivers r,
@{PROC}/sys/kernel/osrelease r,
@{PROC}/sys/kernel/pid_max r,
2021-03-21 17:04:10 +01:00
@{PROC}/pressure/cpu r,
@{PROC}/pressure/io r,
@{PROC}/pressure/memory r,
@{PROC}/diskstats r,
@{PROC}/@{pids}/cmdline r,
@{PROC}/@{pids}/stat r,
@{PROC}/@{pids}/statm r,
@{PROC}/@{pids}/environ r,
@{PROC}/@{pids}/oom_{,score_}adj r,
@{PROC}/@{pids}/oom_score r,
@{PROC}/@{pids}/cgroup r,
@{PROC}/@{pids}/wchan r,
@{PROC}/@{pids}/io r,
2020-12-10 22:33:39 +01:00
@{PROC}/@{pids}/comm r,
@{PROC}/@{pids}/task/ r,
@{PROC}/@{pids}/task/@{tid}/cmdline r,
@{PROC}/@{pids}/task/@{tid}/stat r,
@{PROC}/@{pids}/task/@{tid}/statm r,
@{PROC}/@{pids}/task/@{tid}/environ r,
@{PROC}/@{pids}/task/@{tid}/oom_{,score_}adj r,
@{PROC}/@{pids}/task/@{tid}/oom_score r,
@{PROC}/@{pids}/task/@{tid}/cgroup r,
@{PROC}/@{pids}/task/@{tid}/wchan r,
@{PROC}/@{pids}/task/@{tid}/status r,
@{PROC}/@{pids}/task/@{tid}/io r,
2020-12-10 22:33:39 +01:00
@{PROC}/@{pids}/task/@{tid}/comm r,
2021-03-21 17:04:10 +01:00
@{PROC}/@{pids}/net/dev r,
owner @{PROC}/@{pid}/smaps_rollup r,
2020-12-10 22:33:39 +01:00
@{sys}/devices/virtual/block/zram[0-9]*/{disksize,mm_stat} r,
@{sys}/devices/system/cpu/cpufreq/policy[0-9]*/scaling_cur_freq r,
2021-03-21 17:04:10 +01:00
@{sys}/class/i2c-adapter/ r,
@{sys}/devices/pci[0-9]*/**/i2c-[0-9]*/name r,
@{sys}/class/hwmon/ r,
@{sys}/class/power_supply/ r,
@{sys}/devices/**/power_supply/**/{uevent,type,online} r,
@{sys}/devices/**/hwmon/ r,
@{sys}/devices/**/hwmon/{name,temp*} r,
@{sys}/devices/**/hwmon/**/ r,
@{sys}/devices/**/hwmon/**/{name,temp*} r,
@{sys}/devices/**/hwmon[0-9]*/ r,
@{sys}/devices/**/hwmon[0-9]*/{name,temp*} r,
@{sys}/devices/**/hwmon[0-9]*/**/ r,
@{sys}/devices/**/hwmon[0-9]*/**/{name,temp*} r,
2020-12-10 22:33:39 +01:00
owner @{HOME}/.config/htop/ rw,
owner @{HOME}/.config/htop/htoprc rw,
# When started in TTY, to remove the following error:
# htop[]: *** err
# /dev/tty2: Permission denied
# htop[]: *** err
# htop[]: Oh, oh, it's an error! possibly I die!
/dev/tty[0-9]* rw,
2021-03-21 17:04:10 +01:00
/etc/sensors.d/ r,
/etc/sensors3.conf r,
2020-12-10 22:33:39 +01:00
include if exists <local/htop>
}