1dbus-daemon(1) General Commands Manual dbus-daemon(1)
2
3
4
6 dbus-daemon - Message bus daemon
7
9 dbus-daemon dbus-daemon [--version] [--session] [--system] [--config-
10 file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]]
11 [--fork]
12
13
15 dbus-daemon is the D-Bus message bus daemon. See http://www.freedesk‐
16 top.org/software/dbus/ for more information about the big picture. D-
17 Bus is first a library that provides one-to-one communication between
18 any two applications; dbus-daemon is an application that uses this
19 library to implement a message bus daemon. Multiple programs connect to
20 the message bus daemon and can exchange messages with one another.
21
22 There are two standard message bus instances: the systemwide message
23 bus (installed on many systems as the "messagebus" init service) and
24 the per-user-login-session message bus (started each time a user logs
25 in). dbus-daemon is used for both of these instances, but with a dif‐
26 ferent configuration file.
27
28 The --session option is equivalent to "--config-file=/etc/dbus-1/ses‐
29 sion.conf" and the --system option is equivalent to "--config-
30 file=/etc/dbus-1/system.conf". By creating additional configuration
31 files and using the --config-file option, additional special-purpose
32 message bus daemons could be created.
33
34 The systemwide daemon is normally launched by an init script, stan‐
35 dardly called simply "messagebus".
36
37 The systemwide daemon is largely used for broadcasting system events,
38 such as changes to the printer queue, or adding/removing devices.
39
40 The per-session daemon is used for various interprocess communication
41 among desktop applications (however, it is not tied to X or the GUI in
42 any way).
43
44 SIGHUP will cause the D-Bus daemon to PARTIALLY reload its configura‐
45 tion file and to flush its user/group information caches. Some configu‐
46 ration changes would require kicking all apps off the bus; so they will
47 only take effect if you restart the daemon. Policy changes should take
48 effect with SIGHUP.
49
50
52 The following options are supported:
53
54 --config-file=FILE
55 Use the given configuration file.
56
57 --fork Force the message bus to fork and become a daemon, even if the
58 configuration file does not specify that it should. In most
59 contexts the configuration file already gets this right, though.
60 --nofork Force the message bus not to fork and become a daemon,
61 even if the configuration file specifies that it should.
62
63 --print-address[=DESCRIPTOR]
64 Print the address of the message bus to standard output, or to
65 the given file descriptor. This is used by programs that launch
66 the message bus.
67
68 --print-pid[=DESCRIPTOR]
69 Print the process ID of the message bus to standard output, or
70 to the given file descriptor. This is used by programs that
71 launch the message bus.
72
73 --session
74 Use the standard configuration file for the per-login-session
75 message bus.
76
77 --system
78 Use the standard configuration file for the systemwide message
79 bus.
80
81 --version
82 Print the version of the daemon.
83
84 --introspect
85 Print the introspection information for all D-Bus internal
86 interfaces.
87
88 --address[=ADDRESS]
89 Set the address to listen on. This option overrides the address
90 configured in the configuration file.
91
92 --systemd-activation
93 Enable systemd-style service activation. Only useful in conjunc‐
94 tion with the systemd system and session manager on Linux.
95
96
98 A message bus daemon has a configuration file that specializes it for a
99 particular application. For example, one configuration file might set
100 up the message bus to be a systemwide message bus, while another might
101 set it up to be a per-user-login-session bus.
102
103 The configuration file also establishes resource limits, security
104 parameters, and so forth.
105
106 The configuration file is not part of any interoperability specifica‐
107 tion and its backward compatibility is not guaranteed; this document is
108 documentation, not specification.
109
110 The standard systemwide and per-session message bus setups are config‐
111 ured in the files "/etc/dbus-1/system.conf" and "/etc/dbus-1/ses‐
112 sion.conf". These files normally <include> a system-local.conf or ses‐
113 sion-local.conf; you can put local overrides in those files to avoid
114 modifying the primary configuration files.
115
116
117 The configuration file is an XML document. It must have the following
118 doctype declaration:
119
120 <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
121 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
122
123
124
125 The following elements may be present in the configuration file.
126
127
128 <busconfig>
129
130
131 Root element.
132
133
134 <type>
135
136
137 The well-known type of the message bus. Currently known values are
138 "system" and "session"; if other values are set, they should be either
139 added to the D-Bus specification, or namespaced. The last <type> ele‐
140 ment "wins" (previous values are ignored). This element only controls
141 which message bus specific environment variables are set in activated
142 clients. Most of the policy that distinguishes a session bus from the
143 system bus is controlled from the other elements in the configuration
144 file.
145
146
147 If the well-known type of the message bus is "session", then the
148 DBUS_STARTER_BUS_TYPE environment variable will be set to "session" and
149 the DBUS_SESSION_BUS_ADDRESS environment variable will be set to the
150 address of the session bus. Likewise, if the type of the message bus
151 is "system", then the DBUS_STARTER_BUS_TYPE environment variable will
152 be set to "system" and the DBUS_SESSION_BUS_ADDRESS environment vari‐
153 able will be set to the address of the system bus (which is normally
154 well known anyway).
155
156
157 Example: <type>session</type>
158
159
160 <include>
161
162
163 Include a file <include>filename.conf</include> at this point. If the
164 filename is relative, it is located relative to the configuration file
165 doing the including.
166
167
168 <include> has an optional attribute "ignore_missing=(yes|no)" which
169 defaults to "no" if not provided. This attribute controls whether it's
170 a fatal error for the included file to be absent.
171
172
173 <includedir>
174
175
176 Include all files in <includedir>foo.d</includedir> at this point.
177 Files in the directory are included in undefined order. Only files
178 ending in ".conf" are included.
179
180
181 This is intended to allow extension of the system bus by particular
182 packages. For example, if CUPS wants to be able to send out notifica‐
183 tion of printer queue changes, it could install a file to
184 /etc/dbus-1/system.d that allowed all apps to receive this message and
185 allowed the printer daemon user to send it.
186
187
188 <user>
189
190
191 The user account the daemon should run as, as either a username or a
192 UID. If the daemon cannot change to this UID on startup, it will exit.
193 If this element is not present, the daemon will not change or care
194 about its UID.
195
196
197 The last <user> entry in the file "wins", the others are ignored.
198
199
200 The user is changed after the bus has completed initialization. So
201 sockets etc. will be created before changing user, but no data will be
202 read from clients before changing user. This means that sockets and PID
203 files can be created in a location that requires root privileges for
204 writing.
205
206
207 <fork>
208
209
210 If present, the bus daemon becomes a real daemon (forks into the back‐
211 ground, etc.). This is generally used rather than the --fork command
212 line option.
213
214
215 <keep_umask>
216
217
218 If present, the bus daemon keeps its original umask when forking. This
219 may be useful to avoid affecting the behavior of child processes.
220
221
222 <listen>
223
224
225 Add an address that the bus should listen on. The address is in the
226 standard D-Bus format that contains a transport name plus possible
227 parameters/options.
228
229
230 Example: <listen>unix:path=/tmp/foo</listen>
231
232
233 Example: <listen>tcp:host=localhost,port=1234</listen>
234
235
236 If there are multiple <listen> elements, then the bus listens on multi‐
237 ple addresses. The bus will pass its address to started services or
238 other interested parties with the last address given in <listen> first.
239 That is, apps will try to connect to the last <listen> address first.
240
241
242 tcp sockets can accept IPv4 addresses, IPv6 addresses or hostnames. If
243 a hostname resolves to multiple addresses, the server will bind to all
244 of them. The family=ipv4 or family=ipv6 options can be used to force it
245 to bind to a subset of addresses
246
247
248 Example: <listen>tcp:host=localhost,port=0,family=ipv4</listen>
249
250
251 A special case is using a port number of zero (or omitting the port),
252 which means to choose an available port selected by the operating sys‐
253 tem. The port number chosen can be obtained with the --print-address
254 command line parameter and will be present in other cases where the
255 server reports its own address, such as when DBUS_SESSION_BUS_ADDRESS
256 is set.
257
258
259 Example: <listen>tcp:host=localhost,port=0</listen>
260
261
262 tcp addresses also allow a bind=hostname option, which will override
263 the host option specifying what address to bind to, without changing
264 the address reported by the bus. The bind option can also take a spe‐
265 cial name '*' to cause the bus to listen on all local address
266 (INADDR_ANY). The specified host should be a valid name of the local
267 machine or weird stuff will happen.
268
269
270 Example: <listen>tcp:host=localhost,bind=*,port=0</listen>
271
272
273 <auth>
274
275
276 Lists permitted authorization mechanisms. If this element doesn't
277 exist, then all known mechanisms are allowed. If there are multiple
278 <auth> elements, all the listed mechanisms are allowed. The order in
279 which mechanisms are listed is not meaningful.
280
281
282 Example: <auth>EXTERNAL</auth>
283
284
285 Example: <auth>DBUS_COOKIE_SHA1</auth>
286
287
288 <servicedir>
289
290
291 Adds a directory to scan for .service files. Directories are scanned
292 starting with the last to appear in the config file (the first .service
293 file found that provides a particular service will be used).
294
295
296 Service files tell the bus how to automatically start a program. They
297 are primarily used with the per-user-session bus, not the systemwide
298 bus.
299
300
301 <standard_session_servicedirs/>
302
303
304 <standard_session_servicedirs/> is equivalent to specifying a series of
305 <servicedir/> elements for each of the data directories in the "XDG
306 Base Directory Specification" with the subdirectory "dbus-1/services",
307 so for example "/usr/share/dbus-1/services" would be among the directo‐
308 ries searched.
309
310
311 The "XDG Base Directory Specification" can be found at http://freedesk‐
312 top.org/wiki/Standards/basedir-spec if it hasn't moved, otherwise try
313 your favorite search engine.
314
315
316 The <standard_session_servicedirs/> option is only relevant to the per-
317 user-session bus daemon defined in /etc/dbus-1/session.conf. Putting it
318 in any other configuration file would probably be nonsense.
319
320
321 <standard_system_servicedirs/>
322
323
324 <standard_system_servicedirs/> specifies the standard system-wide acti‐
325 vation directories that should be searched for service files. This
326 option defaults to /usr/share/dbus-1/system-services.
327
328
329 The <standard_system_servicedirs/> option is only relevant to the per-
330 system bus daemon defined in /etc/dbus-1/system.conf. Putting it in any
331 other configuration file would probably be nonsense.
332
333
334 <servicehelper/>
335
336
337 <servicehelper/> specifies the setuid helper that is used to launch
338 system daemons with an alternate user. Typically this should be the
339 dbus-daemon-launch-helper executable in located in libexec.
340
341
342 The <servicehelper/> option is only relevant to the per-system bus dae‐
343 mon defined in /etc/dbus-1/system.conf. Putting it in any other config‐
344 uration file would probably be nonsense.
345
346
347 <limit>
348
349
350 <limit> establishes a resource limit. For example:
351 <limit name="max_message_size">64</limit>
352 <limit name="max_completed_connections">512</limit>
353
354
355 The name attribute is mandatory. Available limit names are:
356 "max_incoming_bytes" : total size in bytes of messages
357 incoming from a single connection
358 "max_incoming_unix_fds" : total number of unix fds of messages
359 incoming from a single connection
360 "max_outgoing_bytes" : total size in bytes of messages
361 queued up for a single connection
362 "max_outgoing_unix_fds" : total number of unix fds of messages
363 queued up for a single connection
364 "max_message_size" : max size of a single message in
365 bytes
366 "max_message_unix_fds" : max unix fds of a single message
367 "service_start_timeout" : milliseconds (thousandths) until
368 a started service has to connect
369 "auth_timeout" : milliseconds (thousandths) a
370 connection is given to
371 authenticate
372 "max_completed_connections" : max number of authenticated connections
373 "max_incomplete_connections" : max number of unauthenticated
374 connections
375 "max_connections_per_user" : max number of completed connections from
376 the same user
377 "max_pending_service_starts" : max number of service launches in
378 progress at the same time
379 "max_names_per_connection" : max number of names a single
380 connection can own
381 "max_match_rules_per_connection": max number of match rules for a single
382 connection
383 "max_replies_per_connection" : max number of pending method
384 replies per connection
385 (number of calls-in-progress)
386 "reply_timeout" : milliseconds (thousandths)
387 until a method call times out
388
389
390 The max incoming/outgoing queue sizes allow a new message to be queued
391 if one byte remains below the max. So you can in fact exceed the max by
392 max_message_size.
393
394
395 max_completed_connections divided by max_connections_per_user is the
396 number of users that can work together to denial-of-service all other
397 users by using up all connections on the systemwide bus.
398
399
400 Limits are normally only of interest on the systemwide bus, not the
401 user session buses.
402
403
404 <policy>
405
406
407 The <policy> element defines a security policy to be applied to a par‐
408 ticular set of connections to the bus. A policy is made up of <allow>
409 and <deny> elements. Policies are normally used with the systemwide
410 bus; they are analogous to a firewall in that they allow expected traf‐
411 fic and prevent unexpected traffic.
412
413
414 Currently, the system bus has a default-deny policy for sending method
415 calls and owning bus names. Everything else, in particular reply mes‐
416 sages, receive checks, and signals has a default allow policy.
417
418
419 In general, it is best to keep system services as small, targeted pro‐
420 grams which run in their own process and provide a single bus name.
421 Then, all that is needed is an <allow> rule for the "own" permission to
422 let the process claim the bus name, and a "send_destination" rule to
423 allow traffic from some or all uids to your service.
424
425
426 The <policy> element has one of four attributes:
427 context="(default|mandatory)"
428 at_console="(true|false)"
429 user="username or userid"
430 group="group name or gid"
431
432
433 Policies are applied to a connection as follows:
434 - all context="default" policies are applied
435 - all group="connection's user's group" policies are applied
436 in undefined order
437 - all user="connection's auth user" policies are applied
438 in undefined order
439 - all at_console="true" policies are applied
440 - all at_console="false" policies are applied
441 - all context="mandatory" policies are applied
442
443
444 Policies applied later will override those applied earlier, when the
445 policies overlap. Multiple policies with the same user/group/context
446 are applied in the order they appear in the config file.
447
448
449 <deny> <allow>
450
451
452 A <deny> element appears below a <policy> element and prohibits some
453 action. The <allow> element makes an exception to previous <deny>
454 statements, and works just like <deny> but with the inverse meaning.
455
456
457 The possible attributes of these elements are:
458 send_interface="interface_name"
459 send_member="method_or_signal_name"
460 send_error="error_name"
461 send_destination="name"
462 send_type="method_call" | "method_return" | "signal" | "error"
463 send_path="/path/name"
464
465 receive_interface="interface_name"
466 receive_member="method_or_signal_name"
467 receive_error="error_name"
468 receive_sender="name"
469 receive_type="method_call" | "method_return" | "signal" | "error"
470 receive_path="/path/name"
471
472 send_requested_reply="true" | "false"
473 receive_requested_reply="true" | "false"
474
475 eavesdrop="true" | "false"
476
477 own="name"
478 user="username"
479 group="groupname"
480
481
482 Examples:
483 <deny send_destination="org.freedesktop.Service" send_interface="org.freedesktop.System" send_member="Reboot"/>
484 <deny send_destination="org.freedesktop.System"/>
485 <deny receive_sender="org.freedesktop.System"/>
486 <deny user="john"/>
487 <deny group="enemies"/>
488
489
490 The <deny> element's attributes determine whether the deny "matches" a
491 particular action. If it matches, the action is denied (unless later
492 rules in the config file allow it).
493
494 send_destination and receive_sender rules mean that messages may not be
495 sent to or received from the *owner* of the given name, not that they
496 may not be sent *to that name*. That is, if a connection owns services
497 A, B, C, and sending to A is denied, sending to B or C will not work
498 either.
499
500 The other send_* and receive_* attributes are purely textual/by-value
501 matches against the given field in the message header.
502
503 "Eavesdropping" occurs when an application receives a message that was
504 explicitly addressed to a name the application does not own, or is a
505 reply to such a message. Eavesdropping thus only applies to messages
506 that are addressed to services and replies to such messages (i.e. it
507 does not apply to signals).
508
509 For <allow>, eavesdrop="true" indicates that the rule matches even when
510 eavesdropping. eavesdrop="false" is the default and means that the rule
511 only allows messages to go to their specified recipient. For <deny>,
512 eavesdrop="true" indicates that the rule matches only when eavesdrop‐
513 ping. eavesdrop="false" is the default for <deny> also, but here it
514 means that the rule applies always, even when not eavesdropping. The
515 eavesdrop attribute can only be combined with send and receive rules
516 (with send_* and receive_* attributes).
517
518 The [send|receive]_requested_reply attribute works similarly to the
519 eavesdrop attribute. It controls whether the <deny> or <allow> matches
520 a reply that is expected (corresponds to a previous method call mes‐
521 sage). This attribute only makes sense for reply messages (errors and
522 method returns), and is ignored for other message types.
523
524
525 For <allow>, [send|receive]_requested_reply="true" is the default and
526 indicates that only requested replies are allowed by the rule.
527 [send|receive]_requested_reply="false" means that the rule allows any
528 reply even if unexpected.
529
530
531 For <deny>, [send|receive]_requested_reply="false" is the default but
532 indicates that the rule matches only when the reply was not requested.
533 [send|receive]_requested_reply="true" indicates that the rule applies
534 always, regardless of pending reply state.
535
536
537 user and group denials mean that the given user or group may not con‐
538 nect to the message bus.
539
540
541 For "name", "username", "groupname", etc. the character "*" can be
542 substituted, meaning "any." Complex globs like "foo.bar.*" aren't
543 allowed for now because they'd be work to implement and maybe encourage
544 sloppy security anyway.
545
546
547 It does not make sense to deny a user or group inside a <policy> for a
548 user or group; user/group denials can only be inside context="default"
549 or context="mandatory" policies.
550
551
552 A single <deny> rule may specify combinations of attributes such as
553 send_destination and send_interface and send_type. In this case, the
554 denial applies only if both attributes match the message being denied.
555 e.g. <deny send_interface="foo.bar" send_destination="foo.blah"/> would
556 deny messages with the given interface AND the given bus name. To get
557 an OR effect you specify multiple <deny> rules.
558
559
560 You can't include both send_ and receive_ attributes on the same rule,
561 since "whether the message can be sent" and "whether it can be
562 received" are evaluated separately.
563
564
565 Be careful with send_interface/receive_interface, because the interface
566 field in messages is optional. In particular, do NOT specify <deny
567 send_interface="org.foo.Bar"/>! This will cause no-interface messages
568 to be blocked for all services, which is almost certainly not what you
569 intended. Always use rules of the form: <deny send_inter‐
570 face="org.foo.Bar" send_destination="org.foo.Service"/>
571
572
573 <selinux>
574
575
576 The <selinux> element contains settings related to Security Enhanced
577 Linux. More details below.
578
579
580 <associate>
581
582
583 An <associate> element appears below an <selinux> element and creates a
584 mapping. Right now only one kind of association is possible:
585 <associate own="org.freedesktop.Foobar" context="foo_t"/>
586
587
588 This means that if a connection asks to own the name "org.freedesk‐
589 top.Foobar" then the source context will be the context of the connec‐
590 tion and the target context will be "foo_t" - see the short discussion
591 of SELinux below.
592
593
594 Note, the context here is the target context when requesting a name,
595 NOT the context of the connection owning the name.
596
597
598 There's currently no way to set a default for owning any name, if we
599 add this syntax it will look like:
600 <associate own="*" context="foo_t"/>
601 If you find a reason this is useful, let the developers know. Right
602 now the default will be the security context of the bus itself.
603
604
605 If two <associate> elements specify the same name, the element appear‐
606 ing later in the configuration file will be used.
607
608
610 See http://www.nsa.gov/selinux/ for full details on SELinux. Some use‐
611 ful excerpts:
612
613
614 Every subject (process) and object (e.g. file, socket, IPC
615 object, etc) in the system is assigned a collection of security
616 attributes, known as a security context. A security context
617 contains all of the security attributes associated with a par‐
618 ticular subject or object that are relevant to the security
619 policy.
620
621
622 In order to better encapsulate security contexts and to provide
623 greater efficiency, the policy enforcement code of SELinux typ‐
624 ically handles security identifiers (SIDs) rather than security
625 contexts. A SID is an integer that is mapped by the security
626 server to a security context at runtime.
627
628
629 When a security decision is required, the policy enforcement
630 code passes a pair of SIDs (typically the SID of a subject and
631 the SID of an object, but sometimes a pair of subject SIDs or a
632 pair of object SIDs), and an object security class to the secu‐
633 rity server. The object security class indicates the kind of
634 object, e.g. a process, a regular file, a directory, a TCP
635 socket, etc.
636
637
638 Access decisions specify whether or not a permission is granted
639 for a given pair of SIDs and class. Each object class has a set
640 of associated permissions defined to control operations on
641 objects with that class.
642
643
644 D-Bus performs SELinux security checks in two places.
645
646
647 First, any time a message is routed from one connection to another con‐
648 nection, the bus daemon will check permissions with the security con‐
649 text of the first connection as source, security context of the second
650 connection as target, object class "dbus" and requested permission
651 "send_msg".
652
653
654 If a security context is not available for a connection (impossible
655 when using UNIX domain sockets), then the target context used is the
656 context of the bus daemon itself. There is currently no way to change
657 this default, because we're assuming that only UNIX domain sockets will
658 be used to connect to the systemwide bus. If this changes, we'll proba‐
659 bly add a way to set the default connection context.
660
661
662 Second, any time a connection asks to own a name, the bus daemon will
663 check permissions with the security context of the connection as
664 source, the security context specified for the name in the config file
665 as target, object class "dbus" and requested permission "acquire_svc".
666
667
668 The security context for a bus name is specified with the <associate>
669 element described earlier in this document. If a name has no security
670 context associated in the configuration file, the security context of
671 the bus daemon itself will be used.
672
673
675 If you're trying to figure out where your messages are going or why you
676 aren't getting messages, there are several things you can try.
677
678 Remember that the system bus is heavily locked down and if you haven't
679 installed a security policy file to allow your message through, it
680 won't work. For the session bus, this is not a concern.
681
682 The simplest way to figure out what's happening on the bus is to run
683 the dbus-monitor program, which comes with the D-Bus package. You can
684 also send test messages with dbus-send. These programs have their own
685 man pages.
686
687 If you want to know what the daemon itself is doing, you might consider
688 running a separate copy of the daemon to test against. This will allow
689 you to put the daemon under a debugger, or run it with verbose output,
690 without messing up your real session and system daemons.
691
692 To run a separate test copy of the daemon, for example you might open a
693 terminal and type:
694 DBUS_VERBOSE=1 dbus-daemon --session --print-address
695
696 The test daemon address will be printed when the daemon starts. You
697 will need to copy-and-paste this address and use it as the value of the
698 DBUS_SESSION_BUS_ADDRESS environment variable when you launch the
699 applications you want to test. This will cause those applications to
700 connect to your test bus instead of the DBUS_SESSION_BUS_ADDRESS of
701 your real session bus.
702
703 DBUS_VERBOSE=1 will have NO EFFECT unless your copy of D-Bus was com‐
704 piled with verbose mode enabled. This is not recommended in production
705 builds due to performance impact. You may need to rebuild D-Bus if your
706 copy was not built with debugging in mind. (DBUS_VERBOSE also affects
707 the D-Bus library and thus applications using D-Bus; it may be useful
708 to see verbose output on both the client side and from the daemon.)
709
710 If you want to get fancy, you can create a custom bus configuration for
711 your test bus (see the session.conf and system.conf files that define
712 the two default configurations for example). This would allow you to
713 specify a different directory for .service files, for example.
714
715
717 See http://www.freedesktop.org/software/dbus/doc/AUTHORS
718
719
721 Please send bug reports to the D-Bus mailing list or bug tracker, see
722 http://www.freedesktop.org/software/dbus/
723
724
725
726 dbus-daemon(1)