Products › lamco-dbus-tools › Docs
Audit a machine's D-Bus policy: A tutorial
Audit a machine's D-Bus policy: A tutorial that collects the system bus's policy files, units and polkit actions, reads the findings and compares a baseline.
Describes version 0.4.1. Run again as written on 2026-12-01, on Debian 13: Every step and what it says of the output holds.
This lesson audits your machine's system bus from its files: Who may call and own each name, what runs behind it and how hardened that is, what the permission files grant, and then what changed after a test edit. It reads files and asks the bus who owns what; it changes nothing. It takes a few minutes.
1. Build the programs
git clone <the repository> lamco-dbus-tools
cd lamco-dbus-tools
cargo build --release
export PATH=$PWD/target/release:$PATH
2. Collect
dbussee audit collect --out audit.json
The first line says what was read: How many names, service files, units, permission actions and
profiles. Then a row for each name. Look at the EVERY USER MAY column: call all means any user on the
machine may call any method of that service, by the bus's policy. That's often fine, because the service
asks polkit before doing anything that matters; the ACTIONS column is how many permission actions are
named for it.
3. The findings
dbustell audit audit.json
Each finding has an identifier, a title and what was seen, with the file and line. A POL- finding is
about the policy files, an AUD- finding about what's behind a name. Look for AUD-001: A root service
any user may call whose unit scores 9 or worse in systemd-analyze security. That pairing is what
security reviewers look at first.
4. One question
Pick a name from the table and ask:
dbustell policy audit.json --user "$USER" --call org.freedesktop.hostname1 org.freedesktop.hostname1 SetHostname
The answer comes for dbus-daemon and for dbus-broker, with the rule that decided each. When they differ,
the policy reads differently on the two implementations, which POL-004 in the audit also names.
5. A change, against a baseline
Make a copy of the files to change, so the machine's own stay as they are:
mkdir -p /var/tmp/copy/etc /var/tmp/copy/usr/share
cp -a /usr/share/dbus-1 /var/tmp/copy/usr/share/
cp -a /etc/dbus-1 /var/tmp/copy/etc/
cp /etc/passwd /etc/group /var/tmp/copy/etc/
dbussee audit collect --root /var/tmp/copy --no-score --out before.json
Edit one file in the copy: In /var/tmp/copy/usr/share/dbus-1/system.d/org.freedesktop.hostname1.conf,
add <allow own_prefix="org.freedesktop.hostname1"/> inside the <policy context="default"> block. Then:
dbussee audit collect --root /var/tmp/copy --no-score --out after.json
dbustell audit after.json --baseline before.json
One finding is marked [new], POL-003: Every user may now take the name. Below the findings, it lists what
changed for that name on each implementation.
What you've seen
- An audit reads the policy as each bus implementation reads it, and the units and permission files beside it.
- A verdict names the rule that decided it.
- A baseline makes next month's audit say only what's new.
Auditing a machine, asking whether this may send that and keeping a baseline go further.