fix(profile): issue with re-attached paths

- Add missing att on some profiles
- Fix alias / -> //
- Fix aa-log att variable resolution

fix #813 #814
This commit is contained in:
Alexandre Pujol 2025-08-17 00:07:53 +02:00
parent 5ee999536c
commit e55ace4e0a
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
8 changed files with 15 additions and 11 deletions

View file

@ -14,6 +14,8 @@
@{att}/@{run}/systemd/journal/socket w,
@{att}/@{run}/systemd/journal/stdout rw,
@{att}/dev/null rw,
/apparmor/.null rw,
@{att}/apparmor/.null rw,

View file

@ -38,12 +38,14 @@
pivot_root oldroot=/newroot/ /newroot/,
pivot_root oldroot=/tmp/oldroot/ /tmp/,
owner / r,
owner /newroot/{,**} w,
owner /tmp/newroot/ w,
owner /tmp/oldroot/ w,
@{att}/ r,
@{att}/@{run}/.userns r,
@{PROC}/sys/kernel/overflowgid r,
@{PROC}/sys/kernel/overflowuid r,
@{PROC}/sys/user/max_user_namespaces r,

View file

@ -66,7 +66,7 @@ profile flatpak @{exec_path} flags=(attach_disconnected,mediate_deleted,complain
/etc/flatpak/{,**} r,
/etc/pulse/client.conf r,
/ r,
@{att}/ r,
/var/lib/flatpak/{,**} rwlk,

View file

@ -65,8 +65,8 @@ profile xdg-desktop-portal @{exec_path} flags=(attach_disconnected) {
@{open_path} rPx -> child-open,
/ r,
@{att}/ r,
@{att}/.flatpak-info r,
owner @{att}/ r,
/usr/share/dconf/profile/gdm r,
/usr/share/xdg-desktop-portal/** r,

View file

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{bin}/Xwayland
profile xwayland @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/graphics>
include <abstractions/nameservice-strict>
include <abstractions/wayland>
@ -41,9 +42,6 @@ profile xwayland @{exec_path} flags=(attach_disconnected) {
@{PROC}/@{pids}/cmdline r,
@{att}/dev/tty@{int} rw,
/dev/tty rw,
include if exists <local/xwayland>
}

View file

@ -62,6 +62,9 @@ profile hyprland @{exec_path} flags=(attach_disconnected) {
owner @{PROC}/@{pid}/environ r,
@{att}/dev/dri/card@{int} rw,
@{att}/dev/input/event@{int} rw,
/dev/input/event@{int} rw,
/dev/tty r,
owner /dev/tty@{int} rw,

View file

@ -74,6 +74,6 @@
# See https://apparmor.pujol.io/development/internal/#re-attached-path
@{att}=/
alias // -> /,
alias / -> //,
# vim:syntax=apparmor

View file

@ -64,7 +64,7 @@ var (
`/home/[^/]+/`, `@{HOME}/`,
// Resolve system variables
`/att/[^/@]+`, `@{att}/`,
`/att/[^/]+/`, `@{att}/`,
`/usr/lib(32|64|exec)`, `@{lib}`,
`/usr/lib`, `@{lib}`,
`/usr/sbin`, `@{sbin}`,
@ -86,7 +86,6 @@ var (
`pci` + strings.Repeat(h, 4) + `:` + strings.Repeat(h, 2), `@{pci_bus}`,
`@{pci_bus}/[0-9a-f:*./]*/`, `@{pci}/`,
`1000`, `@{uid}`,
`@{att}//`, `@{att}/`,
// Some system glob
`:not.active.yet`, `@{busname}`, // dbus unique bus name