PolkitAgentTextListener from a Python script
Stuart Longland
stuartl at vrt.com.au
Wed Aug 27 18:20:02 PDT 2014
Hi all,
I'm in the process of writing a Django (Python) module for configuring
NetworkManager, this is aimed at small headless appliances that provide
a web UI for various configuration tasks.
I've managed to write a suitable wrapper around NetworkManager, and so
far it works, if I run the Django test server instance in a shell
session, I can configure network connections. Things are a little
clunky, but it's workable.
Except, when I try and run the module within Apache under mod_wsgi,
accessing privileged commands yields the response:
org.freedesktop.NetworkManager.Settings.PermissionDenied: No session
found for uid 33 (unknown)
Now as I understand it, NetworkManager checks with PolKit to see if I
have a valid session. It works when I run my program in a shell session
since it piggy backs off my desktop, but Apache does not have such a
luxury. Hence the error.
I can configure Apache to run as root, but that's distasteful in many
ways even on an appliance.
My research into this has suggested I need to make use of the
PolkitAgentTextListener:
http://www.freedesktop.org/software/polkit/docs/0.105/PolkitAgentTextListener.html
How do I access this object via DBus?
Regards,
--
Stuart Longland
Systems Engineer
_ ___
\ /|_) | T: +61 7 3535 9619
\/ | \ | 38b Douglas Street F: +61 7 3535 9699
SYSTEMS Milton QLD 4064 http://www.vrt.com.au
More information about the polkit-devel
mailing list