apparmor.d/apparmor.d/profiles-s-z/sudo
2022-11-20 11:42:08 +00:00

94 lines
2.3 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} = /{usr/,}bin/sudo
profile sudo @{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,
capability dac_override,
capability dac_read_search,
capability mknod,
capability net_admin,
capability setgid,
capability setuid,
capability sys_ptrace,
capability sys_resource,
network inet dgram,
network inet6 dgram,
network netlink raw, # PAM
ptrace (read),
signal (send) peer=unconfined,
signal (send) set=(cont,hup) peer=su,
signal (send) set=winch peer={apt,zsysd,zsys-system-autosnapshot},
dbus send bus=system path=/org/freedesktop/login[0-9]
interface=org.freedesktop.login[0-9].Manager
member=CreateSession
peer=(name=org.freedesktop.login[0-9]),
@{exec_path} mr,
/run/ r,
@{libexec}/sudo/** mr,
/{usr/,}bin/{,b,d,rb}ash rUx,
/{usr/,}bin/{c,k,tc,z}sh rUx,
/{usr/,}lib/cockpit/cockpit-askpass rPx,
/{usr/,}lib/molly-guard/molly-guard rPx,
/etc/default/locale r,
/etc/environment r,
/etc/machine-id r,
/etc/security/limits.d/{,*} r,
/etc/sudo.conf r,
/etc/sudoers r,
/etc/sudoers.d/{,*} r,
/var/db/sudo/lectured/ r,
/var/lib/sudo/lectured/ r,
/var/log/sudo.log wk,
owner /var/lib/sudo/lectured/* rw,
owner @{HOME}/.sudo_as_admin_successful rw,
owner @{HOME}/.xsession-errors w,
# For timestampdir
owner @{run}/sudo/ rw,
owner @{run}/sudo/ts/ rw,
owner @{run}/sudo/ts/* rwk,
@{run}/faillock/{,*} rwk,
@{run}/resolvconf/resolv.conf r,
@{PROC}/@{pids}/cgroup r,
@{PROC}/@{pids}/fd/ r,
@{PROC}/@{pids}/stat r,
@{PROC}/1/limits r,
@{PROC}/sys/kernel/seccomp/actions_avail r,
owner /dev/tty[0-9]* rw,
/dev/ r, # interactive login
/dev/ptmx rw,
deny @{user_share_dirs}/gvfs-metadata/* r,
include if exists <local/sudo>
}