fix(profile): apply some fix raised by the test suite.

This commit is contained in:
Alexandre Pujol 2024-10-22 00:37:50 +01:00
parent 1f869c12ad
commit cca8e6508f
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
24 changed files with 65 additions and 12 deletions

View File

@ -20,8 +20,7 @@
@{sys}/devices/@{pci}/host@{int}/** r,
@{sys}/devices/@{pci}/usb@{int}/** r,
@{sys}/devices/@{pci}/virtio@{int}/** r,
@{sys}/devices/**/host@{int}/**/block/{s,v}d[a-z]/ r,
@{sys}/devices/**/host@{int}/**/block/{s,v}d[a-z]/** r,
@{sys}/devices/**/host@{int}/** r,
# SSD Nvme devices
/dev/nvme[0-9]* rk,

View File

@ -20,8 +20,7 @@
@{sys}/devices/@{pci}/host@{int}/** r,
@{sys}/devices/@{pci}/usb@{int}/** r,
@{sys}/devices/@{pci}/virtio@{int}/** r,
@{sys}/devices/**/host@{int}/**/block/{s,v}d[a-z]/ r,
@{sys}/devices/**/host@{int}/**/block/{s,v}d[a-z]/** r,
@{sys}/devices/**/host@{int}/** r,
# SSD Nvme devices
/dev/nvme[0-9]* rwk,

View File

@ -12,6 +12,7 @@ profile cron @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/app-launcher-root>
include <abstractions/authentication>
include <abstractions/bus-system>
include <abstractions/nameservice-strict>
include <abstractions/wutmp>

View File

@ -26,6 +26,8 @@ profile fc-cache @{exec_path} {
/var/tmp/mkinitramfs_*/{**,} rwl,
owner @{user_cache_dirs}/ w,
# Silencer
deny network inet6 stream,
deny network inet stream,

View File

