apparmor.d/profiles/su
2021-04-01 16:17:47 +01:00

61 lines
1.3 KiB
Text

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/su
profile su @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/authentication>
include <abstractions/wutmp>
include <abstractions/nameservice-strict>
# include <pam/mappings>
# To remove the following errors:
# su: cannot set groups: Operation not permitted
capability setgid,
# To remove the following errors:
# su: cannot set user id: Operation not permitted
capability setuid,
# To write records to the kernel auditing log.
capability audit_write,
# Needed?
audit deny capability net_bind_service,
signal (send) set=(term,kill),
signal (receive) set=(int,quit,term),
network netlink raw,
@{exec_path} mr,
# Shells to use
/{usr/,}bin/{,b,d,rb}ash rpux,
/{usr/,}bin/{c,k,tc,z}sh rpux,
# Fake shells to politely refuse a login
#/{usr/,}sbin/nologin rpux,
/etc/environment r,
@{PROC}/1/limits r,
owner @{PROC}/@{pid}/loginuid r,
/etc/default/locale r,
/etc/security/limits.d/ r,
/etc/shells r,
# For pam_securetty
@{PROC}/cmdline r,
@{sys}/devices/virtual/tty/console/active r,
include if exists <local/su>
}