feat(profiles): improve dbus integration.

This commit is contained in:
Alexandre Pujol 2023-07-20 21:00:41 +01:00
parent 33a9b062ff
commit d2a650f6c6
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
19 changed files with 77 additions and 66 deletions

View File

@ -5,6 +5,16 @@
# Permissions for querying dconf settings with write access; use the dconf
# abstraction first, and dconf-write only for specific application's profile.
dbus send bus=session path=/ca/desrt/dconf/Writer/user
interface=ca.desrt.dconf.Writer
member=Change
peer=(name=ca.desrt.dconf), # no peer's labels
dbus receive bus=session path=/ca/desrt/dconf/Writer/user
interface=ca.desrt.dconf.Writer
member=Notify
peer=(name=:*, label=dconf-service),
/etc/dconf/** r,
owner @{user_config_dirs}/dconf/user r,

View File

@ -1,32 +1,40 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2021-2023 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
@{lib}/frei0r-[0-9]/*.so mr,
@{lib}/gstreamer-[0-9]*.[0-9]*/gst-plugin-scanner{,x86_64} mrix,
@{lib}/@{multiarch}/gstreamer[0-9]*.[0-9]*/gstreamer-[0-9]*.[0-9]*/gst-plugin-scanner{,x86_64} mrix,
@{lib}/@{multiarch}/libproxy/*/modules/*.so mr,
@{lib}/@{multiarch}/libproxy/*/pxgsettings ixr,
@{lib}/@{multiarch}/libvisual-[0-9].[0-9]/*/*.so mr,
/etc/openni2/OpenNI.ini r,
/tmp/ r,
owner @{HOME}/{.cache/,.}gstreamer-[0-9]*/ rw,
owner @{HOME}/{.cache/,.}gstreamer-[0-9]*/registry.*.bin{,.tmp*} rw,
/tmp/ r,
/var/tmp/ r,
/dev/ r,
/dev/bus/usb/ r,
/dev/dri/ r,
# The orcexec.* file is JIT compiled code for various GStreamer elements.
# If one is blocked the next is used instead.
# The orcexec file is placed under /home/user/ also when the /tmp/ dir is mounted with the noexec flag.
owner @{run}/user/@{uid}/orcexec.* mrw,
#owner /tmp/orcexec.* mrw,
#owner @{HOME}/orcexec.* mrw,
# /dev/shm is a symlink to /run/shm on ubuntu
#owner /{dev,run}/shm/shmfd-* rw,
@{run}/udev/data/+drm:* r, # For screen outputs
@{run}/udev/data/+usb:* r, # For /dev/bus/usb/**
#
@{run}/udev/data/c81:[0-9]* r, # For video4linux
@{run}/udev/data/c189:[0-9]* r, # For USB serial converters
@{run}/udev/data/c226:[0-9]* r, # For /dev/dri/card[0-9]*
@{run}/udev/data/+drm:* r, # For screen outputs
#@{run}/udev/data/+pci:* r,
@{run}/udev/data/+usb:* r, # For /dev/bus/usb/**
@{sys}/bus/ r,
@{sys}/bus/usb/devices/ r,
@{sys}/bus/media/devices/ r,
@{sys}/bus/usb/devices/ r,
@{sys}/class/ r,
@{sys}/class/drm/ r,
@{sys}/class/video4linux/ r,
@ -34,22 +42,8 @@
@{sys}/devices/system/node/ r,
@{sys}/devices/system/node/node[0-9]*/meminfo r,
# The orcexec.* file is JIT compiled code for various GStreamer elements.
# If one is blocked the next is used instead.
# The orcexec file is placed under /home/user/ also when the /tmp/ dir is mounted with the noexec
# flag.
owner @{run}/user/@{uid}/orcexec.* mrw,
#owner /tmp/orcexec.* mrw,
#owner @{HOME}/orcexec.* mrw,
@{lib}/frei0r-[0-9]/*.so mr,
@{lib}/gstreamer-[0-9]*.[0-9]*/gst-plugin-scanner mrix,
@{lib}/@{multiarch}/gstreamer[0-9]*.[0-9]*/gstreamer-[0-9]*.[0-9]*/gst-plugin-scanner mrix,
@{lib}/@{multiarch}/libproxy/*/modules/*.so mr,
@{lib}/@{multiarch}/libproxy/*/pxgsettings ixr,
@{lib}/@{multiarch}/libvisual-[0-9].[0-9]/*/*.so mr,
owner @{HOME}/{.cache/,.}gstreamer-[0-9]*/ rw,
owner @{HOME}/{.cache/,.}gstreamer-[0-9]*/registry.*.bin{,.tmp*} rw,
/dev/ r,
/dev/bus/usb/ r,
/dev/dri/ r,
include if exists <abstractions/gstreamer.d>

