apparmor.d/apparmor.d/profiles-s-z/su
2023-08-21 23:32:10 +01:00

72 lines
1.7 KiB
Plaintext

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2022 Mikhail Morfikov
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = @{bin}/su
profile su @{exec_path} {
include <abstractions/base>
include <abstractions/app-launcher-root>
include <abstractions/authentication>
include <abstractions/consoles>
include <abstractions/dbus-strict>
include <abstractions/nameservice-strict>
include <abstractions/wutmp>
# include <pam/mappings>
capability audit_write,
capability chown, # pseudo-terminal
capability dac_read_search,
capability setgid,
capability setuid,
capability sys_resource,
# No clear purpose, deny until needed
audit deny capability net_admin,
audit deny capability net_bind_service,
signal (send) set=(term,kill),
signal (receive) set=(int,quit,term),
signal (receive) set=(cont,hup) peer=sudo,
unix (bind) type=dgram,
network netlink raw,
dbus (send) bus=system path=/org/freedesktop/login[0-9]
interface=org.freedesktop.login[0-9].Manager
member={CreateSession,ReleaseSession},
@{exec_path} mr,
@{bin}/{,b,d,rb}ash rUx,
@{bin}/{c,k,tc,z}sh rUx,
@{bin}/nologin rPx,
@{etc_ro}/default/su r,
@{etc_ro}/environment r,
@{etc_ro}/security/limits.d/{,*.conf} r,
/etc/default/locale r,
/etc/shells r,
owner @{HOME}/.xauth@{rand6} rw,
owner @{PROC}/@{pids}/loginuid r,
owner @{PROC}/@{pids}/cgroup r,
owner @{PROC}/@{pids}/mountinfo r,
@{PROC}/1/limits r,
@{PROC}/cmdline r,
@{sys}/devices/virtual/tty/console/active r,
/dev/{,pts/}ptmx rw,
/dev/tty@{int} rw,
include if exists <local/su>
}