Products › lamco-dbus-tools › Interfaces
AppArmor and SELinux D-Bus rules: USER_AVC and refused calls
AppArmor dbus rules and SELinux's dbus class can refuse a D-Bus call the bus policy allows, and lamco-dbus-tools joins the USER_AVC line to the caller's error.
AppArmor and SELinux both reach into D-Bus. The bus asks the kernel's security module about each message it routes and each name a connection asks for, so a call the bus's own policy allows can still be refused. The caller gets the same AccessDenied either way, which is why these refusals are hard to place: The bus policy looks fine, and the reason is in the audit log, as a USER_AVC line for SELinux or a denial line of AppArmor's. lamco-dbus-tools reads the AppArmor profiles' D-Bus rules and whether SELinux is on, and joins a refusal's log lines to the error the caller got.
What it is
SELinux. The dbus-daemon(1) man page says the bus checks SELinux in two places. When a message is routed from one connection to another, it asks with the sender's security context as source, the recipient's as target, object class dbus and permission send_msg. When a connection asks to own a name, it asks with the connection's context as source, the context the configuration's <associate> element gives that name as target (the bus's own when none does), and permission acquire_svc. The bus reports a refusal to the audit system, where it appears as USER_AVC. A connection's context is the LinuxSecurityLabel that GetConnectionCredentials returns.
AppArmor. D-Bus rules live in each application's AppArmor profile, not in the bus's configuration. apparmor.d(5) gives the form: A dbus rule with access send, receive, bind or eavesdrop, and conditions on bus=, path=, interface=, member= and peer=(name=..., label=...). Rules accumulate, so what's granted is the union of them. The man page for dbus-daemon says it checks AppArmor in three places: Each message routed, each name requested, and each attempt to eavesdrop. Replies to an allowed message are allowed implicitly. Its <apparmor mode="enabled|disabled|required"/> element says whether mediation runs. Snap's confinement is built on these rules.
A bus that mediates says so in its Features property, which lists AppArmor or SELinux only when mediation is active at run time.
Errors you'll meet
org.freedesktop.DBus.Error.AccessDenied: The bus refused the call, here because the security module said no. On dbus-broker the bus's own line starts "A security policy denied", anddbustell errorsjoins it to SELinux's decision.
How lamco-dbus-tools reads it
dbussee audit collect reads the D-Bus rules of AppArmor profiles and whether SELinux is on, beside the bus's policy, and dbussee bus records the bus's Features. dbussee record reads the host's journal for its span unless given --no-host. dbusdo has no command for these modules. dbustell errors groups errors by name, sender and the call they answered, the bus's own apart, and joins dbus-broker's denial line and SELinux's USER_AVC decision to the error a caller got.
dbussee audit collect --out audit.json # AppArmor's D-Bus rules, and whether SELinux is on
dbussee bus --bus system # the bus's Features: AppArmor or SELinux mediation
dbussee record --bus system --all --duration 20 --out refused.json # the refused call, with the journal's lines
dbustell errors refused.json # the error, the bus's line and SELinux's decision, joined
Where it has been run
The README's run record lists an SELinux refusal of a D-Bus message on Fedora 44, enforcing, with no policy changed: A socket labelled as the print service refused by the system bus, and dbustell errors naming dbus-broker's line and SELinux's decision, on 2026-12-02. On Fedora 44 with SELinux enforcing, the kernel part's unit ran with no denial on the same date. The policy audit of Debian 13 and Fedora 45 (2026-11-30) read AppArmor's and SELinux's state with the rest. The record doesn't cover an AppArmor refusal of a D-Bus message.
Findings
CALL-004: The bus refused or couldn't deliver calls.AUD-005: Permission files the audit couldn't read.
Related
- The bus in the journal, where these lines are found.
- Snap and Firejail D-Bus rules, which build on AppArmor.
- Access denied on the system bus.
- apparmor.d(5), the D-Bus rules' grammar.