fix(profile): workaround in apparmor issue for attached path.

See https://gitlab.com/apparmor/apparmor/-/issues/450
Fix #815
This commit is contained in:
Alexandre Pujol 2025-08-17 11:57:36 +02:00
parent 52e9ae9fd6
commit 4e70cb4c91
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
8 changed files with 7 additions and 6 deletions

View file

@ -135,6 +135,8 @@
owner @{PROC}/@{pid}/task/ r, owner @{PROC}/@{pid}/task/ r,
owner @{PROC}/@{pid}/task/@{tid}/comm rw, owner @{PROC}/@{pid}/task/@{tid}/comm rw,
owner @{att}/dev/shm/@{uuid} r,
/dev/hidraw@{int} rw, /dev/hidraw@{int} rw,
/dev/input/ r, /dev/input/ r,
/dev/input/event@{int} rw, /dev/input/event@{int} rw,

View file

@ -83,7 +83,6 @@ profile flatpak-app flags=(attach_disconnected,mediate_deleted) {
/var/lib/flatpak/app/{,**} r, /var/lib/flatpak/app/{,**} r,
/var/lib/flatpak/exports/** rw, /var/lib/flatpak/exports/** rw,
@{run}/.userns r,
@{run}/parent/** r, @{run}/parent/** r,
@{run}/parent/app/.ref rk, @{run}/parent/app/.ref rk,
@{run}/parent/usr/.ref rk, @{run}/parent/usr/.ref rk,

View file

@ -31,7 +31,7 @@ profile flatpak-portal @{exec_path} flags=(attach_disconnected) {
/var/lib/flatpak/exports/share/mime/mime.cache r, /var/lib/flatpak/exports/share/mime/mime.cache r,
owner @{att}/ r, owner /att/**/ r,
owner @{att}/.flatpak-info r, owner @{att}/.flatpak-info r,
owner @{HOME}/.var/app/*/**/.ref rw, owner @{HOME}/.var/app/*/**/.ref rw,

View file

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

View file

@ -52,7 +52,7 @@ profile xdg-desktop-portal-gtk @{exec_path} flags=(attach_disconnected) {
/usr/share/gdm/greeter-dconf-defaults r, /usr/share/gdm/greeter-dconf-defaults r,
/ r, / r,
owner @{att}/ r, owner /att/**/ r,
owner /var/lib/xkb/server-@{int}.xkm rw, owner /var/lib/xkb/server-@{int}.xkm rw,

View file

@ -44,7 +44,7 @@ profile xdg-document-portal @{exec_path} flags=(attach_disconnected) {
@{bin}/snap rPx, @{bin}/snap rPx,
/ r, / r,
owner @{att}/ r, owner /att/**/ r,
owner @{att}/.flatpak-info r, owner @{att}/.flatpak-info r,
owner @{HOME}/ r, owner @{HOME}/ r,

View file

@ -73,7 +73,6 @@
# Disabled on abi3 and Ubuntu 25.04+ # Disabled on abi3 and Ubuntu 25.04+
# See https://apparmor.pujol.io/development/internal/#re-attached-path # See https://apparmor.pujol.io/development/internal/#re-attached-path
@{att}=/ @{att}=/
alias / -> //, alias / -> //,
# vim:syntax=apparmor # vim:syntax=apparmor

View file

@ -33,5 +33,6 @@ func (p ReAttach) Apply() ([]string, error) {
return res, err return res, err
} }
out = strings.ReplaceAll(out, "@{att}=/", "# @{att}=/") out = strings.ReplaceAll(out, "@{att}=/", "# @{att}=/")
out = strings.ReplaceAll(out, "alias / -> //,", "#alias / -> //,")
return res, path.WriteFile([]byte(out)) return res, path.WriteFile([]byte(out))
} }