View File

@ -50,7 +50,7 @@ profile colord @{exec_path} flags=(attach_disconnected) {
dbus receive bus=system path=/org/freedesktop/ColorManager/**
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=:*, label=@{profile_name}),
peer=(name=:*, label="{@{profile_name},gsd-color}"),
dbus bind bus=system
name=org.freedesktop.ColorManager,

View File

@ -13,6 +13,7 @@ profile pulseaudio @{exec_path} {
include <abstractions/base>
include <abstractions/audio>
include <abstractions/consoles>
include <abstractions/dbus-gtk>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
include <abstractions/dconf-write>

View File

@ -107,6 +107,16 @@ profile xdg-desktop-portal-gnome @{exec_path} {
member=GetAll
peer=(name=:*, label=gnome-shell),
dbus send bus=session path=/org/gtk/vfs/mounttracker
interface=org.gtk.vfs.MountTracker
member=ListMountableInfo
peer=(name=:*, label=gvfsd),
dbus receive bus=session path=/org/freedesktop/portal/desktop
interface=org.freedesktop.impl.portal.Settings
member=Read
peer=(name=:*, label=xdg-desktop-portal),
dbus receive bus=session path=/
interface=org.freedesktop.DBus.Introspectable
member=Introspect

View File

@ -395,16 +395,6 @@ profile gnome-shell @{exec_path} flags=(attach_disconnected) {
member=GetAll
peer=(name=:*, label=gnome-extension-ding),
dbus send bus=session path=/ca/desrt/dconf/Writer/user
interface=ca.desrt.dconf.Writer
member=Change
peer=(name=ca.desrt.dconf), # no peer's labels
dbus receive bus=session path=/ca/desrt/dconf/Writer/user
interface=ca.desrt.dconf.Writer
member=Notify
peer=(name=:*, label=dconf-service),
dbus send bus=session path=/org/gnome/ControlCenter
interface=org.gtk.Actions
member=DescribeAll

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{lib}/tracker-miner-fs-{,control-}3
profile tracker-miner @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/dbus-gtk>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
include <abstractions/dconf-write>
@ -36,16 +37,6 @@ profile tracker-miner @{exec_path} flags=(attach_disconnected) {
member={ListMonitorImplementations,ListMountableInfo}
peer=(name=:*, label=gvfsd),
dbus send bus=session path=/org/gtk/vfs/mounttracker
interface=org.gtk.vfs.MountTracker
member=ListMountableInfo
peer=(name=:*, label=gvfsd),
dbus receive bus=session path=/org/gtk/vfs/mounttracker
interface=org.gtk.vfs.MountTracker
member=Mounted
peer=(name=:*, label=gvfsd),
dbus send bus=session path=/org/gtk/Private/RemoteVolumeMonitor
interface=org.gtk.Private.RemoteVolumeMonitor
member={List,IsSupported}

View File

@ -42,12 +42,17 @@ profile gvfs-udisks2-volume-monitor @{exec_path} flags=(attach_disconnected) {
member=ListMountableInfo
peer=(name=:*, label=gvfsd),
dbus send bus=session path=/org/gtk/Private/RemoteVolumeMonitor
interface=org.gtk.Private.RemoteVolumeMonitor
member=MountAdded
peer=(name=org.freedesktop.DBus, label=tracker-*),
dbus receive bus=session path=/org/gtk/Private/RemoteVolumeMonitor
interface=org.gtk.Private.RemoteVolumeMonitor
member={List,IsSupported}
peer=(name=:*, label="{gnome-shell,gnome-control-center,gnome-extension-ding,tracker-*,unconfined}"),
dbus receive bus=session path=/{,org}
dbus receive bus=session path=/{,org,org/gtk,org/gtk/Private,org/gtk/Private/RemoteVolumeMonitor}
interface=org.freedesktop.DBus.Introspectable
member=Introspect
peer=(name=:*, label=gnome-shell),

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{bin}/kwin_x11
profile kwin_x11 @{exec_path} {
include <abstractions/base>
include <abstractions/dbus-strict>
include <abstractions/dri-common>
include <abstractions/dri-enumerate>
include <abstractions/fonts>

View File

@ -13,6 +13,7 @@ profile plasmashell @{exec_path} {
include <abstractions/audio>
include <abstractions/consoles>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
include <abstractions/disks-read>
include <abstractions/dri-common>
include <abstractions/dri-enumerate>

View File

@ -84,6 +84,11 @@ profile NetworkManager @{exec_path} flags=(attach_disconnected) {
interface=org.freedesktop.DBus.ObjectManager
member=GetManagedObjects,
dbus receive bus=system path=/org/bluez/hci*/**
interface=org.freedesktop.DBus.Properties
member=PropertiesChanged
peer=(name=:*),
dbus bind bus=system
name=org.freedesktop.NetworkManager,

View File

@ -10,6 +10,7 @@ include <tunables/global>
profile check-new-release-gtk @{exec_path} {
include <abstractions/base>
include <abstractions/apt-common>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dconf-write>
include <abstractions/fonts>

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{lib}/update-notifier/livepatch-notification
profile livepatch-notification @{exec_path} {
include <abstractions/base>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dconf-write>
include <abstractions/gtk>

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{lib}/update-notifier/ubuntu-advantage-notification
profile ubuntu-advantage-notification @{exec_path} {
include <abstractions/base>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dconf-write>
include <abstractions/gtk>

View File

@ -11,6 +11,7 @@ profile update-notifier @{exec_path} {
include <abstractions/base>
include <abstractions/apt-common>
include <abstractions/audio>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dconf-write>
include <abstractions/fonts>

View File

@ -9,30 +9,25 @@ include <tunables/global>
@{exec_path} = @{bin}/engrampa
profile engrampa @{exec_path} {
include <abstractions/base>
include <abstractions/dconf-write>
include <abstractions/X-strict>
include <abstractions/gtk>
include <abstractions/fonts>
include <abstractions/fontconfig-cache-read>
include <abstractions/freedesktop.org>
include <abstractions/nameservice-strict>
include <abstractions/user-download-strict>
include <abstractions/thumbnails-cache-read>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-gtk>
include <abstractions/dbus-session-strict>
include <abstractions/dconf-write>
include <abstractions/fontconfig-cache-read>
include <abstractions/fonts>
include <abstractions/freedesktop.org>
include <abstractions/gtk>
include <abstractions/ibus>
include <abstractions/nameservice-strict>
include <abstractions/thumbnails-cache-read>
include <abstractions/user-download-strict>
include <abstractions/X-strict>
dbus send bus=session path=/org/freedesktop/DBus
interface=org.freedesktop.DBus
member=GetId
peer=(name=org.freedesktop.DBus, label=dbus-daemon),
dbus send bus=session path=/ca/desrt/dconf/Writer/user
interface=ca.desrt.dconf.Writer
member={Change,Notify}
peer=(name=ca.desrt.dconf),
dbus send bus=session path=/org/gtk/Private/RemoteVolumeMonitor
interface=org.gtk.Private.RemoteVolumeMonitor
member={IsSupported,List}

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{bin}/file-roller
profile file-roller @{exec_path} {
include <abstractions/base>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dconf-write>
include <abstractions/fonts>

View File

@ -10,6 +10,8 @@ include <tunables/global>
@{exec_path} = @{bin}/keepassxc
profile keepassxc @{exec_path} {
include <abstractions/base>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
include <abstractions/dconf-write>
include <abstractions/devices-usb>
include <abstractions/dri-common>

View File

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{bin}/qemu-ga
profile qemu-ga @{exec_path} {
include <abstractions/base>
include <abstractions/dbus-strict>
capability mknod,
capability net_admin,