dbus-daemon.1 revision 17602
1N/A<!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
1N/A<!--ArborText, Inc., 1988-1999, v.4002-->
1N/A<!--ARC : LSARC 2006/368 D-BUS Message Bus System -->
1N/A<!ENTITY cmd "dbus-daemon">
1N/A<!ENTITY % commonents SYSTEM "smancommon.ent">
1N/A%commonents;
1N/A<!ENTITY % booktitles SYSTEM "booktitles.ent">
1N/A%booktitles;
1N/A<!ENTITY suncopy "Copyright (c) 2007,2009 Sun Microsystems, Inc. All Rights Reserved.">
1N/A]>
1N/A<refentry id="dbus-daemon-1">
1N/A<!-- %Z%%M% %I% %E% SMI; -->
1N/A<refmeta><refentrytitle>&cmd;</refentrytitle><manvolnum>3</manvolnum>
1N/A<refmiscinfo class="date">25 Feb 2009</refmiscinfo>
1N/A<refmiscinfo class="sectdesc">&man3;</refmiscinfo>
1N/A<refmiscinfo class="software">&release;</refmiscinfo>
1N/A<refmiscinfo class="arch">generic</refmiscinfo>
1N/A<refmiscinfo class="copyright">&suncopy;</refmiscinfo>
1N/A</refmeta>
1N/A<indexterm><primary>&cmd;</primary></indexterm><indexterm><primary>
1N/AMessage bus daemon
1N/A</primary></indexterm><refnamediv id="dbus-daemon-1-name">
1N/A<refname>&cmd;</refname><refpurpose>
1N/AMessage bus daemon
1N/A</refpurpose></refnamediv>
1N/A<refsynopsisdiv id="dbus-daemon-1-synp"><title>&synp-tt;</title>
1N/A<cmdsynopsis><command>&cmd;</command>
1N/A<arg choice="opt"><option>-config-file=<replaceable>file</replaceable></option></arg>
1N/A<arg choice="opt"><option>-fork</option> | <option>-nofork</option></arg>
1N/A<arg choice="opt"><option>-introspect</option></arg>
1N/A<arg choice="opt"><option>-print-address[=<replaceable>descriptor</replaceable>]</option></arg>
1N/A<arg choice="opt"><option>-print-pid[=<replaceable>descriptor</replaceable>]</option></arg>
1N/A<arg choice="opt"><option>-session</option></arg>
1N/A<arg choice="opt"><option>-system</option></arg>
1N/A<arg choice="opt"><option>-version</option></arg>
1N/A</cmdsynopsis></refsynopsisdiv>
1N/A
1N/A<refsect1 id="dbus-daemon-1-desc"><title>&desc-tt;</title>
1N/A<para>
1N/A<command>&cmd;</command> is the D\-Bus message bus daemon. D\-Bus is first a
1N/Alibrary that provides one\-to\-one communication between any two applications;
1N/A<command>&cmd;</command> is an application that uses this library to implement
1N/Aa message bus daemon. Multiple programs connect to the message bus daemon and
1N/Acan exchange messages with one another.
1N/A</para>
1N/A
1N/A<para>
1N/AThere are two standard message bus instances. <command>&cmd;</command> is used
1N/Afor both of these instances, but with a different configuration file.
1N/A</para>
1N/A
1N/A<itemizedlist>
1N/A<listitem><para>
1N/Asystemwide message bus - Launched when the system is started and is enabled by
1N/Adefault. Additional systemwide services can be launched via D\-Bus
1N/A&quot;service activation&quot; However, &quot;service activation&quot; is
1N/Adisabled on Solaris. Note that the <option>-system</option> option is
1N/Aequivalent to:
1N/A</para>
1N/A<para>
1N/A&quot;<option>-config\-file=/etc/dbus\-1/system.conf</option>&quot;
1N/A</para></listitem>
1N/A<listitem><para>
1N/Aper-user-login-session message bus - Launched each time a user logs in. Note
1N/Athat the <option>-session</option> option is equivalent to:
1N/A</para>
1N/A<para>
1N/A&quot;<option>-config\-file=/etc/dbus\-1/session.conf</option>&quot;
1N/A</para></listitem>
1N/A</itemizedlist>
1N/A
1N/A<para>
1N/ABy creating additional configuration files and using the
1N/A<option>-config\-file</option> option, additional special-purpose message bus
1N/Adaemons could be created.
1N/A</para>
1N/A
1N/A<para>
1N/AOn Solaris, D\-Bus is configured with &quot;service activation&quot; disabled,
1N/Aso that users cannot launch systemwide bus services on demand. This feature is
1N/Anot used by any applications that are currently shipped with Solaris.
1N/A</para>
1N/A
1N/A<para>
1N/AOn Solaris, the D\-Bus service is managed by the
1N/A<citerefentry><refentrytitle>smf</refentrytitle>
1N/A<manvolnum>5</manvolnum></citerefentry>
1N/Aservice management facility under the service identifier
1N/A<replaceable>svc:/system/dbus</replaceable>.
1N/AOn Solaris, it is recommended that you use the
1N/A<citerefentry><refentrytitle>svcadm</refentrytitle>
1N/A<manvolnum>1m</manvolnum></citerefentry> utility to start and stop the D\-Bus
1N/Aservice
1N/A</para>
1N/A
1N/A<para>
1N/AThe systemwide daemon is largely used for broadcasting system events, such as
1N/Achanges to the printer queue, or adding/removing devices.
1N/A</para>
1N/A
1N/A<para>
1N/AThe per-session daemon is used for various interprocess communication among
1N/Adesktop applications (however, it is not tied to X or the GUI in any way).
1N/A</para>
1N/A
1N/A<para>
1N/ASIGHUP will cause the D\-Bus daemon to PARTIALLY reload its configuration file
1N/Aand to flush its user/group information caches. Some configuration changes
1N/Awould require kicking all applications off the bus; so they will only take
1N/Aeffect if you restart the daemon. Policy changes should take effect with
1N/ASIGHUP.
1N/A</para>
1N/A</refsect1>
1N/A
1N/A<refsect1 id="dbus-daemon-1-opts"><title>&opts-tt;</title>
1N/A<para>
The following options are supported:
</para>
<variablelist termlength="wholeline">
<varlistentry>
<term><option>-config-file=<replaceable>file</replaceable></option></term>
<listitem><para>
Use the given configuration <replaceable>file</replaceable>.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-fork</option></term>
<listitem><para>
Force the message bus to fork and become a daemon, regardless of configuration
file settings.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-introspect</option></term>
<listitem><para>
Print introspect data and exit.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-nofork</option></term>
<listitem><para>
Avoid running the message bus as a daemon, regardless of configuration file
settings.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-print-address[=<replaceable>descriptor</replaceable>]</option></term>
<listitem><para>
Print the address of the message bus to standard output, or to the given file
<replaceable>descriptor</replaceable>. This is used by programs that launch
the message bus.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-print-pid[=<replaceable>descriptor</replaceable>]</option></term>
<listitem><para>
Print the process ID of the message bus to standard output, or to the given
file <replaceable>descriptor</replaceable>. This is used by programs that
launch the message bus.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-session</option></term>
<listitem><para>
Use the standard configuration file for the per-login-session message bus.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-system</option></term>
<listitem><para>
Use the standard configuration file for the systemwide message bus.
</para>
</listitem></varlistentry>
<varlistentry>
<term><option>-version</option></term>
<listitem><para>
Print the version of the daemon.
</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="dbus-daemon-1-envr"><title>&envr-tt;</title>
<para>
See
<citerefentry><refentrytitle>environ</refentrytitle>
<manvolnum>5</manvolnum></citerefentry>
for descriptions of the following environment variables:
</para>
<variablelist termlength="wholeline">
<varlistentry>
<term>DBUS_SESSION_BUS_ADDRESS</term>
<listitem><para>
The address of the login session message bus. If this variable is not set,
applications may also try to read the address from the X Window System root
window property _DBUS_SESSION_BUS_ADDRESS. The root window property
must have type STRING. The environment variable should have precedence over
the root window property.
</para>
</listitem></varlistentry>
<varlistentry>
<term>DBUS_STARTER_BUS_TYPE</term>
<listitem><para>
If the well-known type of the message bus is &quot;session&quot;, then
this environment variable will be set to &quot;session&quot;. If the
type of the message bus is &quot;system;&quot;, then this environment
variable will be set to &quot;system&quot;.
</para>
</listitem></varlistentry>
<varlistentry>
<term>DBUS_VERBOSE</term>
<listitem><para>
Set DBUS_VERSION=1 to enable debugging, if D\-Bus was compiled with verbose
debug mode enabled.
</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="dbus-daemon-1-exit"><title>&exit-tt;</title>
<para>The following exit values are returned:</para>
<variablelist termlength="xtranarrow">
<varlistentry>
<term><returnvalue>0</returnvalue></term>
<listitem><para>
Application exited successfully
</para>
</listitem></varlistentry>
<varlistentry>
<term><returnvalue>>0</returnvalue></term>
<listitem><para>
Application exited with failure
</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="dbus-daemon-1-exde"><title>&exde-tt;</title>
<refsect2>
<title>CONFIGURATION FILE</title>
<para>
A message bus daemon has a configuration file that specializes it for a
particular application. For example, one configuration file might set up the
message bus to be a systemwide message bus, while another might set it
up to be a per-user-login-session bus.
</para>
<para>
The configuration file also establishes resource limits, security parameters,
and so forth.
</para>
<para>
The configuration file is not part of any interoperability specification and
its backward compatibility is not guaranteed; this document is documentation,
not specification.
</para>
<para>
The standard systemwide and per-session message bus setups are configured in
the files &quot;<filename>/etc/dbus-1/system.conf</filename>&quot; and
&quot;<filename>/etc/dbus-1/session.conf</filename>&quot;. These files
normally &lt;include&gt; a <filename>system-local.conf</filename> or
<filename>session-local.conf</filename>; you can put local overrides in those
files to avoid modifying the primary configuration files.
</para>
<para>
The configuration file is an XML document. It must have the following doctype
declaration:
</para>
<screen>
&lt;!DOCTYPE busconfig PUBLIC &quot;-//freedesktop//DTD D\-Bus Bus Configuration 1.0//EN&quot;
&quot;http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd&quot;&gt;
</screen>
<para>
The following elements may be present in the configuration file.
</para>
<para>
&lt;busconfig&gt;
</para>
<para>
Root element.
</para>
<para>
&lt;type&gt;
</para>
<para>
The well-known type of the message bus. Currently known values are
&quot;system&quot; and &quot;session&quot;; if other values are set, they
should be either added to the D\-Bus specification, or namespaced. The last
&lt;type&gt; element &quot;wins&quot; (previous values are ignored). This
element only controls which message bus specific environment variables are set
in activated clients. Most of the policy that distinguishes a session bus from
the system bus is controlled from the other elements in the configuration file.
</para>
<para>
If the well-known type of the message bus is &quot;session&quot;, then the
DBUS_STARTER_BUS_TYPE environment variable will be set to &quot;session&quot;
and the DBUS_SESSION_BUS_ADDRESS environment variable will be set to the
address of the session bus. Likewise, if the type of the message bus is
&quot;system&quot;, then the DBUS_STARTER_BUS_TYPE environment variable will be
set to &quot;system&quot; and the DBUS_SESSION_BUS_ADDRESS environment variable
will be set to the address of the system bus (which is normally well known
anyway).
</para>
<para>
Example: &lt;type&gt;session&lt;/type&gt;
</para>
<para>
&lt;include&gt;
</para>
<para>
Include a file &lt;include&gt;filename.conf&lt;/include&gt; at this point. If
the filename is relative, it is located relative to the configuration file
doing the including.
</para>
<para>
&lt;include&gt; has an optional attribute &quot;ignore_missing=(yes|no)&quot;
which defaults to &quot;no&quot; if not provided. This attribute controls
whether it is a fatal error for the included file to be absent.
</para>
<para>
&lt;includedir&gt;
</para>
<para>
Include all files in &lt;includedir&gt;foo.d&lt;/includedir&gt; at this point.
Files in the directory are included in undefined order. Only files ending in
&quot;.conf&quot; are included.
</para>
<para>
This is intended to allow extension of the system bus by particular packages.
For example, if CUPS wants to be able to send out notification of printer queue
changes, it could install a file to /etc/dbus-1/system.d that allowed all
applications to receive this message and allowed the printer daemon user to
send it.
</para>
<para>
&lt;user&gt;
</para>
<para>
The user account the daemon should run as, specified as either a username or a
UID. If the daemon cannot change to this UID on startup, it will exit. If
this element is not present, the daemon will not change or care about its UID.
</para>
<para>
The last &lt;user&gt; entry in the file &quot;wins&quot;, the others are
ignored.
</para>
<para>
The user is changed after the bus has completed initialization. So sockets,
etc. will be created before changing user, but no data will be read from
clients before changing user. This means that sockets and PID files can be
created in a location that requires root privileges for writing.
</para>
<para>
&lt;fork&gt;
</para>
<para>
If present, the bus daemon becomes a real daemon (forks into the background,
etc.). This is generally used rather than the <option>-fork</option> command
line option.
</para>
<para>
&lt;keep_umask&gt;
</para>
<para>
If present, the bus daemon keeps its original umask when forking. This may be
useful to avoid affecting the behavior of child processes.
</para>
<para>
&lt;listen&gt;
</para>
<para>
Add an address that the bus should listen on. The address is in the standard
D\-Bus format that contains a transport name plus possible parameters/options.
</para>
<screen>
Example: &lt;listen&gt;unix:path=/tmp/foo&lt;/listen&gt;
Example: &lt;listen&gt;tcp:host=localhost,port=1234&lt;/listen&gt;
</screen>
<para>
If there are multiple &lt;listen&gt; elements, then the bus listens on multiple
addresses. The bus will pass its address to started services or other
interested parties with the last address given in &lt;listen&gt; first. That
is, applications will try to connect to the last &lt;listen&gt; address first.
</para>
<para>
tcp sockets can accept IPv4 addresses, IPv6 addresses or hostnames. If a
hostname resolves to multiple addresses, the server will bind to all of them.
The family=ipv4 or family=ipv6 options can be used to force it to bind to a
subset of addresses.
</para>
<screen>
Example:
&lt;listen&gt;tcp:host=localhost,port=0,family=ipv4&lt;/listen&gt;
</screen>
<para>
A special case is using a port number of zero (or omitting the port), which
means to choose an available port selected by the operating system. The port
number chosen can be obtained with the <option>-print-address</option> command
line parameter and will be present in other cases where the server reports its
own address, such as when DBUS_SESSION_BUS_ADDRESS is set.
</para>
<screen>
Example: &lt;listen&gt;tcp:host=localhost,port=0&lt;/listen&gt;
</screen>
<para>
tcp addresses also allow a bind=hostname option, which will override the host
option specifying what address to bind to, without changing the address
reported by the bus. The bind option can also take a special name '*' to
cause the bus to listen on all local address (INADDR_ANY). The specified host
should be a valid name of the local machine or weird stuff will happen.
</para>
<screen>
Example: &lt;listen&gt;tcp:host=localhost,bind=*,port=0&lt;/listen&gt;
</screen>
<para>
&lt;auth&gt;
</para>
<para>
Lists permitted authorization mechanisms. If this element does not exist, then
all known mechanisms are allowed. If there are multiple &lt;auth&gt; elements,
all the listed mechanisms are allowed. The order in which mechanisms are
listed is not meaningful.
</para>
<screen>
Example: &lt;auth&gt;EXTERNAL&lt;/auth&gt;
Example: &lt;auth&gt;DBUS_COOKIE_SHA1&lt;/auth&gt;
</screen>
<para>
&lt;servicedir&gt;
</para>
<para>
Adds a directory to scan for <filename>.service</filename> files. Directories
are scanned starting with the last to appear in the config file (the first
<filename>.service</filename> file found that provides a particular service
will be used).
</para>
<para>
Service files tell the bus how to automatically start a program. They are
primarily used with the per-user-session bus, not the systemwide bus.
</para>
<para>
&lt;standard session servicedirs/&gt;
</para>
<para>
&lt;standard_session_servicedirs/&gt; is equivalent to specifying a series of
&lt;servicedir/&gt; elements for each of the data directories in the &quot;XDG
Base Directory Specification&quot; with the subdirectory
&quot;<filename>dbus-1/services</filename>&quot;, so for example
&quot;<filename>/usr/share/dbus-1/services</filename>&quot; would be among the directories searched.
</para>
<para>
The &quot;XDG Base Directory Specification&quot; should be found at
<literal>http://freedesktop.org/wiki/Standards/basedir-spec</literal>.
</para>
<para>
The &lt;standard_session_servicedirs/&gt; option is only relevant to the
per-user-session bus daemon defined in
<filename>/etc/dbus\-1/session.conf</filename>. Putting it in any other
configuration file would probably be nonsense.
</para>
<para>
&lt;standard system servicedirs/&gt;
</para>
<para>
&lt;standard_system_servicedirs/&gt; specifies the standard systemwide
activation directories that should be searched for service files. This option
defaults to <filename>/usr/share/dbus-1/system-services</filename>.
</para>
<para>
The &lt;standard_system_servicedirs/&gt; option is only relevant
to the per-system bus daemon defined in
<filename>/etc/dbus\-1/system.conf</filename>. Putting it in any other
configuration file would probably be nonsense.
</para>
<para>
&lt;servicehelper/&gt;
</para>
<para>
&lt;servicehelper/&gt; specifies the setuid helper that is used to launch
system daemons with an alternate user. Typically this would be the
<command>dbus-daemon-launch-helper</command> executable. Because
D\-Bus &quot;service activation&quot; is disabled on Solaris, the
<command>dbus-daemon-launch-helper</command> executable is not distributed
with Solaris.
</para>
<para>
The &lt;servicehelper/&gt; option is only relevant to the per-system bus
daemon defined in <filename>/etc/dbus-1/system.conf</filename>. Putting it in
any other configuration file would probably be nonsense.
</para>
<para>
&lt;limit&gt;
</para>
<para>
&lt;limit&gt; establishes a resource limit. For example:
</para>
<screen>
&lt;limit name=&quot;max_message_size&quot;&gt;64&lt;/limit&gt;
&lt;limit name=&quot;max_completed_connections&quot;&gt;512&lt;/limit&gt;
</screen>
<para>
The name attribute is mandatory. Available limit names are:
</para>
<screen>
&quot;max_incoming_bytes&quot; : total size in bytes of
messages incoming from
a single connection
&quot;max_outgoing_bytes&quot; : total size in bytes of
messages queued up for
a single connection
&quot;max_message_size&quot; : maximum size of a
single message in bytes
&quot;service_start_timeout&quot; : milliseconds
(thousandths) until a
started service has to
connect
&quot;auth_timeout&quot; : milliseconds
(thousandths) a
connection is given to
authenticate
&quot;max_completed_connections&quot; : maximum number of
authenticated
connections
&quot;max_incomplete_connections&quot; : maximum number of
unauthenticated
connections
&quot;max_connections_per_user&quot; : maximum number of
completed connections
from the same user
&quot;max_pending_service_starts&quot; : maximum number of
service launches in
progress at the same
time
&quot;max_names_per_connection&quot; : maximum number of
names a single
connection can own
&quot;max_match_rules_per_connection&quot; : maximum number of
match rules for a
single connection
&quot;max_replies_per_connection&quot; : maximum number of
pending method replies
per connection (number
of calls-in-progress)
&quot;reply_timeout&quot; : milliseconds
(thousandths) until a
method call times out
</screen>
<para>
The maximum incoming/outgoing queue sizes allow a new message to be queued if
one byte remains below the maximum. So you can in fact exceed the maximum by
max_message_size.
</para>
<para>
max_completed_connections divided by max_connections_per_user is the number of
users that can work together to denial-of-service all other users by using up
all connections on the systemwide bus.
</para>
<para>
Limits are normally only of interest on the systemwide bus, not the user
session buses.
</para>
<para>
&lt;policy&gt;
</para>
<para>
The &lt;policy&gt; element defines a security policy to be applied to a
particular set of connections to the bus. A policy is made up of &lt;allow&gt;
and &lt;deny&gt; elements. Policies are normally used with the systemwide bus;
they are analogous to a firewall in that they allow expected traffic and
prevent unexpected traffic.
</para>
<para>
Currently, the system bus has a default-deny policy for sending method calls
and owning bus names. Everything else, in particular reply messages, receive
checks, and signals has a default allow policy.
</para>
<para>
In general, it is best to keep system services as small, targeted programs
which run in their own process and provide a single bus name. Then, all that
is needed is an &lt;allow&gt; rule for the &quot;own&quot; permission to let
the process claim the bus name, and a &quot;send_destination&quot; rule to
allow traffic from some or all uids to your service.
</para>
<para>
The &lt;policy&gt; element has one of four attributes:
</para>
<itemizedlist>
<listitem>
context=&quot;(default|mandatory)&quot;
</listitem>
<listitem>
at_console=&quot;(true|false)&quot;
</listitem>
<listitem>
user=&quot;username or userid&quot;
</listitem>
<listitem>
group=&quot;group name or gid&quot;
</listitem>
</itemizedlist>
<para>
Policies are applied to a connection as follows:
</para>
<itemizedlist>
<listitem>
all context=&quot;default&quot; policies are applied
</listitem>
<listitem>
all group=&quot;connection's user's group&quot; policies are applied
in undefined order
</listitem>
<listitem>
all user=&quot;connection's auth user&quot; policies are applied
in undefined order
</listitem>
<listitem>
all at_console=&quot;true&quot; policies are applied
</listitem>
<listitem>
all at_console=&quot;false&quot; policies are applied
</listitem>
<listitem>
all context=&quot;mandatory&quot; policies are applied
</listitem>
</itemizedlist>
<para>
Policies applied later will override those applied earlier, when the policies
overlap. Multiple policies with the same user/group/context are applied in the
order they appear in the config file.
</para>
<para>
&lt;deny&gt; and &lt;allow&gt;
</para>
<para>
A &lt;deny&gt; element appears below a &lt;policy&gt; element and prohibits
some action. The &lt;allow&gt; element makes an exception to previous
&lt;deny&gt; statements, and works just like &lt;deny&gt; but with the inverse
meaning.
</para>
<para>
The possible attributes of these elements are:
</para>
<screen>
send_interface=&quot;interface_name&quot;
send_member=&quot;method_or_signal_name&quot;
send_error=&quot;error_name&quot;
send_destination=&quot;name&quot;
send_type=&quot;method_call&quot; | &quot;method_return&quot; | &quot;signal&quot; | &quot;error&quot;
send_path=&quot;/path/name&quot;
</screen>
<screen>
receive_interface=&quot;interface_name&quot;
receive_member=&quot;method_or_signal_name&quot;
receive_error=&quot;error_name&quot;
receive_sender=&quot;name&quot;
receive_type=&quot;method_call&quot; | &quot;method_return&quot; | &quot;signal&quot; | &quot;error&quot;
receive_path=&quot;/path/name&quot;
</screen>
<screen>
send_requested_reply=&quot;true&quot; | &quot;false&quot;
receive_requested_reply=&quot;true&quot; | &quot;false&quot;
</screen>
<screen>
eavesdrop=&quot;true&quot; | &quot;false&quot;
</screen>
<screen>
own=&quot;name&quot;
user=&quot;username&quot;
group=&quot;groupname&quot;
</screen>
<para>
Examples:
</para>
<screen>
&lt;deny send_interface=&quot;org.freedesktop.System&quot; send_member=&quot;Reboot&quot;/&gt;
&lt;deny receive_interface=&quot;org.freedesktop.System&quot; receive_member=&quot;Reboot&quot;/&gt;
&lt;deny own=&quot;org.freedesktop.System&quot;/&gt;
&lt;deny send_destination=&quot;org.freedesktop.System&quot;/&gt;
&lt;deny receive_sender=&quot;org.freedesktop.System&quot;/&gt;
&lt;deny user=&quot;john&quot;/&gt;
&lt;deny group=&quot;enemies&quot;/&gt;
</screen>
<para>
The &lt;deny&gt; element's attributes determine whether the deny
&quot;matches&quot; a particular action. If it matches, the action is denied
(unless later rules in the config file allow it).
</para>
<para>
send_destination and receive_sender rules mean that messages may not be sent to
or received from the *owner* of the given name, not that they may not be sent
*to that name*. That is, if a connection owns services A, B, C, and sending to
A is denied, sending to B or C will not work either.
</para>
<para>
The other send_* and receive_* attributes are purely textual/by-value matches
against the given field in the message header.
</para>
<para>
&quot;Eavesdropping&quot; occurs when an application receives a message that
was explicitly addressed to a name the application does not own, or is a reply
to such a message. Eavesdropping thus only applies to messages that are
addressed to services and replies to such messages (i.e. it does not apply to
signals).
</para>
<para>
For &lt;allow&gt;, eavesdrop=&quot;true&quot; indicates that the rule matches
even when eavesdropping. eavesdrop=&quot;false&quot; is the default and means
that the rule only allows messages to go to their specified recipient. For
&lt;deny&gt;, eavesdrop=&quot;true&quot; indicates that the rule matches only
when
eavesdropping. eavesdrop=&quot;false&quot; is the default for &lt;deny&gt;
also, but here it means that the rule applies always, even when not
eavesdropping. The eavesdrop attribute can only be combined with send and
receive rules (with send_* and receive_* attributes).
</para>
<para>
The [send|receive]_requested_reply attribute works similarly to the eavesdrop
attribute. It controls whether the &lt;deny&gt; or &lt;allow&gt; matches a
reply that is expected (corresponds to a previous method call message). This
attribute only makes sense for reply messages (errors and method returns), and
is ignored for other message types.
</para>
<para>
For &lt;allow&gt;, [send|receive]_requested_reply=&quot;true&quot; is the
default and indicates that only requested replies are allowed by the rule.
[send|receive]_requested_reply=&quot;false&quot; means that the rule allows any
reply even if unexpected.
</para>
<para>
For &lt;deny&gt;, [send|receive]_requested_reply=&quot;false&quot; is the
default but indicates that the rule matches only when the reply was not
requested. [send|receive]_requested_reply=&quot;true&quot; indicates that the
rule applies always, regardless of pending reply state.
</para>
<para>
user and group denials mean that the given user or group may not connect to the
message bus.
</para>
<para>
For &quot;name&quot;, &quot;username&quot;, &quot;groupname&quot;, etc. the
character &quot;*&quot; can be substituted, meaning &quot;any&quot;. Complex
globs like &quot;foo.bar.*&quot; are not allowed for now because they would be
work to implement and maybe encourage sloppy security anyway.
</para>
<para>
It does not make sense to deny a user or group inside a &lt;policy&gt; for
a user or group; user/group denials can only be inside
context=&quot;default&quot; or context=&quot;mandatory&quot; policies.
</para>
<para>
A single &lt;deny&gt; rule may specify combinations of attributes such as
send_destination and send_interface and send_type. In this case, the denial
applies only if both attributes match the message being denied. e.g. &lt;deny
send_interface=&quot;foo.bar&quot; send_destination=&quot;foo.blah&quot;/&gt;
would deny messages with the given interface AND the given bus name. To get an
OR effect you specify multiple &lt;deny&gt; rules.
</para>
<para>
You can not include both send_ and receive_ attributes on the same rule, since
&quot;whether the message can be sent&quot; and &quot;whether it can be
received&quot; are evaluated separately.
</para>
<para>
Be careful with send_interface/receive_interface, because the interface field
in messages is optional. In particular, do NOT specify &lt;deny
send_interface=&quot;org.foo.Bar&quot;/>! This will cause no-interface
messages to be blocked for all services, which is almost certainly not what you
intended. Always use rules of the form:
</para>
<screen>
&lt;deny send_interface=&quot;org.foo.Bar&quot; send_destination=&quot;org.foo.Service&quot;/>
</screen>
<para>
&lt;selinux&gt;
</para>
<para>
The &lt;selinux&gt; element contains settings related to Security Enhanced
Linux. More details below. Note, SELinux is not supported on Solaris.
</para>
<para>
&lt;associate&gt;
</para>
<para>
An &lt;associate&gt; element appears below an &lt;selinux&gt; element and
creates a mapping. Right now only one kind of association is possible:
</para>
<screen>
&lt;associate own=&quot;org.freedesktop.Foobar&quot; context=&quot;foo_t&quot;/&gt;
</screen>
<para>
This means that if a connection asks to own the name
&quot;org.freedesktop.Foobar&quot; then the source context will be the context
of the connection and the target context will be &quot;foo_t&quot; - see the
short discussion of SELinux below.
</para>
<para>
Note, the context here is the target context when requesting a name, NOT the
context of the connection owning the name.
</para>
<para>
There is currently no way to set a default for owning any name, if we add this
syntax it will look like:
</para>
<screen>
&lt;associate own=&quot;*&quot; context=&quot;foo_t&quot;/&gt;
</screen>
<para>
If you find a reason this is useful, let the developers know. Right now the
default will be the security context of the bus itself.
</para>
<para>
If two &lt;associate&gt; elements specify the same name, the element appearing
later in the configuration file will be used.
</para>
</refsect2>
<refsect2>
<title>SELinux</title>
<para>
SELinux is not supported on Solaris.
</para>
<para>
See <literal>http://www.nsa.gov/selinux/</literal> for full details on SELinux.
Some useful excerpts:
</para>
<variablelist termlength="xtranarrow">
<varlistentry>
<term></term>
<listitem>
<para>
Every subject (process) and object (e.g. file, socket, IPC object, etc) in the
system is assigned a collection of security attributes, known as a security
context. A security context contains all of the security attributes associated
with a particular subject or object that are relevant to the security policy.
</para>
</listitem></varlistentry>
<varlistentry>
<term></term>
<listitem>
<para>
In order to better encapsulate security contexts and to provide greater
efficiency, the policy enforcement code of SELinux typically handles security
identifiers (SIDs) rather than security contexts. A SID is an integer that is
mapped by the security server to a security context at runtime.
</para>
</listitem></varlistentry>
<varlistentry>
<term></term>
<listitem>
<para>
When a security decision is required, the policy enforcement code passes a pair
of SIDs (typically the SID of a subject and the SID of an object, but sometimes
a pair of subject SIDs or a pair of object SIDs), and an object security class
to the security server. The object security class indicates the kind of object,
e.g. a process, a regular file, a directory, a TCP socket, etc.
</para>
</listitem></varlistentry>
<varlistentry>
<term></term>
<listitem>
<para>
Access decisions specify whether or not a permission is granted for a given
pair of SIDs and class. Each object class has a set of associated permissions
defined to control operations on objects with that class.
</para>
</listitem></varlistentry>
</variablelist>
<para>
D\-Bus performs SELinux security checks in two places.
</para>
<para>
First, any time a message is routed from one connection to another connection,
the bus daemon will check permissions with the security context of the first
connection as source, security context of the second connection as target,
object class &quot;dbus&quot; and requested permission &quot;send_msg&quot;.
</para>
<para>
If a security context is not available for a connection (impossible when using
UNIX domain sockets), then the target context used is the context of the bus
daemon itself. There is currently no way to change this default, because we
are assuming that only UNIX domain sockets will be used to connect to the
systemwide bus. If this changes, we will probably add a way to set the default
connection context.
</para>
<para>
Second, any time a connection asks to own a name, the bus daemon will check
permissions with the security context of the connection as source, the security
context specified for the name in the config file as target, object class
&quot;dbus&quot; and requested permission &quot;acquire_svc&quot;.
</para>
<para>
The security context for a bus name is specified with the &lt;associate&gt;
element described earlier in this document. If a name has no security context
associated in the configuration file, the security context of the bus daemon
itself will be used.
</para>
</refsect2>
<refsect2>
<title>DEBUGGING</title>
<para>
If you are trying to figure out where your messages are going or why you are
not getting messages, there are several things you can try.
</para>
<para>
Remember that the system bus is heavily locked down and if you have not
installed a security policy file to allow your message through, it will not
work. For the session bus, this is not a concern.
</para>
<para>
The simplest way to figure out what is happening on the bus is to run the
<citerefentry><refentrytitle>dbus-monitor</refentrytitle>
<manvolnum>1</manvolnum></citerefentry>
program, which comes with the D\-Bus package.
You can also send test messages with
<citerefentry><refentrytitle>dbus-send</refentrytitle>
<manvolnum>1</manvolnum></citerefentry>.
These programs have their own man pages.
</para>
<para>
If you want to know what the daemon itself is doing, you might consider running
a separate copy of the daemon to test against. This will allow you to put the
daemon under a debugger, or run it with verbose output, without messing up your
real session and system daemons.
</para>
<para>
To run a separate test copy of the daemon, for example, you might open a
terminal and type:
</para>
<screen>
DBUS_VERBOSE=1 &cmd; --session --print-address
</screen>
<para>
The test daemon address will be printed when the daemon starts. You will need
to copy-and-paste this address and use it as the value of the
DBUS_SESSION_BUS_ADDRESS environment variable when you launch the applications
you want to test. This will cause those applications to connect to your test
bus instead of the DBUS_SESSION_BUS_ADDRESS of your real session bus.
</para>
<para>
DBUS_VERBOSE=1 will have NO EFFECT unless your copy of D\-Bus was compiled with
verbose mode enabled. This is not recommended in production builds due to
performance impact. You may need to rebuild D\-Bus if your copy was not built
with debugging in mind. (DBUS_VERBOSE also affects the D\-Bus library and thus
applications using D\-Bus; it may be useful to see verbose output on both the
client side and from the daemon.)
</para>
<para>
If you want to get fancy, you can create a custom bus configuration for your
test bus (see the <filename>session.conf</filename> and
<filename>system.conf</filename> files that define the two default
configurations for example). This would allow you to specify a different
directory for <filename>.service</filename> files, for example.
</para>
</refsect2>
</refsect1>
<refsect1 id="dbus-daemon-1-exam"><title>&exam-tt;</title>
<example role="example">
<title>
Message bus daemon
</title>
<para><screen>example% <userinput>&cmd; </userinput></screen></para>
</example>
</refsect1>
<refsect1 id="dbus-daemon-1-file"><title>&file-tt;</title>
<para>
The following files are used by this application:
</para>
<variablelist termlength="wholeline">
<varlistentry>
<term><filename>/usr/lib/&cmd;</filename></term>
<listitem><para>
Executable for <command>&cmd;</command>
</para>
</listitem></varlistentry>
<varlistentry>
<term><filename>/usr/share/dbus-1/services</filename></term>
<listitem><para>
Directory containing standard D\-Bus session services.
</para>
</listitem></varlistentry>
<varlistentry>
<term><filename>/usr/share/dbus-1/system-services</filename></term>
<listitem><para>
Directory containing standard D\-Bus systemwide services.
</para>
</listitem></varlistentry>
<varlistentry>
<term><filename>/etc/dbus-1/session.conf</filename></term>
<listitem><para>
Configuration file for D\-Bus session services.
</para>
</listitem></varlistentry>
<varlistentry>
<term><filename>/etc/dbus-1/system.conf</filename></term>
<listitem><para>
Configuration file for D\-Bus system services.
</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="dbus-daemon-1-attr"><title>&attr-tt;</title>
<para>
See <olink targetdocent="REFMAN5" localinfo="attributes-5">
<citerefentry><refentrytitle>attributes</refentrytitle>
<manvolnum>5</manvolnum></citerefentry></olink>
for descriptions of the following attributes:
</para>
<informaltable frame="all">
<tgroup cols="2" colsep="1" rowsep="1">
<colspec colname="COLSPEC0" colwidth="1*">
<colspec colname="COLSPEC1" colwidth="1*">
<thead>
<row>
<entry align="center" valign="middle">ATTRIBUTE TYPE</entry>
<entry align="center" valign="middle">ATTRIBUTE VALUE</entry>
</row>
</thead>
<tbody>
<row>
<entry><para>Availability</para></entry>
<entry><para>SUNWdbus</para></entry>
</row>
<row>
<entry colname="COLSPEC0"><para>Interface stability</para></entry>
<entry colname="COLSPEC1"><para>Volatile</para></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="dbus-daemon-1-also"><title>&also-tt;</title>
<!--Reference to another man page-->
<!--Reference to a Help manual-->
<!--Reference to a book.-->
<para>
More information can be found at:
</para>
<para>
<literal>http://www.freedesktop.org/software/dbus/</literal>
</para>
<para>
<citerefentry><refentrytitle>dbus-binding-tool</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>dbus-cleanup-sockets</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>dbus-launch</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>dbus-monitor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>dbus-send</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>dbus-uuidgen</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1m</manvolnum></citerefentry>,
<citerefentry><refentrytitle>libdbus-glib-1</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>environ</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>smf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para>
</refsect1>
<refsect1 id="dbus-daemon-1-note"><title>&note-tt;</title>
<para>
For authorship information refer to
<literal>http://www.freedesktop.org/software/dbus/doc/AUTHORS</literal>.
Updated by Brian Cameron, Sun Microsystems Inc., 2007.
</para>
<para>
Please send bug reports to the D\-Bus mailing list or bug
tracker, see
<literal>http://www.freedesktop.org/software/dbus/</literal>
</para>
</refsect1>
</refentry>