Re: Accessing NetworkManager from a daemon



On Wed, 2014-08-27 at 16:40 +1000, Stuart Longland wrote:
Hi all,
On 25/08/14 13:36, Stuart Longland wrote:
Today I thought I'd roll this into my company's administration panel
software which is built on Django and runs within Apache under mod_wsgi.

When I try to get the settings of an existing connection (via
GetSettings), I get the following:

org.freedesktop.NetworkManager.Settings.PermissionDenied: No session
found for uid 33 (unknown)

I've heard nothing, so I can only assume I haven't provided some detail.
 Sadly, searching for the above error leads me right back to this post,
thanks to the wonder that is the dreaded Google echo.

My code is based on the python-dbus examples and is running under the
Apache www-data user.  Calling GetSettings on a settings object seems to
trigger this.

The following are the package versions I am using:
stuartl sjl-lxc-debian:~$ dpkg -l python-dbus
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
+++-=======================-================-================-===================================================
ii  python-dbus             1.2.0-2+b3       i386             simple interprocess messaging system 
(Python interf
stuartl sjl-lxc-debian:~$ dpkg -l network-manager
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
+++-=======================-================-================-===================================================
ii  network-manager         0.9.10.0-1.1     i386             network management framework (daemon and 
userspace 

The error message in my previous post, is what I get told.  Research
seems to suggest it's a polkit issue, in that the www-data user doesn't
appear as a logged-in user.


This is not a question for polkit, but for session tracking.

You can workaround this by configuring NM with
  --with-session-tracking=no

I don't know how to achieve this without recompiling NM, I think
it should be possible too(?). Let's see what dcbw has to say about it
(put him on CC).



This is going to be a headless appliance, there will be *no* "logged in"
user in the traditional sense, rather someone will be logging in via a
web UI to change settings, including the network configuration.

Thus, I need to either disable the polkit integration, or convince it
that it's okay for www-data to talk to NetworkManager.

Is there someone who can provide some pointers as to where to go or
shall I have to dump NetworkManager for something else?

Regards,


Thomas

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]