feat(profile): improve sudo abstraction.
This commit is contained in:
parent
7ae05eb397
commit
cbd0b61491
3 changed files with 13 additions and 58 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
# Minimal set of rules for sudo. Interactive sudo need more rules.
|
# Minimal set of rules for sudo. Interactive sudo need more rules.
|
||||||
|
|
||||||
include <abstractions/authentication>
|
include <abstractions/authentication>
|
||||||
|
include <abstractions/bus-system>
|
||||||
include <abstractions/consoles>
|
include <abstractions/consoles>
|
||||||
include <abstractions/nameservice-strict>
|
include <abstractions/nameservice-strict>
|
||||||
include <abstractions/wutmp>
|
include <abstractions/wutmp>
|
||||||
|
|
@ -17,6 +18,15 @@
|
||||||
|
|
||||||
network netlink raw, # PAM
|
network netlink raw, # PAM
|
||||||
|
|
||||||
|
dbus send bus=system path=/org/freedesktop/login1
|
||||||
|
interface=org.freedesktop.logi1.Manager
|
||||||
|
member=CreateSession
|
||||||
|
peer=(name=org.freedesktop.login1, label=systemd-logind),
|
||||||
|
|
||||||
|
dbus (send receive) bus=session path=/org/freedesktop/systemd1
|
||||||
|
interface=org.freedesktop.systemd.Manager
|
||||||
|
member={JobRemoved,StartTransientUnit},
|
||||||
|
|
||||||
@{lib}/sudo/** mr,
|
@{lib}/sudo/** mr,
|
||||||
|
|
||||||
@{etc_ro}/environment r,
|
@{etc_ro}/environment r,
|
||||||
|
|
|
||||||
|
|
@ -8,56 +8,26 @@ include <tunables/global>
|
||||||
|
|
||||||
profile default-sudo @{exec_path} {
|
profile default-sudo @{exec_path} {
|
||||||
include <abstractions/base>
|
include <abstractions/base>
|
||||||
include <abstractions/authentication>
|
include <abstractions/sudo>
|
||||||
include <abstractions/bus-system>
|
|
||||||
include <abstractions/consoles>
|
|
||||||
include <abstractions/nameservice-strict>
|
|
||||||
include <abstractions/wutmp>
|
|
||||||
|
|
||||||
capability audit_write,
|
|
||||||
capability chown,
|
capability chown,
|
||||||
capability dac_override,
|
capability dac_override,
|
||||||
capability dac_read_search,
|
capability dac_read_search,
|
||||||
capability mknod,
|
capability mknod,
|
||||||
capability net_admin,
|
|
||||||
capability setgid,
|
|
||||||
capability setuid,
|
|
||||||
capability sys_ptrace,
|
capability sys_ptrace,
|
||||||
capability sys_resource,
|
|
||||||
|
|
||||||
network inet dgram,
|
network inet dgram,
|
||||||
network inet6 dgram,
|
network inet6 dgram,
|
||||||
network netlink raw,
|
|
||||||
|
|
||||||
ptrace (read),
|
ptrace (read),
|
||||||
|
|
||||||
dbus send bus=system path=/org/freedesktop/login1
|
|
||||||
interface=org.freedesktop.logi1.Manager
|
|
||||||
member=CreateSession
|
|
||||||
peer=(name=org.freedesktop.login1, label=systemd-logind),
|
|
||||||
|
|
||||||
dbus (send receive) bus=session path=/org/freedesktop/systemd1
|
|
||||||
interface=org.freedesktop.systemd.Manager
|
|
||||||
member={JobRemoved,StartTransientUnit},
|
|
||||||
|
|
||||||
@{bin}/sudo mr,
|
@{bin}/sudo mr,
|
||||||
@{bin}/su mr,
|
@{bin}/su mr,
|
||||||
@{lib}/sudo/** mr,
|
|
||||||
|
|
||||||
@{bin}/** Px,
|
@{bin}/** Px,
|
||||||
@{lib}/** Px,
|
@{lib}/** Px,
|
||||||
/opt/*/** Px,
|
/opt/*/** Px,
|
||||||
|
|
||||||
@{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,
|
|
||||||
|
|
||||||
/ r,
|
|
||||||
|
|
||||||
/var/db/sudo/lectured/ r,
|
/var/db/sudo/lectured/ r,
|
||||||
/var/lib/extrausers/shadow r,
|
/var/lib/extrausers/shadow r,
|
||||||
/var/lib/sudo/lectured/ r,
|
/var/lib/sudo/lectured/ r,
|
||||||
|
|
@ -68,7 +38,6 @@ profile default-sudo @{exec_path} {
|
||||||
owner /var/lib/sudo/lectured/* rw,
|
owner /var/lib/sudo/lectured/* rw,
|
||||||
|
|
||||||
owner @{HOME}/.sudo_as_admin_successful rw,
|
owner @{HOME}/.sudo_as_admin_successful rw,
|
||||||
owner @{HOME}/.xsession-errors w,
|
|
||||||
|
|
||||||
@{run}/ r,
|
@{run}/ r,
|
||||||
@{run}/faillock/{,*} rwk,
|
@{run}/faillock/{,*} rwk,
|
||||||
|
|
@ -77,19 +46,5 @@ profile default-sudo @{exec_path} {
|
||||||
owner @{run}/sudo/ts/ rw,
|
owner @{run}/sudo/ts/ rw,
|
||||||
owner @{run}/sudo/ts/* rwk,
|
owner @{run}/sudo/ts/* rwk,
|
||||||
|
|
||||||
@{PROC}/@{pids}/cgroup r,
|
|
||||||
@{PROC}/@{pids}/fd/ r,
|
|
||||||
@{PROC}/@{pids}/loginuid r,
|
|
||||||
@{PROC}/@{pids}/stat r,
|
|
||||||
@{PROC}/1/limits r,
|
|
||||||
@{PROC}/sys/kernel/seccomp/actions_avail r,
|
|
||||||
|
|
||||||
/dev/ r, # interactive login
|
|
||||||
/dev/ptmx rwk,
|
|
||||||
/dev/tty rwk,
|
|
||||||
owner /dev/tty@{int} rw,
|
|
||||||
|
|
||||||
deny @{user_share_dirs}/gvfs-metadata/* r,
|
|
||||||
|
|
||||||
include if exists <local/default-sudo>
|
include if exists <local/default-sudo>
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,6 @@ profile sudo @{exec_path} flags=(attach_disconnected) {
|
||||||
|
|
||||||
network inet dgram,
|
network inet dgram,
|
||||||
network inet6 dgram,
|
network inet6 dgram,
|
||||||
network netlink raw, # PAM
|
|
||||||
|
|
||||||
ptrace (read),
|
ptrace (read),
|
||||||
|
|
||||||
|
|
@ -30,20 +29,11 @@ profile sudo @{exec_path} flags=(attach_disconnected) {
|
||||||
signal (send) set=(cont,hup) peer=su,
|
signal (send) set=(cont,hup) peer=su,
|
||||||
signal (send) set=(winch),
|
signal (send) set=(winch),
|
||||||
|
|
||||||
dbus send bus=system path=/org/freedesktop/login1
|
|
||||||
interface=org.freedesktop.logi1.Manager
|
|
||||||
member={CreateSession,ReleaseSession}
|
|
||||||
peer=(name=org.freedesktop.login1, label=systemd-logind),
|
|
||||||
|
|
||||||
dbus (send receive) bus=session path=/org/freedesktop/systemd1
|
|
||||||
interface=org.freedesktop.systemd.Manager
|
|
||||||
member={JobRemoved,StartTransientUnit},
|
|
||||||
|
|
||||||
@{exec_path} mr,
|
@{exec_path} mr,
|
||||||
|
|
||||||
@{bin}/@{shells} rUx,
|
@{bin}/@{shells} rUx,
|
||||||
@{lib}/** rPUx,
|
@{lib}/** PUx,
|
||||||
/opt/*/** rPUx,
|
/opt/*/** PUx,
|
||||||
/snap/snapd/@{int}@{bin}/snap rPUx,
|
/snap/snapd/@{int}@{bin}/snap rPUx,
|
||||||
|
|
||||||
/var/db/sudo/lectured/ r,
|
/var/db/sudo/lectured/ r,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue