| 1 |
=========== |
| 2 |
dbus-broker |
| 3 |
=========== |
| 4 |
|
| 5 |
-------------------- |
| 6 |
D-Bus message broker |
| 7 |
-------------------- |
| 8 |
|
| 9 |
:Manual section: 1 |
| 10 |
:Manual group: User Commands |
| 11 |
|
| 12 |
SYNOPSIS |
| 13 |
======== |
| 14 |
|
| 15 |
| ``dbus-broker`` [ OPTIONS ] |
| 16 |
| ``dbus-broker`` ``--version`` |
| 17 |
| ``dbus-broker`` ``--help`` |
| 18 |
|
| 19 |
|
| 20 |
DESCRIPTION |
| 21 |
=========== |
| 22 |
|
| 23 |
**dbus-broker** is an implementation of the D-Bus Message Bus |
| 24 |
Specification [#]_. Each instance provides a single, unique message bus that |
| 25 |
clients can connect to, and send messages over. The broker takes care of |
| 26 |
message mediation, access control, subscriptions, and bus control, according to |
| 27 |
the D-Bus specification. |
| 28 |
|
| 29 |
**dbus-broker** is a *pure* implementation, meaning that it only implements the |
| 30 |
message mediation. It needs a controlling process that performs the bus setup |
| 31 |
and all external communication. **dbus-broker-launch**\(1) is such a controller |
| 32 |
aiming at perfect compatibility to **dbus-daemon**\(1), the D-Bus Reference |
| 33 |
Implementation. See **dbus-broker-launch**\(1) for details how to spawn a |
| 34 |
message bus. |
| 35 |
|
| 36 |
This man-page documents the interface between **dbus-broker** and its |
| 37 |
controller (e.g., **dbus-broker-launch**\(1)). |
| 38 |
|
| 39 |
OPTIONS |
| 40 |
======= |
| 41 |
|
| 42 |
The following command-line options are supported. If an option is passed, which |
| 43 |
is not listed here, the broker will deny startup and exit with an error. |
| 44 |
|
| 45 |
-h, --help print usage information and exit immediately |
| 46 |
--version print build-version and exit immediately |
| 47 |
--audit enable logging to the linux audit subsystem |
| 48 |
(no-op if audit support was not compiled in; |
| 49 |
**Default**: off) |
| 50 |
--controller=FD use the inherited file-descriptor with the |
| 51 |
given number as the controlling socket (see |
| 52 |
**CONTROLLER** section; this option is |
| 53 |
mandatory) |
| 54 |
--log FD use the inherited file-descriptor with the |
| 55 |
given number to access the system log (see |
| 56 |
**LOGGING** section; **Default**: no logging) |
| 57 |
--machine-id=ID set the machine-id to be advertised by the |
| 58 |
broker via the org.freedesktop.DBus interface |
| 59 |
(this option is mandatory and usually sourced |
| 60 |
from /etc/machine-id) |
| 61 |
--max-bytes=BYTES maximum number of bytes each user may |
| 62 |
allocate in the broker (**Default**: 16 MiB) |
| 63 |
--max-fds=FDS maximum number of file descriptors each user |
| 64 |
may allocate in the broker (**Default**: 64) |
| 65 |
--max-matches=MATCHES maximum number of match rules each user may |
| 66 |
allocate in the broker (**Default**: 16k) |
| 67 |
--max-objects=OBJECTS maximum total number of names, peers, pending |
| 68 |
replies, etc each user may allocate in the |
| 69 |
broker (**Default**: 16k) |
| 70 |
|
| 71 |
CONTROLLER |
| 72 |
========== |
| 73 |
|
| 74 |
Every instance of **dbus-broker** inherits a **unix**\(7) socket from its |
| 75 |
parent process. This socket must be specified via the **--controller** |
| 76 |
option. The broker uses this socket to accept control commands from its parent |
| 77 |
process (or from whomever owns the other side of this socket, also called *The |
| 78 |
Controller*). This socket uses normal D-Bus P2P communication. The interfaces |
| 79 |
provided on this socket are described in the **API** section. |
| 80 |
|
| 81 |
By default, a broker instance is idle. That is, after forking and executing a |
| 82 |
broker, it starts with an empty list of bus-sockets to manage, as well as no |
| 83 |
way for clients to connect to it. The controller must use the controller |
| 84 |
interface to create listener sockets, specify the bus policy, create |
| 85 |
activatable names, and react to bus events. |
| 86 |
|
| 87 |
The **dbus-broker** process never accesses any external resources other than |
| 88 |
those passed in either via the command-line or the controller interfaces. That |
| 89 |
is, no file-system access, no **nss**\(5) calls, no external process |
| 90 |
communication, is performed by the broker. On the contrary, the broker never |
| 91 |
accesses any resources but the sockets provided to it by the controller. This |
| 92 |
is guaranteed by the implementation. At the same time, this implies that the |
| 93 |
controller is required to perform all external resource acquisitions and |
| 94 |
communication on behalf of the broker (in case this is needed). |
| 95 |
|
| 96 |
LOGGING |
| 97 |
======= |
| 98 |
|
| 99 |
If a logging FD is provided via the **--log** command-line option, the broker |
| 100 |
will log some information through this FD. Two different log-types are |
| 101 |
supported: |
| 102 |
|
| 103 |
1. If the FD is a **unix**\(7) **SOCK_STREAM** socket, information is logged |
| 104 |
as human-readable line-based chunks. |
| 105 |
|
| 106 |
2. If the FD is a **unix**\(7) **SOCK_DGRAM** socket, information is logged as |
| 107 |
key/value based annotated data blocks. The format is compatible to the |
| 108 |
format used by the systemd-journal (though it is not dependent on systemd). |
| 109 |
This key/value based logging is a lot more verbose as the stream based |
| 110 |
logging. A lot of metadata is provided as separate keys, allowing precise |
| 111 |
tracing and interpretation of the logged data. |
| 112 |
|
| 113 |
The broker has strict rules when it logs data. It logs during startup and |
| 114 |
shutdown, one message each to provide information on its setup and environment. |
| 115 |
At runtime, the broker only ever logs in unexpected situations. That is, every |
| 116 |
message the broker logs at runtime was triggered by a malfunctioning client. If |
| 117 |
a system is properly set up, no runtime log-message will be triggered. |
| 118 |
|
| 119 |
The situations where the broker logs are: |
| 120 |
|
| 121 |
1. During startup and shutdown, the broker submits a short message including |
| 122 |
metadata about its controller, environment, and setup. |
| 123 |
|
| 124 |
2. Whenever a client-request is denied by the policy, a message is logged |
| 125 |
including the affected client and policies. |
| 126 |
|
| 127 |
3. Whenever a client exceeds its resource quota, a message is logged with |
| 128 |
information on the client. |
| 129 |
|
| 130 |
API |
| 131 |
=== |
| 132 |
|
| 133 |
The following interfaces are implemented by the broker on the respective nodes. |
| 134 |
The controller is free to call these at any time. The controller connection is |
| 135 |
considered trusted. No resource accounting, nor access control is performed. |
| 136 |
|
| 137 |
The controller itself is also required to implement interfaces to be used by |
| 138 |
the broker. See the section below for a list of interfaces on the controller. |
| 139 |
|
| 140 |
| |
| 141 |
| **node** /org/bus1/DBus/Broker { |
| 142 |
| **interface** org.bus1.DBus.Broker { |
| 143 |
| |
| 144 |
| # Create new activatable name @name, accounted on user @uid. The name |
| 145 |
| # will be exposed by the controller as @path (which must fit the |
| 146 |
| # template */org/bus1/DBus/Name/%*). |
| 147 |
| **method** AddName(**o** *path*, **s** *name*, **u** *uid*) -> () |
| 148 |
| |
| 149 |
| # Add a listener socket to this bus. The listener socket must be |
| 150 |
| # ready in listening mode and specified as @socket. As soon as this |
| 151 |
| # call returns, incoming client connection attempts will be served |
| 152 |
| # on this socket. |
| 153 |
| # The listener is exposed by the controller as @path (which must fit |
| 154 |
| # the template */org/bus1/DBus/Listener/%*). |
| 155 |
| # The policy for all clients connecting through this socket is |
| 156 |
| # provided as @policy. See **org.bus1.DBus.Listener.SetPolicy()** for |
| 157 |
| # details. |
| 158 |
| **method** AddListener(**o** *path*, **h** *socket*, **v** *policy*) -> () |
| 159 |
| |
| 160 |
| # This signal is raised according to client-requests of |
| 161 |
| # **org.freedesktop.DBus.UpdateActivationEnvironment()**. |
| 162 |
| **signal** SetActivationEnvironment(**a{ss}** *environment*) |
| 163 |
| |
| 164 |
| } |
| 165 |
| } |
| 166 |
| |
| 167 |
| **node** /org/bus1/DBus/Listener/% { |
| 168 |
| **interface** org.bus1.DBus.Listener { |
| 169 |
| |
| 170 |
| # Release this listener. It will immediately be removed by the broker |
| 171 |
| # and no more connections will be served on it. All clients connected |
| 172 |
| # through this listener are forcefully disconnected. |
| 173 |
| **method** Release() -> () |
| 174 |
| |
| 175 |
| # Change the policy on this listener socket to @policy. The syntax of |
| 176 |
| # the policy is still subject to change and not stable, yet. |
| 177 |
| **method** SetPolicy(**v** *policy*) -> () |
| 178 |
| |
| 179 |
| } |
| 180 |
| } |
| 181 |
| |
| 182 |
| **node** /org/bus1/DBus/Name/% { |
| 183 |
| **interface** org.bus1.DBus.Name { |
| 184 |
| |
| 185 |
| # Release this activatable name. It will be removed with immediate |
| 186 |
| # effect by the broker. Note that the name is still valid to be |
| 187 |
| # acquired by clients, though no activation-features will be |
| 188 |
| # supported on this name. |
| 189 |
| **method** Release() -> () |
| 190 |
| |
| 191 |
| # Reset the activation state of this name. Any pending activation |
| 192 |
| # requests are cancelled. The call requires a serial number to be |
| 193 |
| # passed along. This must be the serial number received by the last |
| 194 |
| # activation event on this name. Calls for other serial numbers are |
| 195 |
| # silently ignored and considered stale. |
| 196 |
| # A org.bus1.DBus.Name.Error string is also passed, giving a hint |
| 197 |
| # about the reason the activation was reset. The list is defined below. |
| 198 |
| **method** Reset(**t** *serial*, **s** *error*) -> () |
| 199 |
| |
| 200 |
| # Activation request failed: a concurrent deactivation request is already in progress |
| 201 |
| **error** *org.bus1.DBus.Name.Error.DestructiveTransaction* |
| 202 |
| # Activation request failed: unknown unit |
| 203 |
| **error** *org.bus1.DBus.Name.Error.UnknownUnit* |
| 204 |
| # Activation request failed: unit is masked |
| 205 |
| **error** *org.bus1.DBus.Name.Error.MaskedUnit* |
| 206 |
| # Activation request failed: unit is invalid |
| 207 |
| **error** *org.bus1.DBus.Name.Error.InvalidUnit* |
| 208 |
| # Unit activation job succeeded, but the unit failed afterwards |
| 209 |
| **error** *org.bus1.DBus.Name.Error.UnitFailure* |
| 210 |
| # The startup job was valid, but it failed during activation |
| 211 |
| **error** *org.bus1.DBus.Name.Error.StartupFailure* |
| 212 |
| # The startup job was valid, but it was skipped during activation |
| 213 |
| **error** *org.bus1.DBus.Name.Error.StartupSkipped* |
| 214 |
| # Activation request cancelled: bus name was released |
| 215 |
| **error** *org.bus1.DBus.Name.Error.NameReleased* |
| 216 |
| |
| 217 |
| # This signal is sent whenever a client requests activation of this |
| 218 |
| # name. Note that multiple activation requests are coalesced by the |
| 219 |
| # broker. The controller can cancel outstanding requests via the |
| 220 |
| # **Reset()** method. |
| 221 |
| # The broker sends a serial number with the event. This number |
| 222 |
| # represents the activation request and must be used when reacting |
| 223 |
| # to the request with methods like *Reset()*. The serial number is |
| 224 |
| # unique for each event, and is never reused. A serial number of 0 |
| 225 |
| # is never sent and considered invalid. |
| 226 |
| **signal** Activate(**t** *serial*) |
| 227 |
| |
| 228 |
| } |
| 229 |
| } |
| 230 |
| |
| 231 |
|
| 232 |
The controller itself is required to implement the following interfaces on the |
| 233 |
given nodes. These interfaces are called by the broker to implement some parts |
| 234 |
of the driver-interface as defined by the D-Bus specification. |
| 235 |
|
| 236 |
Note that all method-calls performed by the broker are always fully |
| 237 |
asynchronous. That is, regardless how long it takes to serve the request, the |
| 238 |
broker is still fully operational and might even send further requests to the |
| 239 |
controller. |
| 240 |
|
| 241 |
A controller is free to implement these calls in a blocking fashion. However, |
| 242 |
it is up to the controller to make sure not to perform **blocking** recursive |
| 243 |
calls back into the broker (via any means). |
| 244 |
|
| 245 |
| |
| 246 |
| **node** /org/bus1/DBus/Controller { |
| 247 |
| **interface** org.bus1.DBus.Controller { |
| 248 |
| |
| 249 |
| # This function is called for each client-request of |
| 250 |
| # *org.freedesktop.DBus.ReloadConfig()*. |
| 251 |
| **method** ReloadConfig() -> () |
| 252 |
| |
| 253 |
| } |
| 254 |
| } |
| 255 |
| |
| 256 |
|
| 257 |
SEE ALSO |
| 258 |
======== |
| 259 |
|
| 260 |
``dbus-broker-launch``\(1) |
| 261 |
``dbus-daemon``\(1) |
| 262 |
|
| 263 |
NOTES |
| 264 |
===== |
| 265 |
|
| 266 |
.. [#] D-Bus Specification: |
| 267 |
https://dbus.freedesktop.org/doc/dbus-specification.html |