@ -22,10 +22,11 @@ profile gpgconf @{exec_path} {
@{bin}/gpg-connect-agent rPx,
@{bin}/gpg{,2} rPx,
@{bin}/gpgsm rPx,
@{bin}/pinentry-* rPx,
@{bin}/pinentry{,-*} rPx,
@{bin}/scdaemon rPx,
@{lib}/{,gnupg/}keyboxd rPUx,
@{lib}/{,gnupg/}scdaemon rPx,
@{lib}/keyboxd rPUx,
@{lib}/{,gnupg/}tpm2daemon rPUx,
/etc/gcrypt/hwf.deny r,
/etc/gnupg/gpgconf.conf r,

View File

@ -17,9 +17,11 @@ profile archlinux-java @{exec_path} {
@{bin}/basename rix,
@{bin}/bash rix,
@{bin}/dirname rix,
@{bin}/find rix,
@{bin}/id rix,
@{bin}/ln rix,
@{bin}/readlink rix,
@{bin}/sort rix,
@{bin}/unlink rix,
@{lib}/jvm/default w,

View File

@ -21,6 +21,8 @@ profile ssh-keygen @{exec_path} {
owner @{HOME}/@{XDG_SSH_DIR}/ w,
owner @{HOME}/@{XDG_SSH_DIR}/*_*{,.pub} rw,
/tmp/snapd@{int}/*_*{,.pub} w,
/dev/tty@{int} rw,
/dev/ttyS@{int} rw,

View File

@ -15,6 +15,7 @@ profile systemd-generator-cloud-init @{exec_path} flags=(attach_disconnected) {
@{exec_path} mr,
@{sh_path} rix,
@{bin}/ln rix,
@{bin}/mkdir rix,
@{bin}/systemd-detect-virt rPx,
@{lib}/cloud-init/ds-identify rPUx,
@ -22,6 +23,9 @@ profile systemd-generator-cloud-init @{exec_path} flags=(attach_disconnected) {
@{run}/cloud-init/ w,
@{run}/cloud-init/cloud-init-generator.* rw,
@{run}/cloud-init/disabled w,
@{run}/cloud-init/enabled w,
@{run}/systemd/generator.early/multi-user.target.wants/ w,
@{run}/systemd/generator.early/multi-user.target.wants/cloud-init.target w,
@{PROC}/cmdline r,

View File

@ -19,7 +19,7 @@ profile systemd-generator-fstab @{exec_path} {
/etc/fstab r,
@{run}/systemd/generator/** w,
@{run}/systemd/generator/** rw,
@{PROC}/@{pid}/cgroup r,

View File

@ -31,6 +31,7 @@ profile systemd-hostnamed @{exec_path} flags=(attach_disconnected) {
@{etc_rw}/.#hostname* rw,
@{etc_rw}/hostname rw,
/etc/.#machine-info@{hex16} rw,
/etc/.#machine-info@{rand6} rw,
/etc/machine-id r,
/etc/machine-info rw,

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{bin}/systemd-notify
profile systemd-notify @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
capability sys_admin,
capability net_admin,

View File

@ -9,11 +9,14 @@ include <tunables/global>
@{exec_path} = @{bin}/userdbctl
profile userdbctl @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/nameservice-strict>
capability dac_read_search,
capability sys_resource,
signal send set=cont peer=child-pager,
@{exec_path} mr,
@{pager_path} rPx -> child-pager,
@ -21,7 +24,9 @@ profile userdbctl @{exec_path} {
/etc/shadow r,
/etc/gshadow r,
@{PROC}/1/cgroup r,
@{PROC}/1/cgroup r,
owner @{PROC}/@{pid}/cgroup r,
owner @{PROC}/@{pid}/uid_map r,
include if exists <local/userdbctl>
}

View File

@ -20,6 +20,7 @@ profile apt-esm-json-hook @{exec_path} {
/var/lib/ubuntu-advantage/{,**} r,
/var/lib/ubuntu-advantage/apt-esm/{,**} rw,
/var/log/ubuntu-advantage-apt-hook.log w,
@{run}/cloud-init/cloud-id-nocloud r,

View File

@ -44,6 +44,8 @@ profile apparmor_parser @{exec_path} flags=(attach_disconnected) {
@{PROC}/sys/kernel/osrelease r,
owner @{PROC}/@{pid}/mounts r,
deny network netlink raw, # file_inherit
include if exists <local/apparmor_parser>
}

View File

@ -72,9 +72,9 @@ profile flatpak @{exec_path} flags=(attach_disconnected,mediate_deleted,complain
owner @{user_share_dirs}/ r,
owner @{user_share_dirs}/flatpak/{,**} rwl,
/tmp/#@{int} rw,
owner /dev/shm/flatpak*/{,**} rw,
owner @{tmp}/#@{int} rw,
owner @{tmp}/ostree-gpg-@{rand6}/{,**} rw,
owner /dev/shm/flatpak*/{,**} rw,
@{run}/.userns r,
@{run}/user/@{uid}/.dbus-proxy/ w,

View File

@ -10,6 +10,10 @@ include <tunables/global>
profile landscape-sysinfo.wrapper @{exec_path} {
include <abstractions/base>
capability dac_override,
capability fowner,
capability fsetid,
@{exec_path} mr,
@{sh_path} rix,

View File

@ -22,6 +22,8 @@ profile needrestart @{exec_path} flags=(attach_disconnected) {
ptrace (read),
mqueue r type=posix /,
@{exec_path} mrix,
@{sh_path} rix,
@ -76,8 +78,13 @@ profile needrestart @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/app/systemctl>
capability sys_resource,
capability net_admin,
signal send set=term peer=systemd-tty-ask-password-agent,
@{bin}/systemd-tty-ask-password-agent Px,
include if exists <local/needrestart_systemctl>
}

View File

@ -18,6 +18,8 @@ profile pstree @{exec_path} flags=(attach_disconnected) {
@{exec_path} mr,
/usr/share/terminfo/** r,
@{PROC} r,
@{PROC}/@{pids}/attr/current r,
@{PROC}/@{pids}/stat r,

View File

@ -121,9 +121,11 @@ profile snapd @{exec_path} {
/var/cache/apparmor/*/snap* rw,
/tmp/ r,
/tmp/read-file@{int}/{,**} rw,
/tmp/snapd@{int}/ rw,
/tmp/snapd@{int}/** rw,
/tmp/syscheck-mountpoint-@{int}/{,**} rw,
/tmp/syscheck-squashfs-@{int} rw,
/tmp/read-file@{int}/{,**} rw,
/boot/ r,
/boot/grub/grubenv r,

View File

@ -29,6 +29,9 @@ profile sudo @{exec_path} flags=(attach_disconnected) {
signal (send) set=(winch) peer=child-pager,
signal (send) set=(winch) peer=journalctl,
signal (send) set=(winch) peer=pacman,
signal (send) set=(winch, hup, term) peer=rpm,
unix bind type=stream addr=@@{hex16}/bus/sudo/system/,
@{bin}/@{shells} rUx,
@{lib}/** PUx,

View File

@ -7,11 +7,18 @@ abi <abi/4.0>,
include <tunables/global>
@{exec_path} = @{bin}/uuidd
profile uuidd @{exec_path} {
profile uuidd @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/consoles>
network inet dgram,
@{exec_path} mr,
owner /var/lib/libuuid/clock.txt rwk,
@{att}/@{run}/uuidd/request w,
include if exists <local/uuidd>
}

View File

@ -11,8 +11,14 @@ profile uuidgen @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
network inet dgram,
@{exec_path} mr,
owner /var/lib/libuuid/clock.txt w,
@{run}/uuidd/request w,
include if exists <local/uuidgen>
}

View File

@ -7,6 +7,7 @@ load common
setup_file() {
aa_setup
skip
}
# bats test_tags=aa-enforce

View File

@ -7,6 +7,7 @@ load common
setup_file() {
aa_setup
skip
}
# bats test_tags=snap