Products › lamco-dbus-tools › Docs

Check a D-Bus policy: May this user send that, or own a name?

Check a D-Bus policy: Ask whether a user may send a call or own a name, with the rule that decided, and test a policy file on dbus-daemon and dbus-broker.

Describes version 0.4.1.

From a collection

$ dbustell policy audit.json --user "$USER" --call org.freedesktop.hostname1 org.freedesktop.hostname1 SetHostname
dbus-daemon: allowed, by /usr/share/dbus-1/system.d/org.freedesktop.hostname1.conf:25 <allow send_destination="org.freedesktop.hostname1"/>
dbus-broker: allowed, by /usr/share/dbus-1/system.d/org.freedesktop.hostname1.conf:25 <allow send_destination="org.freedesktop.hostname1"/>
$ dbustell policy audit.json --user "$USER" --own com.redhat.NewPrinterNotification.Sub
dbus-daemon: denied, by /usr/share/dbus-1/system.conf:50 <deny own="*"/>
dbus-broker: allowed, by /etc/dbus-1/system.d/com.redhat.NewPrinterNotification.conf:11 <allow own="com.redhat.NewPrinterNotification"/>

It gives each implementation's verdict, and the rule that decided it. The second shows a difference the oracle measured: dbus-broker's exact own rule also covers the names below it. --group NAME adds a group; --call DEST - MEMBER asks about a call with no interface. That the policy allows a call says nothing of what the service then checks itself.

On both real daemons

mine.conf, a file that refuses calls by their interface:

<busconfig>
  <policy context="default">
    <deny send_interface="com.example.Svc"/>
  </policy>
</busconfig>
$ dbusdo policy probe --probe "call com.example.Svc com.example.Svc Echo" --probe "call com.example.Svc - Echo" mine.conf
mine.conf on a base of Open, probed as user:
  dbus-daemon D-Bus Message Bus Daemon 1.16.2: started
  dbus-broker dbus-broker 37: started
  dbus-daemon  call com.example.Svc com.example.Svc Echo /          denied
      by mine.conf:3 <deny send_interface="com.example.Svc"/>
  dbus-daemon  call com.example.Svc - Echo /                        denied
      by mine.conf:3 <deny send_interface="com.example.Svc"/>
  dbus-broker  call com.example.Svc com.example.Svc Echo /          denied
      by mine.conf:3 <deny send_interface="com.example.Svc"/>
  dbus-broker  call com.example.Svc - Echo /                        allowed
      by the base, line 7 <allow send_destination="*"/>
The evaluator agrees with every daemon on every probe.

Each daemon starts on a private bus with the file included after a base of rules, and the probes go to stand-ins. Nothing on the machine's buses is touched. --base system includes the file after the stock system bus's rules, which is how a file from system.d is read. --probes FILE takes one probe on each line: call DEST INTERFACE|- MEMBER [PATH] or own NAME. A daemon that refuses to start on the file is a result too.

--implementation daemon or broker gives the file to one daemon only (docs/measurements/stage-13/flags/, with this page's mine.conf):

$ dbusdo policy probe --implementation broker --probe "call com.example.Svc - Echo" mine.conf
mine.conf on a base of Open, probed as user:
  dbus-broker dbus-broker 37: started
  dbus-broker  call com.example.Svc - Echo /                        allowed  
      by the base, line 7 <allow send_destination="*"/>
The evaluator agrees with every daemon on every probe.

The differences between the two implementations

POL-004 in an audit names each file that reads differently, with the rules and why. The ones measured:

  • A deny by interface also refuses a call with no interface on dbus-daemon, and not on dbus-broker.
  • dbus-broker doesn't know send_destination_prefix, and applies the rest of the rule without it.
  • An exact own rule covers the names below it on dbus-broker.
  • dbus-daemon refuses to start on a rule naming a member with no interface or path.

Bus policy evaluation has them all.