apparmor.d/apparmor.d/profiles-s-z/sudo

101 lines
2.6 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]),
dbus (send receive) bus=session path=/org/freedesktop/systemd1
interface=org.freedesktop.systemd.Manager
member={JobRemoved,StartTransientUnit},
@{exec_path} mr,
@{libexec}/sudo/** mr,
/snap/snapd/[0-9]*/usr/bin/snap rPx,
/{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_ro}/environment r,
@{etc_ro}/security/limits.d/{,*} r,
/etc/default/locale r,
/etc/machine-id r,
/etc/sudo.conf r,
/etc/sudoers r,
/etc/sudoers.d/{,*} r,
/var/db/sudo/lectured/ r,
/var/lib/extrausers/shadow r,
/var/lib/sudo/lectured/ r,
/var/lib/sudo/ts/ rw,
/var/lib/sudo/ts/* rwk,
/var/log/sudo.log wk,
owner /var/lib/sudo/lectured/* rw,
owner @{HOME}/.sudo_as_admin_successful rw,
owner @{HOME}/.xsession-errors w,
@{run}/ r,
@{run}/faillock/{,*} rwk,
@{run}/resolvconf/resolv.conf r,
owner @{run}/sudo/ rw,
owner @{run}/sudo/ts/ rw,
owner @{run}/sudo/ts/* rwk,
@{PROC}/@{pids}/cgroup r,
@{PROC}/@{pids}/fd/ r,
@{PROC}/@{pids}/stat r,
@{PROC}/1/limits r,
@{PROC}/sys/kernel/seccomp/actions_avail r,
/dev/ r, # interactive login
/dev/ptmx rw,
owner /dev/tty[0-9]* rw,
deny @{user_share_dirs}/gvfs-metadata/* r,
include if exists <local/sudo>
}