PolkitAgentTextListener from a Python script

Stuart Longland stuartl at vrt.com.au
Fri Aug 29 04:42:36 PDT 2014


Hi all,
On 28/08/14 11:20, Stuart Longland wrote:
> 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?

Still tinkering with this.  I note the documentation makes reference to
pkttyagent, which I've attempted to launch via Python's pty and
subprocess modules.  No such luck it seems, as it *demands* a tty, and I
haven't yet been able to fool it.

gi.repository.PolkitAgent seems to have some tidbits I can reach from
Python, but even there, there doesn't seem to be an awful lot of
documentation on how to call those functions to achieve what I'm after.

Basically it looks as if I need to spoof a Polkit agent in order to
permit an unprivileged process (Apache, running as www-data) to make
requests to a privileged process (NetworkManager) via dbus.

All documentation I have read to date, seems to assume I am writing a
server daemon that needs to check up on a user's session.  Is there a
good guide on how to write a suitable agent for this headless service?
-- 
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