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

80 lines
1.9 KiB
Plaintext
Raw Normal View History

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2022 Mikhail Morfikov
2022-02-20 00:21:48 +01:00
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
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/sudo
profile sudo @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/app-launcher-root>
2020-12-10 22:33:39 +01:00
include <abstractions/authentication>
2021-10-22 16:01:43 +02:00
include <abstractions/consoles>
2020-12-10 22:33:39 +01:00
include <abstractions/nameservice-strict>
2021-10-22 16:01:43 +02:00
include <abstractions/wutmp>
2020-12-10 22:33:39 +01:00
# include <pam/mappings>
capability audit_write,
2021-04-18 16:03:30 +02:00
capability chown,
2021-10-22 16:01:43 +02:00
capability dac_override,
capability dac_read_search,
2021-11-04 19:33:25 +01:00
capability mknod,
capability net_admin,
2021-10-22 16:01:43 +02:00
capability setgid,
capability setuid,
capability sys_ptrace,
2021-10-22 16:01:43 +02:00
capability sys_resource,
2022-02-21 19:46:55 +01:00
network netlink raw, # PAM
2020-12-24 13:55:12 +01:00
2021-10-22 16:01:43 +02:00
ptrace (read),
# signal,
signal (send) set=(cont,hup) peer=su,
@{exec_path} mr,
@{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,
2022-02-20 00:21:48 +01:00
/etc/environment r,
/etc/machine-id r,
/etc/security/limits.d/{,*} r,
2021-10-22 16:01:43 +02:00
/etc/sudo.conf r,
/etc/sudoers r,
/etc/sudoers.d/{,*} 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
2020-10-25 10:23:34 +01:00
owner @{run}/sudo/ rw,
owner @{run}/sudo/ts/ rw,
owner @{run}/sudo/ts/* rwk,
@{run}/faillock/{,*} rwk,
@{run}/resolvconf/resolv.conf r,
@{PROC}/@{pids}/fd/ r,
@{PROC}/@{pids}/stat r,
2022-02-20 00:21:48 +01:00
@{PROC}/1/limits r,
@{PROC}/sys/kernel/seccomp/actions_avail r,
2022-02-20 00:33:32 +01:00
owner /dev/tty[0-9]* rw,
/dev/ r, # interactive login
/dev/ptmx rw,
2021-10-22 16:01:43 +02:00
2022-03-26 21:43:47 +01:00
deny @{user_share_dirs}/gvfs-metadata/* r,
2020-12-10 22:33:39 +01:00
include if exists <local/sudo>
}