<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8414</bug_id>
          
          <creation_ts>2015-09-29 08:36:47 +0000</creation_ts>
          <short_desc>D-Bus policies are not properly applied</short_desc>
          <delta_ts>2015-10-23 13:32:37 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>configuration</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jussi Kukkonen">jku</reporter>
          <assigned_to name="Jussi Kukkonen">jku</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>cristian.iorga</cc>
    
    <cc>ross.burton</cc>
          
          <qa_contact name="Cristian Iorga">cristian.iorga</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54773</commentid>
    <comment_count>0</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2015-09-29 08:36:47 +0000</bug_when>
    <thetext>It seems our D-Bus policies are not being correctly applied, at least not on sysvinit. My test case is connman (because I was fixing the policy): currently the policy has a &quot;allow&quot; policy to let everyone send messages to the service, but I modified /etc/dbus-1/system.d/connman.conf to look like this: 

&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;
&lt;busconfig&gt;
    &lt;policy user=&quot;root&quot;&gt;
        &lt;allow own=&quot;net.connman&quot;/&gt;
        &lt;allow send_destination=&quot;net.connman&quot;/&gt;
        &lt;allow send_interface=&quot;net.connman.Agent&quot;/&gt;
        &lt;allow send_interface=&quot;net.connman.Counter&quot;/&gt;
        &lt;allow send_interface=&quot;net.connman.Notification&quot;/&gt;
    &lt;/policy&gt;
    &lt;policy user=&quot;xuser&quot;&gt;
        &lt;allow send_destination=&quot;net.connman&quot;/&gt;
    &lt;/policy&gt;
    &lt;policy context=&quot;default&quot;&gt;
        &lt;deny send_destination=&quot;net.connman&quot;/&gt;
    &lt;/policy&gt;
&lt;/busconfig&gt;

System bus should have a default &quot;deny send_destination&quot;, but I left one there anyway: only root and xuser should be allowed to send to net.connman.

Then I restarted dbus and connman, created a new user &quot;tester&quot;, and as that user ran
    dbus-send --system --print-reply \
        --dest=net.connman \
        /net/connman/technology/wifi \
        net.connman.Technology.GetProperties

And got a real reply from the service. This also happens on fido. I expected to get a D-Bus access violation error, and that is indeed what happened with systemd (although I can&apos;t tell how that could affect things).


This issue is really only relevant to systems that use non-root users. I have not tested whether the &quot;allow own&quot; policies are applied or not.


I&apos;m still thinking I might be doing something wrong here: advice is welcome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54774</commentid>
    <comment_count>1</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2015-09-29 08:45:56 +0000</bug_when>
    <thetext>A more useful test command (with actual results on qemu as well): 
    dbus-send --system --print-reply \
        --dest=net.connman \
        /net/connman/technology/ethernet \
        net.connman.Technology.GetProperties</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54784</commentid>
    <comment_count>2</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2015-09-29 13:48:01 +0000</bug_when>
    <thetext>I think it&apos;s bluetooth.conf.

  &lt;policy context=&quot;default&quot;&gt;
    &lt;allow own=&quot;org.bluez&quot;/&gt;
    &lt;allow send_destination=&quot;org.bluez&quot;/&gt;
    &lt;allow send_interface=&quot;org.bluez.Agent1&quot;/&gt;
    &lt;allow send_type=&quot;method_call&quot;/&gt;
  &lt;/policy&gt;

I think the person writing this thought the allow rules are somehow combined: they are not, so this is ... not optimal: It allows anyone to own org.bluez on system bus and it allows anyone to send messages to anyone on system bus.


I&apos;m not sure but I think the reason it happened to work once with systemd is that the order of applying rules seems non-deterministic: sometimes, connmans rule seems to override this one. This feels like dbus-daemon bug (even if the service-specific configuration files aren&apos;t supposed to do things like the example here).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54796</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-09-29 18:07:03 +0000</bug_when>
    <thetext>Jussi has been digging into this, so reassigning back to him.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54933</commentid>
    <comment_count>4</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2015-10-02 12:09:57 +0000</bug_when>
    <thetext>commit cdaa8fd9608d1c34a2e6c9f6d0c9dc6ced706859
Author: Jussi Kukkonen &lt;jussi.kukkonen@intel.com&gt;
Date:   Thu Oct 1 11:04:35 2015 +0300

    bluez5: Use upstream D-Bus policy
    
    The Bluez D-Bus policy is much too open and affects not just bluez but
    all system services: Use upstream policy configuration instead.
    
    This change has a chance of affecting other D-Bus services: the bug
    that is fixed here may have hidden problems in other policies.
    
    [YOCTO #8414]
    
    (From OE-Core rev: 0f6f87c60a6ffeff6b3f53d25f4023749103e262)
    
    Signed-off-by: Jussi Kukkonen &lt;jussi.kukkonen@intel.com&gt;
    Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55670</commentid>
    <comment_count>5</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2015-10-23 13:32:37 +0000</bug_when>
    <thetext>Tested by adding a user named ubik and by executing:

ubik@qemux86-64:~$ dbus-send --system --print-reply --dest=net.connman /net/connman/technology/ethernet net.connman.Technology.GetProperties
Error org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type=&quot;method_call&quot;, sender=&quot;:1.13&quot; (uid=1001 pid=934 comm=&quot;dbus-send --system --print-reply --dest=net.connma&quot;) interface=&quot;net.connman.Technology&quot; member=&quot;GetProperties&quot; error name=&quot;(unset)&quot; requested_reply=&quot;0&quot; destination=&quot;net.connman&quot; (uid=0 pid=697 comm=&quot;/usr/sbin/connmand &quot;)
ubik@qemux86-64:~$ exit
exit
root@qemux86-64:~# dbus-send --system --print-reply --dest=net.connman /net/connman/technology/ethernet net.connman.Technology.GetProperties
method return sender=:1.0 -&gt; dest=:1.14 reply_serial=2
   array [
      dict entry(
         string &quot;Name&quot;
         variant             string &quot;Wired&quot;
      )
      dict entry(
         string &quot;Type&quot;
         variant             string &quot;ethernet&quot;
      )
      dict entry(
         string &quot;Powered&quot;
         variant             boolean true
      )
      dict entry(
         string &quot;Connected&quot;
         variant             boolean false
      )
      dict entry(
         string &quot;Tethering&quot;
         variant             boolean false
      )
   ]
root@qemux86-64:~#

For non-root ubik user, the system errors out a denied access.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>