1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4 <refentry id='dbusdaemon1'>
6 <!-- dbus\-daemon manual page.
7 Copyright (C) 2003,2008 Red Hat, Inc. -->
10 <refentrytitle>dbus-daemon</refentrytitle>
11 <manvolnum>1</manvolnum>
12 <refmiscinfo class="manual">User Commands</refmiscinfo>
13 <refmiscinfo class="source">D-Bus</refmiscinfo>
14 <refmiscinfo class="version">@DBUS_VERSION@</refmiscinfo>
17 <refname>dbus-daemon</refname>
18 <refpurpose>Message bus daemon</refpurpose>
20 <!-- body begins here -->
21 <refsynopsisdiv id='synopsis'>
23 <command>dbus-daemon</command></cmdsynopsis>
25 <command>dbus-daemon</command> <arg choice='opt'>--version </arg>
26 <arg choice='opt'>--session </arg>
27 <arg choice='opt'>--system </arg>
28 <arg choice='opt'>--config-file=<replaceable>FILE</replaceable></arg>
29 <arg choice='opt'><arg choice='plain'>--print-address </arg><arg choice='opt'><replaceable>=DESCRIPTOR</replaceable></arg></arg>
30 <arg choice='opt'><arg choice='plain'>--print-pid </arg><arg choice='opt'><replaceable>=DESCRIPTOR</replaceable></arg></arg>
31 <arg choice='opt'>--fork </arg>
32 <arg choice='opt'>--nosyslog </arg>
33 <arg choice='opt'>--syslog </arg>
34 <arg choice='opt'>--syslog-only </arg>
40 <refsect1 id='description'><title>DESCRIPTION</title>
41 <para><command>dbus-daemon</command> is the D-Bus message bus daemon. See
42 <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink> for more information about
43 the big picture. D-Bus is first a library that provides one-to-one
44 communication between any two applications; <command>dbus-daemon</command> is an
45 application that uses this library to implement a message bus
46 daemon. Multiple programs connect to the message bus daemon and can
47 exchange messages with one another.</para>
49 <para>There are two standard message bus instances: the systemwide message bus
50 (installed on many systems as the "messagebus" init service) and the
51 per-user-login-session message bus (started each time a user logs in).
52 <command>dbus-daemon</command> is used for both of these instances, but with
53 a different configuration file.</para>
55 <para>The --session option is equivalent to
56 "--config-file=@EXPANDED_DATADIR@/dbus-1/session.conf" and the --system
57 option is equivalent to
58 "--config-file=@EXPANDED_DATADIR@/dbus-1/system.conf". By creating
59 additional configuration files and using the --config-file option,
60 additional special-purpose message bus daemons could be created.</para>
62 <para>The systemwide daemon is normally launched by an init script,
63 standardly called simply "messagebus".</para>
65 <para>The systemwide daemon is largely used for broadcasting system events,
66 such as changes to the printer queue, or adding/removing devices.</para>
68 <para>The per-session daemon is used for various interprocess communication
69 among desktop applications (however, it is not tied to X or the GUI
72 <para>SIGHUP will cause the D-Bus daemon to PARTIALLY reload its
73 configuration file and to flush its user/group information caches. Some
74 configuration changes would require kicking all apps off the bus; so they will
75 only take effect if you restart the daemon. Policy changes should take effect
80 <refsect1 id='options'><title>OPTIONS</title>
81 <para>The following options are supported:</para>
82 <variablelist remap='TP'>
84 <term><option>--config-file=FILE</option></term>
86 <para>Use the given configuration file.</para>
90 <term><option>--fork</option></term>
92 <para>Force the message bus to fork and become a daemon, even if
93 the configuration file does not specify that it should.
94 In most contexts the configuration file already gets this
95 right, though. This option is not supported on Windows.</para>
99 <term><option>--nofork</option></term>
101 <para>Force the message bus not to fork and become a daemon, even if
102 the configuration file specifies that it should. On Windows,
103 the dbus-daemon never forks, so this option is allowed but does
108 <term><option>--print-address[=DESCRIPTOR]</option></term>
110 <para>Print the address of the message bus to standard output, or
111 to the given file descriptor. This is used by programs that
112 launch the message bus.</para>
116 <term><option>--print-pid[=DESCRIPTOR]</option></term>
118 <para>Print the process ID of the message bus to standard output, or
119 to the given file descriptor. This is used by programs that
120 launch the message bus.</para>
124 <term><option>--session</option></term>
126 <para>Use the standard configuration file for the per-login-session message
131 <term><option>--system</option></term>
133 <para>Use the standard configuration file for the systemwide message bus.</para>
137 <term><option>--version</option></term>
139 <para>Print the version of the daemon.</para>
143 <term><option>--introspect</option></term>
145 <para>Print the introspection information for all D-Bus internal interfaces.</para>
149 <term><option>--address[=ADDRESS]</option></term>
151 <para>Set the address to listen on. This option overrides the address
152 configured in the configuration file via the
153 <literal><listen></literal> directive.
154 See the documentation of that directive for more details.</para>
158 <term><option>--systemd-activation</option></term>
160 <para>Enable systemd-style service activation. Only useful in conjunction
161 with the systemd system and session manager on Linux.</para>
165 <term><option>--nopidfile</option></term>
167 <para>Don't write a PID file even if one is configured in the configuration
174 <term><option>--syslog</option></term>
176 <para>Force the message bus to use the system log for messages,
177 in addition to writing to standard error, even if the configuration
178 file does not specify that it should. On Unix, this uses
179 the syslog; on Windows, this uses OutputDebugString().</para>
184 <term><option>--syslog-only</option></term>
186 <para>Force the message bus to use the system log for messages,
187 and <emphasis>not</emphasis> duplicate them to standard error.
188 On Unix, this uses the syslog; on Windows, this uses
189 OutputDebugString().</para>
194 <term><option>--nosyslog</option></term>
196 <para>Force the message bus to use only standard error for messages,
197 even if the configuration file specifies that it should use
198 the system log.</para>
205 <refsect1 id='configuration_file'><title>CONFIGURATION FILE</title>
206 <para>A message bus daemon has a configuration file that specializes it
207 for a particular application. For example, one configuration
208 file might set up the message bus to be a systemwide message bus,
209 while another might set it up to be a per-user-login-session bus.</para>
211 <para>The configuration file also establishes resource limits, security
212 parameters, and so forth.</para>
214 <para>The configuration file is not part of any interoperability
215 specification and its backward compatibility is not guaranteed; this
216 document is documentation, not specification.</para>
218 <para>The standard systemwide and per-session message bus setups are
219 configured in the files "@EXPANDED_DATADIR@/dbus-1/system.conf" and
220 "@EXPANDED_DATADIR@/dbus-1/session.conf". These files normally
221 <include> a system-local.conf or session-local.conf in
222 @EXPANDED_SYSCONFDIR@/dbus-1; you can put local
223 overrides in those files to avoid modifying the primary configuration
227 <para>The configuration file is an XML document. It must have the following
228 doctype declaration:</para>
229 <literallayout remap='.nf'>
231 <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
232 "<ulink url='http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd'>http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd</ulink>">
234 </literallayout> <!-- .fi -->
237 <para>The following elements may be present in the configuration file.</para>
239 <itemizedlist remap='TP'>
241 <listitem><para><emphasis remap='I'><busconfig></emphasis></para></listitem>
246 <para>Root element.</para>
248 <itemizedlist remap='TP'>
250 <listitem><para><emphasis remap='I'><type></emphasis></para></listitem>
255 <para>The well-known type of the message bus. Currently known values are
256 "system" and "session"; if other values are set, they should be
257 either added to the D-Bus specification, or namespaced. The last
258 <type> element "wins" (previous values are ignored). This element
259 only controls which message bus specific environment variables are
260 set in activated clients. Most of the policy that distinguishes a
261 session bus from the system bus is controlled from the other elements
262 in the configuration file.</para>
265 <para>If the well-known type of the message bus is "session", then the
266 DBUS_STARTER_BUS_TYPE environment variable will be set to "session"
267 and the DBUS_SESSION_BUS_ADDRESS environment variable will be set
268 to the address of the session bus. Likewise, if the type of the
269 message bus is "system", then the DBUS_STARTER_BUS_TYPE environment
270 variable will be set to "system" and the DBUS_SYSTEM_BUS_ADDRESS
271 environment variable will be set to the address of the system bus
272 (which is normally well known anyway).</para>
275 <para>Example: <type>session</type></para>
277 <itemizedlist remap='TP'>
279 <listitem><para><emphasis remap='I'><include></emphasis></para></listitem>
284 <para>Include a file <include>filename.conf</include> at this point. If the
285 filename is relative, it is located relative to the configuration file
286 doing the including.</para>
289 <para><include> has an optional attribute "ignore_missing=(yes|no)"
290 which defaults to "no" if not provided. This attribute
291 controls whether it's a fatal error for the included file
294 <itemizedlist remap='TP'>
296 <listitem><para><emphasis remap='I'><includedir></emphasis></para></listitem>
301 <para>Include all files in <includedir>foo.d</includedir> at this
302 point. Files in the directory are included in undefined order.
303 Only files ending in ".conf" are included.</para>
306 <para>This is intended to allow extension of the system bus by particular
307 packages. For example, if CUPS wants to be able to send out
308 notification of printer queue changes, it could install a file to
309 @EXPANDED_DATADIR@/dbus-1/system.d or
310 @EXPANDED_SYSCONFDIR@/dbus-1/system.d that allowed all apps to receive
311 this message and allowed the printer daemon user to send it.</para>
313 <itemizedlist remap='TP'>
315 <listitem><para><emphasis remap='I'><user></emphasis></para></listitem>
320 <para>The user account the daemon should run as, as either a username or a
321 UID. If the daemon cannot change to this UID on startup, it will exit.
322 If this element is not present, the daemon will not change or care
323 about its UID.</para>
326 <para>The last <user> entry in the file "wins", the others are ignored.</para>
329 <para>The user is changed after the bus has completed initialization. So
330 sockets etc. will be created before changing user, but no data will be
331 read from clients before changing user. This means that sockets
332 and PID files can be created in a location that requires root
333 privileges for writing.</para>
335 <itemizedlist remap='TP'>
337 <listitem><para><emphasis remap='I'><fork></emphasis></para></listitem>
342 <para>If present, the bus daemon becomes a real daemon (forks
343 into the background, etc.). This is generally used
344 rather than the --fork command line option.</para>
346 <itemizedlist remap='TP'>
348 <listitem><para><emphasis remap='I'><keep_umask></emphasis></para></listitem>
353 <para>If present, the bus daemon keeps its original umask when forking.
354 This may be useful to avoid affecting the behavior of child processes.</para>
356 <itemizedlist remap='TP'>
358 <listitem><para><emphasis remap='I'><syslog></emphasis></para></listitem>
363 <para>If present, the bus daemon will log to syslog. The
364 --syslog, --syslog-only and --nosyslog command-line options take precedence
365 over this setting.</para>
367 <itemizedlist remap='TP'>
369 <listitem><para><emphasis remap='I'><pidfile></emphasis></para></listitem>
374 <para>If present, the bus daemon will write its pid to the specified file.
375 The --nopidfile command-line option takes precedence over this setting.</para>
377 <itemizedlist remap='TP'>
379 <listitem><para><emphasis remap='I'><allow_anonymous></emphasis></para></listitem>
384 <para>If present, connections that authenticated using the ANONYMOUS
385 mechanism will be authorized to connect. This option has no practical
386 effect unless the ANONYMOUS mechanism has also been enabled using the
387 <emphasis remap='I'><auth></emphasis> element, described below.</para>
389 <para>Using this directive in the configuration of the well-known
390 system bus or the well-known session bus will make that bus insecure
391 and should never be done. Similarly, on custom bus types, using this
392 directive will usually make the custom bus insecure, unless its
393 configuration has been specifically designed to prevent anonymous
394 users from causing damage or escalating privileges.</para>
396 <itemizedlist remap='TP'>
398 <listitem><para><emphasis remap='I'><listen></emphasis></para></listitem>
403 <para>Add an address that the bus should listen on. The
404 address is in the standard D-Bus format that contains
405 a transport name plus possible parameters/options.</para>
407 <para>On platforms other than Windows, <literal>unix</literal>-based
408 transports (<literal>unix</literal>, <literal>systemd</literal>,
409 <literal>launchd</literal>) are the default for both the well-known
410 system bus and the well-known session bus, and are strongly
414 On Windows, <literal>unix</literal>-based transports are not available,
415 so TCP-based transports must be used.
416 Similar to remote X11, the <literal>tcp</literal> and
417 <literal>nonce-tcp</literal> transports have no integrity or
418 confidentiality protection, so they should normally only be
419 used across the local loopback interface, for example using an
420 address like <literal>tcp:host=127.0.0.1</literal> or
421 <literal>nonce-tcp:host=localhost</literal>. In particular,
422 configuring the well-known system bus or the well-known session
423 bus to listen on a non-loopback TCP address is insecure.
426 Developers are sometimes tempted to use remote TCP as a debugging
427 tool. However, if this functionality is left enabled in finished
428 products, the result will be dangerously insecure. Instead of
429 using remote TCP, developers should <ulink
430 url="https://lists.freedesktop.org/archives/dbus/2018-April/017447.html"
431 >relay connections via Secure Shell or a similar protocol</ulink>.
432 <!-- TODO: Ideally someone would write a more formal guide to
433 remote D-Bus debugging, and we could link to that instead -->
436 Remote TCP connections were historically sometimes used to share
437 a single session bus between login sessions of the same user on
438 different machines within a trusted local area network, in
439 conjunction with unencrypted remote X11, a NFS-shared home
440 directory and NIS (YP) authentication. This is insecure against
441 an attacker on the same LAN and should be considered strongly
442 deprecated; more specifically, it is insecure in the same ways
443 and for the same reasons as unencrypted remote X11 and NFSv2/NFSv3.
444 The D-Bus maintainers
445 recommend using a separate session bus per (user, machine) pair,
446 only accessible from within that machine.
449 <para>Example: <listen>unix:path=/tmp/foo</listen></para>
452 <para>Example: <listen>tcp:host=localhost,port=1234</listen></para>
455 <para>If there are multiple <listen> elements, then the bus listens
456 on multiple addresses. The bus will pass its address to
457 started services or other interested parties with
458 the last address given in <listen> first. That is,
459 apps will try to connect to the last <listen> address first.</para>
462 <para>tcp sockets can accept IPv4 addresses, IPv6 addresses or hostnames.
463 If a hostname resolves to multiple addresses, the server will bind
464 to all of them. The family=ipv4 or family=ipv6 options can be used
465 to force it to bind to a subset of addresses</para>
468 <para>Example: <listen>tcp:host=localhost,port=0,family=ipv4</listen></para>
471 <para>A special case is using a port number of zero (or omitting the port),
472 which means to choose an available port selected by the operating
473 system. The port number chosen can be obtained with the
474 --print-address command line parameter and will be present in other
475 cases where the server reports its own address, such as when
476 DBUS_SESSION_BUS_ADDRESS is set.</para>
479 <para>Example: <listen>tcp:host=localhost,port=0</listen></para>
482 <para>tcp/nonce-tcp addresses also allow a bind=hostname option,
483 used in a listenable address to configure the interface on which
484 the server will listen: either the hostname is the IP address of
485 one of the local machine's interfaces (most commonly 127.0.0.1),
486 a DNS name that resolves to one of those IP addresses, '0.0.0.0'
487 to listen on all IPv4 interfaces simultaneously, or '::'
488 to listen on all IPv4 and IPv6 interfaces simultaneously (if supported
489 by the OS). If not specified,
490 the default is the same value as "host".</para>
493 <para>Example: <listen>tcp:host=localhost,bind=0.0.0.0,port=0</listen></para>
495 <itemizedlist remap='TP'>
497 <listitem><para><emphasis remap='I'><auth></emphasis></para></listitem>
502 <para>Lists permitted authorization mechanisms. If this element doesn't
503 exist, then all known mechanisms are allowed. If there are multiple
504 <auth> elements, all the listed mechanisms are allowed. The order in
505 which mechanisms are listed is not meaningful.</para>
507 <para>On non-Windows operating systems, allowing only the
508 <literal>EXTERNAL</literal> authentication
509 mechanism is strongly recommended. This is the default for the
510 well-known system bus and for the well-known session bus.</para>
512 <para>Example: <auth>EXTERNAL</auth></para>
515 <para>Example: <auth>DBUS_COOKIE_SHA1</auth></para>
517 <itemizedlist remap='TP'>
519 <listitem><para><emphasis remap='I'><servicedir></emphasis></para></listitem>
525 Adds a directory to search for .service files, which tell the
526 dbus-daemon how to start a program to provide a particular well-known
527 bus name. See the D-Bus Specification for more details about the
528 contents of .service files.
532 If a particular service is found in more than one <servicedir>,
533 the first directory listed in the configuration file takes precedence.
534 If two service files providing the same well-known bus name are found
535 in the same directory, it is arbitrary which one will be chosen
536 (this can only happen if at least one of the service files does not
537 have the recommended name, which is its well-known bus name followed
541 <itemizedlist remap='TP'>
543 <listitem><para><emphasis remap='I'><standard_session_servicedirs/></emphasis></para></listitem>
549 <standard_session_servicedirs/> requests a standard set of
550 session service directories. Its effect is similar to specifying a series
551 of <servicedir/> elements for each of the data directories,
552 in the order given here.
553 It is not exactly equivalent, because there is currently no way
554 to disable directory monitoring or enforce strict service file naming
555 for a <servicedir/>.
559 As with <servicedir/> elements, if a particular service is found
560 in more than one service directory, the first directory takes precedence.
561 If two service files providing the same well-known bus name are found
562 in the same directory, it is arbitrary which one will be chosen
563 (this can only happen if at least one of the service files does not
564 have the recommended name, which is its well-known bus name followed
569 On Unix, the standard session service directories are:
573 <emphasis>$XDG_RUNTIME_DIR</emphasis>/dbus-1/services,
574 if XDG_RUNTIME_DIR is set (see the XDG Base Directory
575 Specification for details of XDG_RUNTIME_DIR):
576 this location is suitable for transient services created at runtime
577 by systemd generators (see
579 <refentrytitle>systemd.generator</refentrytitle>
580 <manvolnum>7</manvolnum>
582 session managers or other session infrastructure.
583 It is an extension provided by the reference implementation
584 of dbus-daemon, and is not standardized in the D-Bus Specification.
587 Unlike the other standard session service directories, this directory
588 enforces strict naming for the service files: the filename must be
589 exactly the well-known bus name of the service, followed by
593 Also unlike the other standard session service directories, this
594 directory is never monitored with
596 <refentrytitle>inotify</refentrytitle>
597 <manvolnum>7</manvolnum>
599 or similar APIs. Programs that create service files in this directory
600 while a dbus-daemon is running are expected to call the dbus-daemon's
601 ReloadConfig() method after they have made changes.
606 <emphasis>$XDG_DATA_HOME</emphasis>/dbus-1/services,
607 where XDG_DATA_HOME defaults to ~/.local/share
608 (see the XDG Base Directory Specification): this location is
609 specified by the D-Bus Specification, and is suitable for per-user,
610 locally-installed software.
615 <emphasis>directory</emphasis>/dbus-1/services for each
616 directory in XDG_DATA_DIRS, where XDG_DATA_DIRS defaults to
617 /usr/local/share:/usr/share
618 (see the XDG Base Directory Specification): these locations are
619 specified by the D-Bus Specification. The defaults are suitable
620 for software installed locally by a system administrator
621 (/usr/local/share) or for software installed from operating system
622 packages (/usr/share). Per-user or system-wide configuration that
623 sets the XDG_DATA_DIRS environment variable can extend this search
624 path to cover installations in other locations, for example
625 ~/.local/share/flatpak/exports/share/ and
626 /var/lib/flatpak/exports/share/ when
628 <refentrytitle>flatpak</refentrytitle>
629 <manvolnum>1</manvolnum>
636 <emphasis>${datadir}</emphasis>/dbus-1/services
637 for the <emphasis>${datadir}</emphasis> that was specified when
638 dbus was compiled, typically /usr/share: this location is an
639 extension provided by the reference dbus-daemon implementation,
640 and is suitable for software stacks installed alongside dbus-daemon.
646 <para>The "XDG Base Directory Specification" can be found at
647 <ulink url='http://freedesktop.org/wiki/Standards/basedir-spec'>http://freedesktop.org/wiki/Standards/basedir-spec</ulink> if it hasn't moved,
648 otherwise try your favorite search engine.</para>
651 On Windows, the standard session service directories are:
655 <emphasis>%CommonProgramFiles%</emphasis>/dbus-1/services
656 if %CommonProgramFiles% is set: this location is suitable for
657 system-wide installed software packages
662 A share/dbus-1/services directory found in the same
663 directory hierarchy (prefix) as the dbus-daemon: this location
664 is suitable for software stacks installed alongside dbus-daemon
671 <para>The <standard_session_servicedirs/> option is only relevant to the
672 per-user-session bus daemon defined in
673 @EXPANDED_SYSCONFDIR@/dbus-1/session.conf. Putting it in any other
674 configuration file would probably be nonsense.</para>
676 <itemizedlist remap='TP'>
678 <listitem><para><emphasis remap='I'><standard_system_servicedirs/></emphasis></para></listitem>
683 <para><standard_system_servicedirs/> specifies the standard system-wide
684 activation directories that should be searched for service files.
685 As with session services, the first directory listed has highest
689 On Unix, the standard session service directories are:
693 /usr/local/share/dbus-1/system-services: this location is
694 specified by the D-Bus Specification, and is suitable for
695 software installed locally by the system administrator
700 /usr/share/dbus-1/system-services: this location is
701 specified by the D-Bus Specification, and is suitable for
702 software installed by operating system packages
707 <emphasis>${datadir}</emphasis>/dbus-1/system-services
708 for the <emphasis>${datadir}</emphasis> that was specified when
709 dbus was compiled, typically /usr/share: this location is an
710 extension provided by the reference dbus-daemon implementation,
711 and is suitable for software stacks installed alongside dbus-daemon
716 /lib/dbus-1/system-services: this location is
717 specified by the D-Bus Specification, and was intended for
718 software installed by operating system packages and used during
719 early boot (but it should be considered deprecated, because
720 the reference dbus-daemon is not designed to be available during
728 On Windows, there is no standard system bus, so there are no standard
729 system bus directories either.
732 <para>The <standard_system_servicedirs/> option is only relevant to the
733 per-system bus daemon defined in
734 @EXPANDED_DATADIR@/dbus-1/system.conf. Putting it in any other
735 configuration file would probably be nonsense.</para>
737 <itemizedlist remap='TP'>
739 <listitem><para><emphasis remap='I'><servicehelper/></emphasis></para></listitem>
744 <para><servicehelper/> specifies the setuid helper that is used to launch
745 system daemons with an alternate user. Typically this should be
746 the dbus-daemon-launch-helper executable in located in libexec.</para>
749 <para>The <servicehelper/> option is only relevant to the per-system bus daemon
750 defined in @EXPANDED_DATADIR@/dbus-1/system.conf. Putting it in any other
751 configuration file would probably be nonsense.</para>
753 <itemizedlist remap='TP'>
755 <listitem><para><emphasis remap='I'><limit></emphasis></para></listitem>
760 <para><limit> establishes a resource limit. For example:</para>
761 <literallayout remap='.nf'>
762 <limit name="max_message_size">64</limit>
763 <limit name="max_completed_connections">512</limit>
764 </literallayout> <!-- .fi -->
767 <para>The name attribute is mandatory.
768 Available limit names are:</para>
769 <literallayout remap='.nf'>
770 "max_incoming_bytes" : total size in bytes of messages
771 incoming from a single connection
772 "max_incoming_unix_fds" : total number of unix fds of messages
773 incoming from a single connection
774 "max_outgoing_bytes" : total size in bytes of messages
775 queued up for a single connection
776 "max_outgoing_unix_fds" : total number of unix fds of messages
777 queued up for a single connection
778 "max_message_size" : max size of a single message in
780 "max_message_unix_fds" : max unix fds of a single message
781 "service_start_timeout" : milliseconds (thousandths) until
782 a started service has to connect
783 "auth_timeout" : milliseconds (thousandths) a
784 connection is given to
786 "pending_fd_timeout" : milliseconds (thousandths) a
787 fd is given to be transmitted to
788 dbus-daemon before disconnecting the
790 "max_completed_connections" : max number of authenticated connections
791 "max_incomplete_connections" : max number of unauthenticated
793 "max_connections_per_user" : max number of completed connections from
795 "max_pending_service_starts" : max number of service launches in
796 progress at the same time
797 "max_names_per_connection" : max number of names a single
799 "max_match_rules_per_connection": max number of match rules for a single
801 "max_replies_per_connection" : max number of pending method
802 replies per connection
803 (number of calls-in-progress)
804 "reply_timeout" : milliseconds (thousandths)
805 until a method call times out
806 </literallayout> <!-- .fi -->
809 <para>The max incoming/outgoing queue sizes allow a new message to be queued
810 if one byte remains below the max. So you can in fact exceed the max
811 by max_message_size.</para>
814 <para>max_completed_connections divided by max_connections_per_user is the
815 number of users that can work together to denial-of-service all other users by using
816 up all connections on the systemwide bus.</para>
819 <para>Limits are normally only of interest on the systemwide bus, not the user session
822 <itemizedlist remap='TP'>
824 <listitem><para><emphasis remap='I'><policy></emphasis></para></listitem>
829 <para>The <policy> element defines a security policy to be applied to a particular
830 set of connections to the bus. A policy is made up of
831 <allow> and <deny> elements. Policies are normally used with the systemwide bus;
832 they are analogous to a firewall in that they allow expected traffic
833 and prevent unexpected traffic.</para>
837 Currently, the system bus has a default-deny policy for sending method calls
838 and owning bus names, and a default-allow policy for receiving messages,
839 sending signals, and sending a single success or error reply for each
840 method call that does not have the <literal>NO_REPLY</literal> flag.
841 Sending more than the expected number of replies is not allowed.
845 <para>In general, it is best to keep system services as small, targeted programs which
846 run in their own process and provide a single bus name. Then, all that is needed
847 is an <allow> rule for the "own" permission to let the process claim the bus
848 name, and a "send_destination" rule to allow traffic from some or all uids to
852 <para>The <policy> element has one of four attributes:</para>
853 <literallayout remap='.nf'>
854 context="(default|mandatory)"
855 at_console="(true|false)"
856 user="username or userid"
857 group="group name or gid"
858 </literallayout> <!-- .fi -->
861 <para>Policies are applied to a connection as follows:</para>
862 <literallayout remap='.nf'>
863 - all context="default" policies are applied
864 - all group="connection's user's group" policies are applied
866 - all user="connection's auth user" policies are applied
868 - all at_console="true" policies are applied
869 - all at_console="false" policies are applied
870 - all context="mandatory" policies are applied
871 </literallayout> <!-- .fi -->
874 <para>Policies applied later will override those applied earlier,
875 when the policies overlap. Multiple policies with the same
876 user/group/context are applied in the order they appear
877 in the config file.</para>
879 <variablelist remap='TP'>
881 <term><emphasis remap='I'><deny></emphasis></term>
883 <para><emphasis remap='I'><allow></emphasis></para>
889 <para>A <deny> element appears below a <policy> element and prohibits some
890 action. The <allow> element makes an exception to previous <deny>
891 statements, and works just like <deny> but with the inverse meaning.</para>
894 <para>The possible attributes of these elements are:</para>
895 <literallayout remap='.nf'>
896 send_interface="interface_name" | "*"
897 send_member="method_or_signal_name" | "*"
898 send_error="error_name" | "*"
899 send_broadcast="true" | "false"
900 send_destination="name" | "*"
901 send_type="method_call" | "method_return" | "signal" | "error" | "*"
902 send_path="/path/name" | "*"
904 receive_interface="interface_name" | "*"
905 receive_member="method_or_signal_name" | "*"
906 receive_error="error_name" | "*"
907 receive_sender="name" | "*"
908 receive_type="method_call" | "method_return" | "signal" | "error" | "*"
909 receive_path="/path/name" | "*"
911 send_requested_reply="true" | "false"
912 receive_requested_reply="true" | "false"
914 eavesdrop="true" | "false"
918 user="username" | "*"
919 group="groupname" | "*"
920 </literallayout> <!-- .fi -->
923 <para>Examples:</para>
924 <literallayout remap='.nf'>
925 <deny send_destination="org.freedesktop.Service" send_interface="org.freedesktop.System" send_member="Reboot"/>
926 <deny send_destination="org.freedesktop.System"/>
927 <deny receive_sender="org.freedesktop.System"/>
928 <deny user="john"/>
929 <deny group="enemies"/>
930 </literallayout> <!-- .fi -->
933 <para>The <deny> element's attributes determine whether the deny "matches" a
934 particular action. If it matches, the action is denied (unless later
935 rules in the config file allow it).</para>
938 Rules with one or more of the <literal>send_</literal>* family of attributes
939 are checked in order when a connection attempts to send a message. The last
940 rule that matches the message determines whether it may be sent.
941 The well-known session bus normally allows sending any message.
942 The well-known system bus normally allows sending any signal, selected
943 method calls to the <command>dbus-daemon</command>, and exactly one
944 reply to each previously-sent method call (either success or an error).
945 Either of these can be overridden by configuration; on the system bus,
946 services that will receive method calls must install configuration that
947 allows them to do so, usually via rules of the form
948 <literal><policy context="default"><allow send_destination="…"/><policy></literal>.
952 Rules with one or more of the <literal>receive_</literal>* family of
953 attributes, or with the <literal>eavesdrop</literal> attribute and no others,
954 are checked for each recipient of a message (there might be more than one
955 recipient if the message is a broadcast or a connection is eavesdropping).
956 The last rule that matches the message determines whether it may be received.
957 The well-known session bus normally allows receiving any message, including
958 eavesdropping. The well-known system bus normally allows receiving any
959 message that was not eavesdropped (any unicast message addressed to the
960 recipient, and any broadcast message).
964 The <literal>eavesdrop</literal>, <literal>min_fds</literal> and
965 <literal>max_fds</literal> attributes are modifiers that can be applied
966 to either <literal>send_</literal>* or <literal>receive_</literal>*
967 rules, and are documented below.
970 <para>send_destination and receive_sender rules mean that messages may not be
971 sent to or received from the *owner* of the given name, not that
972 they may not be sent *to that name*. That is, if a connection
973 owns services A, B, C, and sending to A is denied, sending to B or C
974 will not work either. As a special case,
975 <literal>send_destination="*"</literal> matches any message
976 (whether it has a destination specified or not), and
977 <literal>receive_sender="*"</literal> similarly matches any message.</para>
980 Rules with <literal>send_broadcast="true"</literal> match signal messages
981 with no destination (broadcasts). Rules with
982 <literal>send_broadcast="false"</literal> are the inverse: they match any
983 unicast destination (unicast signals, together with all method calls, replies
984 and errors) but do not match messages with no destination (broadcasts). This
985 is not the same as <literal>send_destination="*"</literal>, which matches any
986 sent message, regardless of whether it has a destination or not.
990 The other <literal>send_</literal>* and <literal>receive_</literal>*
991 attributes are purely textual/by-value matches against the given field in
992 the message header, except that for the attributes where it is allowed,
993 <literal>*</literal> matches any message (whether it has the relevant
994 header field or not). For example, <literal>send_interface="*"</literal>
995 matches any sent message, even if it does not contain an interface header
996 field. More complex glob matching such as <literal>foo.bar.*</literal> is
1000 <para>"Eavesdropping" occurs when an application receives a message that
1001 was explicitly addressed to a name the application does not own, or
1002 is a reply to such a message. Eavesdropping thus only applies to
1003 messages that are addressed to services and replies to such messages
1004 (i.e. it does not apply to signals).</para>
1006 <para>For <allow>, eavesdrop="true" indicates that the rule matches even
1007 when eavesdropping. eavesdrop="false" is the default and means that
1008 the rule only allows messages to go to their specified recipient.
1009 For <deny>, eavesdrop="true" indicates that the rule matches
1010 only when eavesdropping. eavesdrop="false" is the default for <deny>
1011 also, but here it means that the rule applies always, even when
1012 not eavesdropping. The eavesdrop attribute can only be combined with
1013 send and receive rules (with send_* and receive_* attributes).</para>
1015 <para>The [send|receive]_requested_reply attribute works similarly to the eavesdrop
1016 attribute. It controls whether the <deny> or <allow> matches a reply
1017 that is expected (corresponds to a previous method call message).
1018 This attribute only makes sense for reply messages (errors and method
1019 returns), and is ignored for other message types.</para>
1022 <para>For <allow>, [send|receive]_requested_reply="true" is the default and indicates that
1023 only requested replies are allowed by the
1024 rule. [send|receive]_requested_reply="false" means that the rule allows any reply
1025 even if unexpected.</para>
1028 <para>For <deny>, [send|receive]_requested_reply="false" is the default but indicates that
1029 the rule matches only when the reply was not
1030 requested. [send|receive]_requested_reply="true" indicates that the rule applies
1031 always, regardless of pending reply state.</para>
1034 The <literal>min_fds</literal> and <literal>max_fds</literal> attributes
1035 modify either <literal>send_</literal>* or <literal>receive_</literal>*
1036 rules. A rule with the <literal>min_fds</literal> attribute only matches
1037 messages if they have at least that many Unix file descriptors attached.
1038 Conversely, a rule with the <literal>max_fds</literal> attribute only
1039 matches messages if they have no more than that many file descriptors
1040 attached. In practice, rules with these attributes will most commonly
1042 <literal><allow send_destination="…" max_fds="0"/></literal>,
1043 <literal><deny send_destination="…" min_fds="1"/></literal> or
1044 <literal><deny receive_sender="*" min_fds="1"/></literal>.
1048 Rules with the <literal>user</literal> or <literal>group</literal>
1049 attribute are checked when a new connection to the message bus is
1050 established, and control whether the connection can continue.
1051 Each of these attributes cannot be combined with any other
1052 attribute. As a special case, both <literal>user="*"</literal> and
1053 <literal>group="*"</literal> match any connection. If there are
1054 no rules of this form, the default is to allow connections from the same
1055 user ID that owns the <command>dbus-daemon</command> process. The well-known
1056 session bus normally uses that default behaviour, while the well-known
1057 system bus normally allows any connection.
1061 Rules with the <literal>own</literal> or <literal>own_prefix</literal>
1062 attribute are checked when a connection attempts to own a well-known bus
1063 names. As a special case, <literal>own="*"</literal> matches any well-known
1064 bus name. The well-known session bus normally allows any connection to
1065 own any name, while the well-known system bus normally does not allow any
1066 connection to own any name, except where allowed by further configuration.
1067 System services that will own a name must install configuration that allows
1068 them to do so, usually via rules of the form
1069 <literal><policy user="some-system-user"><allow own="…"/></policy></literal>.
1072 <para><allow own_prefix="a.b"/> allows you to own the name "a.b" or any
1073 name whose first dot-separated elements are "a.b": in particular,
1074 you can own "a.b.c" or "a.b.c.d", but not "a.bc" or "a.c".
1075 This is useful when services like Telepathy and ReserveDevice
1076 define a meaning for subtrees of well-known names, such as
1077 org.freedesktop.Telepathy.ConnectionManager.(anything)
1078 and org.freedesktop.ReserveDevice1.(anything).</para>
1081 <para>It does not make sense to deny a user or group inside a <policy>
1082 for a user or group; user/group denials can only be inside
1083 context="default" or context="mandatory" policies.</para>
1086 <para>A single <deny> rule may specify combinations of attributes such as
1087 send_destination and send_interface and send_type. In this case, the
1088 denial applies only if both attributes match the message being denied.
1089 e.g. <deny send_interface="foo.bar" send_destination="foo.blah"/> would
1090 deny messages with the given interface AND the given bus name.
1091 To get an OR effect you specify multiple <deny> rules.</para>
1094 <para>You can't include both send_ and receive_ attributes on the same
1095 rule, since "whether the message can be sent" and "whether it can be
1096 received" are evaluated separately.</para>
1099 <para>Be careful with send_interface/receive_interface, because the
1100 interface field in messages is optional. In particular, do NOT
1101 specify <deny send_interface="org.foo.Bar"/>! This will cause
1102 no-interface messages to be blocked for all services, which is
1103 almost certainly not what you intended. Always use rules of
1104 the form: <deny send_interface="org.foo.Bar" send_destination="org.foo.Service"/></para>
1106 <itemizedlist remap='TP'>
1108 <listitem><para><emphasis remap='I'><selinux></emphasis></para></listitem>
1113 <para>The <selinux> element contains settings related to Security Enhanced Linux.
1114 More details below.</para>
1116 <itemizedlist remap='TP'>
1118 <listitem><para><emphasis remap='I'><associate></emphasis></para></listitem>
1123 <para>An <associate> element appears below an <selinux> element and
1124 creates a mapping. Right now only one kind of association is possible:</para>
1125 <literallayout remap='.nf'>
1126 <associate own="org.freedesktop.Foobar" context="foo_t"/>
1127 </literallayout> <!-- .fi -->
1130 <para>This means that if a connection asks to own the name
1131 "org.freedesktop.Foobar" then the source context will be the context
1132 of the connection and the target context will be "foo_t" - see the
1133 short discussion of SELinux below.</para>
1136 <para>Note, the context here is the target context when requesting a name,
1137 NOT the context of the connection owning the name.</para>
1140 <para>There's currently no way to set a default for owning any name, if
1141 we add this syntax it will look like:</para>
1142 <literallayout remap='.nf'>
1143 <associate own="*" context="foo_t"/>
1144 </literallayout> <!-- .fi -->
1145 <para>If you find a reason this is useful, let the developers know.
1146 Right now the default will be the security context of the bus itself.</para>
1149 <para>If two <associate> elements specify the same name, the element
1150 appearing later in the configuration file will be used.</para>
1152 <itemizedlist remap='TP'>
1154 <listitem><para><emphasis remap='I'><apparmor></emphasis></para></listitem>
1159 <para>The <apparmor> element is used to configure AppArmor mediation on
1160 the bus. It can contain one attribute that specifies the mediation mode:</para>
1162 <literallayout remap='.nf'>
1163 <apparmor mode="(enabled|disabled|required)"/>
1164 </literallayout> <!-- .fi -->
1166 <para>The default mode is "enabled". In "enabled" mode, AppArmor mediation
1167 will be performed if AppArmor support is available in the kernel. If it is not
1168 available, dbus-daemon will start but AppArmor mediation will not occur. In
1169 "disabled" mode, AppArmor mediation is disabled. In "required" mode, AppArmor
1170 mediation will be enabled if AppArmor support is available, otherwise
1171 dbus-daemon will refuse to start.</para>
1173 <para>The AppArmor mediation mode of the bus cannot be changed after the bus
1174 starts. Modifying the mode in the configuration file and sending a SIGHUP
1175 signal to the daemon has no effect on the mediation mode.</para>
1179 <refsect1 id='selinux'><title>SELinux</title>
1180 <para>See <ulink url='http://www.nsa.gov/selinux/'>http://www.nsa.gov/selinux/</ulink> for full details on SELinux. Some useful excerpts:</para>
1183 <para>Every subject (process) and object (e.g. file, socket, IPC object,
1184 etc) in the system is assigned a collection of security attributes,
1185 known as a security context. A security context contains all of the
1186 security attributes associated with a particular subject or object
1187 that are relevant to the security policy.</para>
1190 <para>In order to better encapsulate security contexts and to provide
1191 greater efficiency, the policy enforcement code of SELinux typically
1192 handles security identifiers (SIDs) rather than security contexts. A
1193 SID is an integer that is mapped by the security server to a security
1194 context at runtime.</para>
1197 <para>When a security decision is required, the policy enforcement code
1198 passes a pair of SIDs (typically the SID of a subject and the SID of
1199 an object, but sometimes a pair of subject SIDs or a pair of object
1200 SIDs), and an object security class to the security server. The object
1201 security class indicates the kind of object, e.g. a process, a regular
1202 file, a directory, a TCP socket, etc.</para>
1205 <para>Access decisions specify whether or not a permission is granted for a
1206 given pair of SIDs and class. Each object class has a set of
1207 associated permissions defined to control operations on objects with
1211 <para>D-Bus performs SELinux security checks in two places.</para>
1214 <para>First, any time a message is routed from one connection to another
1215 connection, the bus daemon will check permissions with the security context of
1216 the first connection as source, security context of the second connection
1217 as target, object class "dbus" and requested permission "send_msg".</para>
1220 <para>If a security context is not available for a connection
1221 (impossible when using UNIX domain sockets), then the target
1222 context used is the context of the bus daemon itself.
1223 There is currently no way to change this default, because we're
1224 assuming that only UNIX domain sockets will be used to
1225 connect to the systemwide bus. If this changes, we'll
1226 probably add a way to set the default connection context.</para>
1229 <para>Second, any time a connection asks to own a name,
1230 the bus daemon will check permissions with the security
1231 context of the connection as source, the security context specified
1232 for the name in the config file as target, object
1233 class "dbus" and requested permission "acquire_svc".</para>
1236 <para>The security context for a bus name is specified with the
1237 <associate> element described earlier in this document.
1238 If a name has no security context associated in the
1239 configuration file, the security context of the bus daemon
1240 itself will be used.</para>
1244 <refsect1 id='apparmor'><title>AppArmor</title>
1245 <para>The AppArmor confinement context is stored when applications connect to
1246 the bus. The confinement context consists of a label and a confinement mode.
1247 When a security decision is required, the daemon uses the confinement context
1248 to query the AppArmor policy to determine if the action should be allowed or
1249 denied and if the action should be audited.</para>
1251 <para>The daemon performs AppArmor security checks in three places.</para>
1253 <para>First, any time a message is routed from one connection to another
1254 connection, the bus daemon will check permissions with the label of the first
1255 connection as source, label and/or connection name of the second connection as
1256 target, along with the bus name, the path name, the interface name, and the
1257 member name. Reply messages, such as method_return and error messages, are
1258 implicitly allowed if they are in response to a message that has already been
1261 <para>Second, any time a connection asks to own a name, the bus daemon will
1262 check permissions with the label of the connection as source, the requested
1263 name as target, along with the bus name.</para>
1265 <para>Third, any time a connection attempts to eavesdrop, the bus daemon will
1266 check permissions with the label of the connection as the source, along with
1267 the bus name.</para>
1269 <para>AppArmor rules for bus mediation are not stored in the bus configuration
1270 files. They are stored in the application's AppArmor profile. Please see
1271 <emphasis remap='I'>apparmor.d(5)</emphasis> for more details.</para>
1275 <refsect1 id='debugging'><title>DEBUGGING</title>
1276 <para>If you're trying to figure out where your messages are going or why
1277 you aren't getting messages, there are several things you can try.</para>
1279 <para>Remember that the system bus is heavily locked down and if you
1280 haven't installed a security policy file to allow your message
1281 through, it won't work. For the session bus, this is not a concern.</para>
1283 <para>The simplest way to figure out what's happening on the bus is to run
1284 the <emphasis remap='I'>dbus-monitor</emphasis> program, which comes with the D-Bus
1285 package. You can also send test messages with <emphasis remap='I'>dbus-send</emphasis>. These
1286 programs have their own man pages.</para>
1288 <para>If you want to know what the daemon itself is doing, you might consider
1289 running a separate copy of the daemon to test against. This will allow you
1290 to put the daemon under a debugger, or run it with verbose output, without
1291 messing up your real session and system daemons.</para>
1293 <para>To run a separate test copy of the daemon, for example you might open a terminal
1295 <literallayout remap='.nf'>
1296 DBUS_VERBOSE=1 dbus-daemon --session --print-address
1297 </literallayout> <!-- .fi -->
1299 <para>The test daemon address will be printed when the daemon starts. You will need
1300 to copy-and-paste this address and use it as the value of the
1301 DBUS_SESSION_BUS_ADDRESS environment variable when you launch the applications
1302 you want to test. This will cause those applications to connect to your
1303 test bus instead of the DBUS_SESSION_BUS_ADDRESS of your real session bus.</para>
1305 <para>DBUS_VERBOSE=1 will have NO EFFECT unless your copy of D-Bus
1306 was compiled with verbose mode enabled. This is not recommended in
1307 production builds due to performance impact. You may need to rebuild
1308 D-Bus if your copy was not built with debugging in mind. (DBUS_VERBOSE
1309 also affects the D-Bus library and thus applications using D-Bus; it may
1310 be useful to see verbose output on both the client side and from the daemon.)</para>
1312 <para>If you want to get fancy, you can create a custom bus
1313 configuration for your test bus (see the session.conf and system.conf
1314 files that define the two default configurations for example). This
1315 would allow you to specify a different directory for .service files,
1320 <refsect1 id='author'><title>AUTHOR</title>
1321 <para>See <ulink url='http://www.freedesktop.org/software/dbus/doc/AUTHORS'>http://www.freedesktop.org/software/dbus/doc/AUTHORS</ulink></para>
1325 <refsect1 id='bugs'><title>BUGS</title>
1326 <para>Please send bug reports to the D-Bus mailing list or bug tracker,
1327 see <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink></para>