title: System D-Bus does not allow punching out ownership with conf files
body: <p>I am trying to create a daemon service that runs on the system bus where the permissions for sending and receiving from this service should be completely open to anybody. (Security is not a concern for this service). When I attempt to register the service using QtDbus (using the PyQt for it) I get this error: <code>Connection ":1.0" is not allowed to own the service "org.dbus.arduino" due to security policies in the configuration file</code>. This other stack overflow has the same error, but does not help at all in this situation for some reason. <a href="https://stackoverflow.com/questions/4560877/dbus-bus-request-name-connections-are-not-allowed-to-own-the-service"><code>dbus_bus_request_name ()</code>: Connections are not allowed to own the service</a>.</p>
  
  <p>Normally you're supposed to leave the <code>system.conf</code> file in-tact and add your permissions "punch out" config file in the <code>system.d</code> directory. I have done this, but it does not seem to change anything, regardless with how open I make the permissions. In fact I'm almost positive it's not changing anything! Here is my conf file as it sits right this moment.</p>
  
  <pre><code>&lt;!DOCTYPE busconfig PUBLIC
   "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
   "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"&gt;
  
  &lt;busconfig&gt;
      &lt;policy user="myUser"&gt;
          &lt;allow own="*"/&gt;
          &lt;allow own="org.dbus.arduino"/&gt;
          &lt;allow send_type="method_call" log="true"/&gt;
      &lt;/policy&gt;                 
      &lt;policy user="root"&gt;        
          &lt;allow own="*"/&gt;
          &lt;allow own="org.dbus.arduino"/&gt;
          &lt;allow send_type="method_call" log="true"/&gt;
      &lt;/policy&gt;                         
      &lt;policy context="default"&gt;            
      &lt;/policy&gt;                                                     
  &lt;/busconfig&gt;                 
  </code></pre>
  
  <p>Even if I do this or things like it, it STILL doesn't work.
      </p>
  
  <pre><code>&lt;busconfig&gt;               
      &lt;policy context="default"&gt;     
          &lt;allow own="*"/&gt;
          &lt;allow own="org.dbus.arduino"/&gt;
          &lt;allow send_type="method_call" log="true"/&gt;       
      &lt;/policy&gt;                                                     
  &lt;/busconfig&gt;  
  </code></pre>
  
  <p>I even put the name of the file starting with a z so that it may be the very last one that is read in. Here is the system.conf file, note where I have commented out the "allow own" section. This is the ONLY way to get this to work (and the worst possible "fix").</p>
  
  <pre><code>&lt;!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
   "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"&gt;
  &lt;busconfig&gt;
  
    &lt;!-- Our well-known bus type, do not change this --&gt;
    &lt;type&gt;system&lt;/type&gt;
  
    &lt;!-- Run as special user --&gt;
    &lt;user&gt;messagebus&lt;/user&gt;
  
    &lt;!-- Fork into daemon mode --&gt;
    &lt;fork/&gt;
  
    &lt;!-- We use system service launching using a helper --&gt;
    &lt;standard_system_servicedirs/&gt;
  
    &lt;!-- This is a setuid helper that is used to launch system services --&gt;
    &lt;servicehelper&gt;/lib/dbus-1/dbus-daemon-launch-helper&lt;/servicehelper&gt;
  
    &lt;!-- Write a pid file --&gt;
    &lt;pidfile&gt;/var/run/dbus/pid&lt;/pidfile&gt;
  
    &lt;!-- Enable logging to syslog --&gt;
    &lt;syslog/&gt;
  
    &lt;!-- Only allow socket-credentials-based authentication --&gt;
    &lt;auth&gt;EXTERNAL&lt;/auth&gt;
  
    &lt;!-- Only listen on a local socket. (abstract=/path/to/socket 
         means use abstract namespace, don't really create filesystem 
         file; only Linux supports this. Use path=/whatever on other 
         systems.) --&gt;
    &lt;listen&gt;unix:path=/var/run/dbus/system_bus_socket&lt;/listen&gt;
  
    &lt;policy context="default"&gt;
      &lt;!-- All users can connect to system bus --&gt;
      &lt;allow user="*"/&gt;
  
      &lt;!-- Holes must be punched in service configuration files for
           name ownership and sending method calls --&gt;
      &lt;deny own="*"/&gt;
      &lt;deny send_type="method_call" log="true"/&gt;
  
      &lt;!-- THIS IS THE ONLY WAY TO GET THIS TO WORK
      &lt;allow own="*"/&gt;
      &lt;allow send_type="method_call" log="true"/&gt;
      --&gt;
  
  
  
      &lt;!-- Signals and reply messages (method returns, errors) are allowed
           by default --&gt;
      &lt;allow send_type="signal"/&gt;
      &lt;allow send_requested_reply="true" send_type="method_return"/&gt;
      &lt;allow send_requested_reply="true" send_type="error"/&gt;
  
      &lt;!-- All messages may be received by default --&gt;
      &lt;allow receive_type="method_call"/&gt;
      &lt;allow receive_type="method_return"/&gt;
      &lt;allow receive_type="error"/&gt;
      &lt;allow receive_type="signal"/&gt;
  
      &lt;!-- Allow anyone to talk to the message bus --&gt;
      &lt;allow send_destination="org.freedesktop.DBus"/&gt;
      &lt;!-- But disallow some specific bus services --&gt;
      &lt;deny send_destination="org.freedesktop.DBus"
            send_interface="org.freedesktop.DBus"
            send_member="UpdateActivationEnvironment"/&gt;
  
    &lt;/policy&gt;
  
    &lt;!-- Config files are placed here that among other things, punch 
         holes in the above policy for specific services. --&gt;
    &lt;includedir&gt;system.d&lt;/includedir&gt;
  
    &lt;!-- This is included last so local configuration can override what's 
         in this standard file --&gt;
    &lt;include ignore_missing="yes"&gt;system-local.conf&lt;/include&gt;
  
    &lt;include if_selinux_enabled="yes" selinux_root_relative="yes"&gt;contexts/dbus_contexts&lt;/include&gt;
  
  &lt;/busconfig&gt;
  </code></pre>
  
  <p>I absolutely have to use the System bus because I am deploying it on a Raspberry Pi without a GUI, (no x11, and no session bus). I was able to get the Raspberry Pi working only by completely allowing everything on the system bus (security is not nearly as big of a deal on this device). Obviously, there is no way I'm allowing that to occur on my development machine. As background I am using Opensuse 12.2 and the Raspberry Pi is Debian Squeeze. I cannot own the service with my user account, nor root, unless I completely open the permissions up, in that case it works just fine. I will also note that when I completely opened up the system bus, I still had to use root to send messages to the daemon (a terminate command). I'd like the solution to be able to be runnable via a particular user with root having access as well. I am also OK with the solution only allowing the same user and root to send messages to it.</p>
  
  <p>Thanks for any help I'm sure it's a small issue!</p>