Bus Configuration

By default, the DBus system bus is locked down tightly. Each service is expected to provide its own bus configuration that tells DBus what is and is not allowed. Our configurations are stored in etc-conf/com.redhat.RHSM1.conf and etc-conf/com.redhat.RHSM1.Facts.conf. If you add a new interface, you must edit the appropriate file to expose it.

For example, let’s suppose we add a new interface com.redhat.RHSM1.Products that reports on a consumer’s installed products. We would need to edit etc-conf/com.redhat.RHSM1.conf and add a stanza like

<allow send_destination="com.redhat.RHSM1"

under the default context policy element.

Smoke Testing

I find the easy way to test is with d-feet which is a graphically application that allows you to browse DBus objects and the interfaces they make available. Unfortunately d-feet is only available in Fedora. So when testing on Red Hat Enterprise Linux systems, my tool of choice is dbus-send. The manual page for dbus-send is fairly good, but in essence you tell dbus-send the bus to use, the bus name to talk to and the bus method (including the interface) to call and then any required arguments. Here’s how to call the Config object’s GetAll method for example.

$ sudo dbus-send --system --print-reply --dest=com.redhat.RHSM1
'/com/redhat/RHSM1/Config' com.redhat.RHSM1.Config.GetAll

Note that sudo is required since I’m talking to the system bus.

Ad Hoc Testing

The services can be brought up without installing them and all the requisite configuration files by running the relevant executable in the bin directory. For example, running bin/rhsm-service will bring up the com.redhat.RHSM1 object. Pass in the -h flag for information on the options the script can take. You can define verbosity level, a different bus name, and specify which bus (system or session) to use.

Useful Tools

  • busctl (from systemd package) - CLI tool for interacting with DBus
  • gdbus (from glib2 package) - CLI tool for interacting with DBus
  • dbus-send (from dbus package) - CLI tool for interacting with DBus
  • dbus-monitor (from dbus package) - probe to print bus messages
  • d-feet - graphical tool to interact with DBus

I find d-feet to be the easiest to use for just ad-hoc tests. One of the CLI tools is the better choice if you’re going to be running the same command over and over.

Learning DBus


  • certmonger has a DBus api that models X.509 certs (org.fedorahosted.certmonger.ca interface)
  • dnfdaemon has an interface to packages/repos (org.baseurl.DNfSession)
  • telepathy has and extensive DBus API and python bindings (org.freedesktop.Telepath)
  • seahorse is a keyring tool with DBus interfaces (org.gnome.seahorse)
  • kwallet has a large DBus API (org.kde.kwallet5)
  • org.freedesktop.Udisks2 is a good example of using the org.freedesktop.DBus.ObjectManager interface
  • org.fedoraproject.FirewallD1 is another large API
Last modified on 15 June 2017