Creating a polkit authentication agent

Miloslav Trmač mitr at redhat.com
Mon Sep 30 11:40:46 PDT 2013


Hello, 
----- Original Message ----- 
> What I'm trying to do is register a polkit authentication agent in a python
> script, through the dbus api. I have attached, a rather simplistic, first
> start of this. From what I can read out of the logs it seems to register
> alright but nothing is relayed to it for authentication.

> First question is that it seems like RegisterAuthenticationAgent takes a few
> different subject kinds . unix-process and unix-session. What is the
> difference between these and what should I be using?

You can register more than one agent; each agent is only called for those subject they register for.  unix-process is obviously limited to that single process.  So if you want to register for all processes running within the session / within the appliance UI, unix-session is more appropriate.

> When registering I submit my object path, which is '/org/xbmc/polkit' but
> what is the destination for this object? I'm using 'org.xbmc.polkit' for my
> service, but how does polkit knows this?

An agent can only register itself; polkit uses the identity of the caller of the RegisterAuthenticationAgent operation (technically using the :number unique identifier).  I don't think it's necessary to register a well-known-name.

> Could this be why its not called to
> authenticate even if register went through alright?

These two lines seem rather suspect:
>    'session-id': getSessionID(),
>    'session_id': ""

Other than that, if there are no error messages returned through the D-Bus API, I can suggest only running polkitd without --no-debug and capturing the output, and attaching a debugger to polkitd.
    Mirek


More information about the polkit-devel mailing list