Skip to content

Commit

Permalink
feat(dbus): rewrite some dbus rules (6).
Browse files Browse the repository at this point in the history
  • Loading branch information
roddhjav committed Dec 5, 2023
1 parent ebf3932 commit c066ef0
Show file tree
Hide file tree
Showing 29 changed files with 122 additions and 412 deletions.
2 changes: 1 addition & 1 deletion apparmor.d/abstractions/bus/desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

dbus send bus=session path=/org/freedesktop/portal/desktop
interface=org.freedesktop.DBus.Properties
member=Read
member={GetAll,Read}
peer=(name="{:*,org.freedesktop.portal.Desktop}", label=xdg-desktop-portal),

dbus send bus=session path=/org/freedesktop/portal/desktop
Expand Down
10 changes: 10 additions & 0 deletions apparmor.d/abstractions/bus/notification
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2023 Alexandre Pujol <[email protected]>
# SPDX-License-Identifier: GPL-2.0-only

dbus send bus=session path=/org/freedesktop/Notifications
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=:*, label=gjs-console),

include if exists <abstractions/bus/notification.d>
5 changes: 5 additions & 0 deletions apparmor.d/abstractions/bus/udisk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
member=GetManagedObjects
peer=(name=:*, label=udisksd),

dbus send bus=system path=/org/freedesktop/UDisks2/**
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=:*, label=udisksd),

dbus receive bus=system path=/org/freedesktop/UDisks2
interface=org.freedesktop.DBus.ObjectManager
member=InterfacesAdded
Expand Down
26 changes: 0 additions & 26 deletions apparmor.d/abstractions/dbus-gtk

This file was deleted.

24 changes: 15 additions & 9 deletions apparmor.d/groups/freedesktop/geoclue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@ profile geoclue @{exec_path} flags=(attach_disconnected) {
network inet6 stream,
network netlink raw,

dbus (send,receive) bus=system path=/org/freedesktop/GeoClue2/{Agent,Manager}
interface=org.freedesktop.{DBus.Properties,GeoClue2*},
dbus bind bus=system name=org.freedesktop.GeoClue2,
dbus send bus=system path=/org/freedesktop/GeoClue2/*
interface=org.freedesktop.DBus.Properties
peer=(name="{:*,org.freedesktop.DBus}"),
dbus receive bus=system path=/org/freedesktop/GeoClue2/*
interface=org.freedesktop.DBus.Properties
peer=(name=:*),
dbus receive bus=system path=/org/freedesktop/GeoClue2/*
interface=org.freedesktop.GeoClue2.Manager
peer=(name=:*),

dbus send bus=system path=/org/freedesktop/DBus
interface=org.freedesktop.DBus
member={GetConnectionUnixProcessID,GetConnectionUnixUser,ReleaseName,RequestName}
peer=(name=org.freedesktop.DBus),
member={GetConnectionUnixUser,GetConnectionUnixProcessID}
peer=(name=org.freedesktop.DBus, label=dbus-daemon),

dbus send bus=system path=/
interface=org.freedesktop.Avahi.Server
Expand All @@ -36,9 +44,10 @@ profile geoclue @{exec_path} flags=(attach_disconnected) {
interface=org.freedesktop.DBus.Peer
member=Ping,

dbus send bus=system path=/fi/w[0-9]/wpa_supplicant[0-9]
dbus send bus=system path=/fi/w1/wpa_supplicant1
interface=org.freedesktop.DBus.Properties
member=GetAll,
member=PropertiesChanged
peer=(name=:*, label=wpa-supplicant),

dbus send bus=system path=/org/freedesktop/ModemManager[0-9]
interface=org.freedesktop.DBus.ObjectManager
Expand All @@ -65,9 +74,6 @@ profile geoclue @{exec_path} flags=(attach_disconnected) {
interface=org.freedesktop.DBus.Properties
member=PropertiesChanged,

dbus bind bus=system
name=org.freedesktop.GeoClue2,

@{exec_path} mr,

/usr/share/glib-2.0/schemas/gschemas.compiled r,
Expand Down
12 changes: 8 additions & 4 deletions apparmor.d/groups/gnome/gnome-extension-ding
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include <tunables/global>
profile gnome-extension-ding @{exec_path} {
include <abstractions/base>
include <abstractions/bus/atspi>
include <abstractions/bus/notification>
include <abstractions/bus/vfs/daemon>
include <abstractions/bus/vfs/metadata>
include <abstractions/bus/vfs/mount>
Expand Down Expand Up @@ -44,10 +45,10 @@ profile gnome-extension-ding @{exec_path} {
member=GetAll
peer=(name=:*, label=nautilus),

dbus send bus=session path=/org/freedesktop/Notifications
dbus send bus=system path=/net/hadess/SwitcherooControl
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=:*, label=gjs-console),
peer=(name=:*, label=switcheroo-control),

dbus send bus=session path=/org/gnome/Nautilus/FileOperations*
interface=org.freedesktop.DBus.Properties
Expand All @@ -63,8 +64,11 @@ profile gnome-extension-ding @{exec_path} {
member=Introspect
peer=(name=:*, label=nautilus),

dbus send bus={systemd,session} path=/org/freedesktop/DBus
interface=org.freedesktop.DBus{,.Properties}
dbus send bus=session path=/org/freedesktop/DBus
interface=org.freedesktop.DBus*
peer=(name=org.freedesktop.DBus, label=dbus-daemon),
dbus send bus=system path=/org/freedesktop/DBus
interface=org.freedesktop.DBus*
peer=(name=org.freedesktop.DBus, label=dbus-daemon),

@{exec_path} mr,
Expand Down
2 changes: 1 addition & 1 deletion apparmor.d/groups/gnome/gnome-session-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ profile gnome-session-ctl @{exec_path} {
dbus send bus=session path=/org/freedesktop/systemd1
interface=org.freedesktop.systemd1.Manager
member={StartUnit,StopUnit}
peer=(name=org.freedesktop.systemd1),
peer=(name=org.freedesktop.systemd1, label="@{systemd}"),

dbus send bus=session path=/org/gnome/SessionManager
interface=org.gnome.SessionManager
Expand Down
3 changes: 3 additions & 0 deletions apparmor.d/groups/gnome/gnome-shell
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ profile gnome-shell @{exec_path} flags=(attach_disconnected) {
include <abstractions/audio>
include <abstractions/bus/account-daemon>
include <abstractions/bus/atspi>
include <abstractions/bus/desktop>
include <abstractions/bus/gnome-screensaver>
include <abstractions/bus/network-manager>
include <abstractions/bus/polkit>
include <abstractions/bus/session-manager>
include <abstractions/bus/upower>
include <abstractions/bus/vfs/metadata>
include <abstractions/bus/vfs/mount>
Expand Down
41 changes: 6 additions & 35 deletions apparmor.d/groups/gnome/gsd-color
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ include <tunables/global>
profile gsd-color @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/bus/atspi>
include <abstractions/bus/session-manager>
include <abstractions/bus/vfs/mount>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
Expand All @@ -23,6 +25,10 @@ profile gsd-color @{exec_path} flags=(attach_disconnected) {
signal (receive) set=(term, hup) peer=gdm*,

dbus bind bus=session name=org.gnome.SettingsDaemon.Color,
dbus receive bus=session path=/org/gnome/SettingsDaemon/Color
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=:*, label=gnome-shell),

dbus (send, receive) bus=system path=/org/freedesktop/ColorManager{,/devices/*}
interface=org.freedesktop.ColorManager*,
Expand All @@ -31,36 +37,6 @@ profile gsd-color @{exec_path} flags=(attach_disconnected) {
interface=org.freedesktop.DBus.Properties
member=GetAll,

dbus receive bus=session path=/org/gnome/SettingsDaemon/Color
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=:*, label=gnome-shell),

dbus (send, receive) bus=session path=/org/gnome/SessionManager{,/Client[0-9]*}
interface=org.freedesktop.DBus.Properties
member={GetAll,PropertiesChanged}
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/SessionManager/Client[0-9]*
interface=org.gnome.SessionManager.ClientPrivate
member=EndSessionResponse
peer=(name=:*, label=gnome-session-binary),

dbus receive bus=session path=/org/gnome/SessionManager/Client[0-9]*
interface=org.gnome.SessionManager.ClientPrivate
member={CancelEndSession,QueryEndSession,EndSession,Stop}
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/SessionManager
interface=org.gnome.SessionManager
member=RegisterClient
peer=(name=:*, label=gnome-session-binary),

dbus receive bus=session path=/org/gnome/SessionManager
interface=org.gnome.SessionManager
member={ClientAdded,SessionRunning,ClientRemoved,InhibitorRemoved,InhibitorAdded}
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/Mutter/DisplayConfig
interface=org.gnome.Mutter.DisplayConfig
member={GetResources,GetCrtcGamma}
Expand All @@ -71,11 +47,6 @@ profile gsd-color @{exec_path} flags=(attach_disconnected) {
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
interface=org.freedesktop.DBus.Introspectable
member=Introspect
Expand Down
13 changes: 3 additions & 10 deletions apparmor.d/groups/gnome/gsd-disk-utility-notify
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2021 Alexandre Pujol <[email protected]>
# Copyright (C) 2021-2023 Alexandre Pujol <[email protected]>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/3.0>,
Expand All @@ -9,24 +9,17 @@ include <tunables/global>
@{exec_path} = @{lib}/gsd-disk-utility-notify
profile gsd-disk-utility-notify @{exec_path} {
include <abstractions/base>
include <abstractions/bus/udisk>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>

dbus receive bus=system path=/org/freedesktop/UDisks2{,/**}
interface=org.freedesktop.DBus.{Properties,ObjectManager},

dbus send bus=system path=/org/freedesktop/UDisks2
interface=org.freedesktop.DBus.ObjectManager
member=GetManagedObjects,
dbus bind bus=session name=org.gnome.Disks.NotificationMonitor,

dbus receive bus=session
interface=org.freedesktop.DBus.Introspectable
member=Introspect
peer=(name=:*, label=gnome-shell),

dbus bind bus=session
name=org.gnome.Disks.NotificationMonitor,

@{exec_path} mr,

include if exists <local/gsd-disk-utility-notify>
Expand Down
1 change: 1 addition & 0 deletions apparmor.d/groups/gnome/gsd-keyboard
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include <tunables/global>
profile gsd-keyboard @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/bus/atspi>
include <abstractions/bus/locale>
include <abstractions/bus/session-manager>
include <abstractions/bus/vfs/mount>
include <abstractions/dbus-accessibility-strict>
Expand Down
32 changes: 2 additions & 30 deletions apparmor.d/groups/gnome/gsd-media-keys
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ profile gsd-media-keys @{exec_path} flags=(attach_disconnected) {
include <abstractions/bus/atspi>
include <abstractions/bus/hostname>
include <abstractions/bus/login>
include <abstractions/bus/session-manager>
include <abstractions/bus/vfs/mount>
include <abstractions/dbus-accessibility-strict>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
Expand Down Expand Up @@ -40,31 +42,6 @@ profile gsd-media-keys @{exec_path} flags=(attach_disconnected) {
member=GetAll
peer=(name=:*, label=upowerd),

dbus (send, receive) bus=session path=/org/gnome/SessionManager{,/Client[0-9]*}
interface=org.freedesktop.DBus.Properties
member={GetAll,PropertiesChanged}
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/SessionManager/Client[0-9]*
interface=org.gnome.SessionManager.ClientPrivate
member=EndSessionResponse
peer=(name=:*, label=gnome-session-binary),

dbus receive bus=session path=/org/gnome/SessionManager/Client[0-9]*
interface=org.gnome.SessionManager.ClientPrivate
member={CancelEndSession,QueryEndSession,EndSession,Stop}
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/SessionManager
interface=org.gnome.SessionManager
member=RegisterClient
peer=(name=:*, label=gnome-session-binary),

dbus receive bus=session path=/org/gnome/SessionManager
interface=org.gnome.SessionManager
member={ClientAdded,SessionRunning,ClientRemoved,InhibitorRemoved,InhibitorAdded}
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/Shell
interface=org.freedesktop.DBus.Properties
member=GetAll
Expand Down Expand Up @@ -110,11 +87,6 @@ profile gsd-media-keys @{exec_path} flags=(attach_disconnected) {
member=WatchFired
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
interface=org.freedesktop.DBus.Introspectable
member=Introspect
Expand Down
23 changes: 8 additions & 15 deletions apparmor.d/groups/gnome/gsd-power
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ profile gsd-power @{exec_path} flags=(attach_disconnected) {
include <abstractions/bus/atspi>
include <abstractions/bus/gnome-screensaver>
include <abstractions/bus/login>
include <abstractions/bus/session-manager>
include <abstractions/bus/upower>
include <abstractions/bus/vfs/mount>
include <abstractions/dbus-accessibility-strict>
Expand All @@ -34,19 +35,6 @@ profile gsd-power @{exec_path} flags=(attach_disconnected) {
interface=org.freedesktop.DBus.Properties
peer=(name="{org.freedesktop.DBus,:*}", label="{gsd-media-keys,gnome-shell}"),

dbus send bus=session path=/org/gnome/SessionManager{,/**}
interface=org.freedesktop.DBus.Properties
peer=(name=:*),
dbus send bus=session path=/org/gnome/SessionManager{,/**}
interface=org.gnome.SessionManager
peer=(name=:*),
dbus receive bus=session path=/org/gnome/SessionManager{,/**}
interface=org.gnome.SessionManager{,.*}
peer=(name=:*, label=gnome-session-binary),
dbus receive bus=session path=/org/gnome/SessionManager{,/**}
interface=org.freedesktop.DBus.Properties
peer=(name=:*, label=gnome-session-binary),

dbus send bus=session path=/org/gnome/Mutter/**
interface=org.freedesktop.DBus.{Properties,ObjectManager}
peer=(name=:*, label=gnome-shell),
Expand Down Expand Up @@ -79,9 +67,14 @@ profile gsd-power @{exec_path} flags=(attach_disconnected) {
member=GetAll
peer=(name=:*, label=power-profiles-daemon),

dbus send bus=system path=/org/freedesktop/systemd1
dbus send bus=system path=/org/freedesktop/login1/session/auto
interface=org.freedesktop.DBus.Properties
peer=(name=org.freedesktop.systemd1, label="@{systemd}"),
member=GetAll
peer=(name=:*, label=systemd-logind),
dbus send bus=system path=/org/freedesktop/login1/session/auto
interface=org.freedesktop.login1.Session
member=SetBrightness
peer=(name=:*, label=systemd-logind),

dbus receive bus=session
interface=org.freedesktop.DBus.Introspectable
Expand Down
Loading

0 comments on commit c066ef0

Please sign in to comment.