Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP talk to NetworkManager via Dbus
    primarykey
    data
    text
    <p>I have setup NetworkManager, Dbus, Nginx web server, PHP and a Dbus PHP extension on my debian system.<br></p> <p>I am trying to „talk“ to NetworkManager via Dbus from my PHP web application. It works fine when retrieving information about connections, like in this code:<br></p> <pre><code>$dbus = new Dbus( Dbus::BUS_SYSTEM, true); $proxy = $dbus-&gt;createProxy("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManagerSettings", "org.freedesktop.NetworkManagerSettings"); $d = $proxy-&gt;ListConnections(); </code></pre> <p>, but when I want to add a new connection:<br></p> <pre><code>$d = new Dbus( Dbus::BUS_SYSTEM, true ); $n = $d-&gt;createProxy( "org.freedesktop.NetworkManagerSystemSettings", "/org/freedesktop/NetworkManagerSettings", "org.freedesktop.NetworkManagerSettings"); $args = new DBusDict( DBus::STRUCT, array( 'connection' =&gt; new DBusDict( DBus::VARIANT, array( 'uuid' =&gt; new DBusVariant( "06bd5fb0-45f1-0bb0-7ffb-5f3ed6edd604" ), 'id' =&gt; new DBusVariant( "PHP Added Network Connection" ), 'type' =&gt; new DBusVariant( "802-3-ethernet" ), 'autoconnect' =&gt; new DBusVariant(FALSE) )), '802-3-ethernet' =&gt; new DBusDict( DBus::VARIANT, array('duplex' =&gt; new DBusVariant( "full" )))), '{sa{sv}}'); $n-&gt;AddConnection( $args ); </code></pre> <p>, I get this error:<br></p> <p>Fatal error: Uncaught exception “Exception” with message “DBusObject::_call(): org.freedesktop.NetworkManagerSettings.System.NotPrivileged: Insufficient privileges.”<br></p> <p>I have added the www-data user to /etc/dbus-1/system.d/NetworkManager.conf and giving him the same rights as root<br></p> <pre><code>&lt;policy user=”www-data”&gt; &lt;allow own=”org.freedesktop.NetworkManager”/&gt; &lt;allow own=”org.freedesktop.NetwoekManagerSystemSettings”/&gt; &lt;allow own=”org.freedesktop.NetworkManagerSettings”/&gt; &lt;allow own=”org.freedesktop.NetworkManagerSettings.System”/&gt; &lt;allow send_destinations=”org.freedesktop.NetworkManager”/&gt; &lt;allow send_destinations=”org.freedesktop.NetworkManagerSystemSettings”/&gt; &lt;allow send_destinations=”org.freedesktop.NetworkManagerSettings”/&gt; &lt;allow send_destinations=”org.freedesktop.NetworkManagerSettings.System”/&gt; &lt;allow send_destinations=”org.freedesktop.NetworkManager” send_interface=”org.freedesktop.NetworkManager.PPP”/&gt; &lt;/policy&gt; </code></pre> <p>, but it does not change anything. I have also added www-data to the root and netdev group, but that did not help either.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload