From e99f7de70310dff4c00ac4d309a81e07e34d47c0 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Mon, 13 Nov 2023 22:59:10 +0000 Subject: [PATCH] fix(profiles): fix slow startup of gnome at-spi-bus-launcher starts the accessibility bus. We need to ensure all buses are initally started by the same profile, otherwise the accessibility fail to start. See #74, #80 & #235 --- apparmor.d/groups/bus/dbus-daemon | 10 +++- .../groups/freedesktop/at-spi-bus-launcher | 53 ++++++++++--------- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/apparmor.d/groups/bus/dbus-daemon b/apparmor.d/groups/bus/dbus-daemon index a56aaa20..707c9651 100644 --- a/apparmor.d/groups/bus/dbus-daemon +++ b/apparmor.d/groups/bus/dbus-daemon @@ -14,6 +14,7 @@ profile dbus-daemon @{exec_path} flags=(attach_disconnected) { include include include + include include capability audit_write, @@ -41,7 +42,7 @@ profile dbus-daemon @{exec_path} flags=(attach_disconnected) { @{bin}/ r, @{bin}/[a-z0-9]* rPUx, - @{lib}/{,at-spi2{,-core}/}at-spi2-registryd rPx, + @{lib}/{,at-spi2{,-core}/}at-spi-bus-launcher rix, # See #74, #80 & #235 @{lib}/@{multiarch}/tumbler-1/tumblerd rPUx, @{lib}/@{multiarch}/xfce[0-9]/xfconf/xfconfd rPx, @{lib}/* rPUx, @@ -64,11 +65,16 @@ profile dbus-daemon @{exec_path} flags=(attach_disconnected) { /etc/dbus-1/{,**} r, /usr/share/dbus-1/{,**} r, + /usr/share/dconf/profile/gdm r, /usr/share/defaults/**.conf r, + /usr/share/gdm/greeter-dconf-defaults r, + /usr/share/glib-2.0/schemas/gschemas.compiled r, # Extra rules for GDM + /var/lib/gdm{3,}/.config/dconf/user r, /var/lib/gdm{3,}/.local/share/icc/ r, /var/lib/gdm{3,}/.local/share/icc/edid-*.icc r, + /var/lib/gdm{3,}/greeter-dconf-defaults r, # Extra rules for Flatpak @{system_share_dirs}/dbus-1/{,**} r, @@ -87,6 +93,7 @@ profile dbus-daemon @{exec_path} flags=(attach_disconnected) { @{run}/systemd/users/@{uid} r, owner @{run}/user/@{uid}/dbus-1/ rw, owner @{run}/user/@{uid}/dbus-1/services/ rw, + owner @{run}/user/@{uid}/gdm/Xauthority r, owner @{run}/user/@{uid}/systemd/notify w, @{sys}/kernel/security/apparmor/.access rw, @@ -94,6 +101,7 @@ profile dbus-daemon @{exec_path} flags=(attach_disconnected) { @{sys}/module/apparmor/parameters/enabled r, @{PROC}/@{pids}/attr/apparmor/current r, + @{PROC}/@{pids}/cgroup r, @{PROC}/@{pids}/cmdline r, @{PROC}/@{pids}/mounts r, @{PROC}/@{pids}/oom_score_adj rw, diff --git a/apparmor.d/groups/freedesktop/at-spi-bus-launcher b/apparmor.d/groups/freedesktop/at-spi-bus-launcher index 6c79b187..64edd241 100644 --- a/apparmor.d/groups/freedesktop/at-spi-bus-launcher +++ b/apparmor.d/groups/freedesktop/at-spi-bus-launcher @@ -1,6 +1,6 @@ # apparmor.d - Full set of apparmor profiles # Copyright (C) 2018-2022 Mikhail Morfikov -# Copyright (C) 2021-2022 Alexandre Pujol +# Copyright (C) 2021-2023 Alexandre Pujol # SPDX-License-Identifier: GPL-2.0-only abi , @@ -10,52 +10,55 @@ include @{exec_path} = @{lib}/{,at-spi2{,-core}/}at-spi-bus-launcher profile at-spi-bus-launcher @{exec_path} flags=(attach_disconnected) { include + include include include include + include + + network inet stream, # TODO: local only + network inet6 stream, + network inet dgram, + network inet6 dgram, + network netlink raw, signal (receive) set=(term hup kill) peer=dbus-daemon, signal (receive) set=(term hup kill) peer=gdm*, signal (receive) set=(term hup kill) peer=gnome-session-binary, - signal (send) set=(term hup kill) peer=dbus-daemon, - - unix (send, receive, connect) type=stream peer=(addr=@/tmp/.X11-unix/*, label=xorg), - - network inet stream, - network inet6 stream, - network inet dgram, - network inet6 dgram, - network netlink raw, @{exec_path} mr, - @{bin}/dbus-daemon rPx, @{bin}/dbus-broker-launch rPUx, + @{bin}/dbus-daemon rix, + @{lib}/at-spi2-registryd rPx, - /usr/share/gdm/greeter-dconf-defaults r, + /usr/share/dbus-1/accessibility-services/ r, + /usr/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service r, /usr/share/dconf/profile/gdm r, + /usr/share/defaults/at-spi2/accessibility.conf r, + /usr/share/gdm/greeter-dconf-defaults r, /usr/share/glib-2.0/schemas/gschemas.compiled r, - owner @{HOME}/.Xauthority r, - owner @{HOME}/.xsession-errors w, - - owner /tmp/runtime-*/xauth_@{rand6} r, - owner /tmp/xauth_@{rand6} r, - - owner @{run}/user/@{uid}/gdm/Xauthority r, - owner @{run}/user/@{uid}/xauth_@{rand6} r, - - /var/lib/lightdm/.Xauthority r, /var/lib/gdm{3,}/.config/dconf/user r, /var/lib/gdm{3,}/greeter-dconf-defaults r, - + /var/lib/lightdm/.Xauthority r, /var/log/lightdm/seat[0-9]*-greeter.log w, + @{run}/systemd/users/@{uid} r, + + @{sys}/kernel/security/apparmor/.access rw, + @{sys}/kernel/security/apparmor/features/dbus/mask r, + @{sys}/module/apparmor/parameters/enabled r, + + @{PROC}/@{pid}/cmdline r, + @{PROC}/@{pid}/oom_score_adj r, + @{PROC}/@{pids}/mounts r, + @{PROC}/1/cgroup r, + owner @{PROC}/@{pid}/attr/apparmor/current r, owner @{PROC}/@{pid}/cgroup r, owner @{PROC}/@{pid}/fd/ r, - @{PROC}/1/cgroup r, - owner /dev/tty@{int} rw, # file_inherit + owner /dev/tty@{int} rw, include if exists }