Software/PolicyKit/PluggableArchitecture

Software/PolicyKit/PluggableArchitecture

Pluggable Architecture for PolicyKit

Overview

   +--------------+
   |     App1     |
   +--------------+
   | libpolkit.so |<---------------+
   +--------------+                |
                                   |
   +--------------+                V
   |     App2     |         +------------+      +-----------------+
   +--------------+    |--->| System Bus |<---->| polkit-backendd |
   | libpolkit.so |<---|    +------------+      +-----------------+
   +--------------+              ^              | pk-backend-1.so |
                                 |              | ...             |
   +--------------+              |              +-----------------+
   |     App3     |              |
   +--------------+              |
   | libpolkit.so |<--------------
   +--------------+

        ....

High-level Architecture

Tasks

  1. Create the new polkit-backendd daemon
    • Decide on the D-BUS interface
    • Implement it and use d-feet and/or dbus-send to test it
    • Rev where authorizations are stored; probably won't need a polkit user+group anymore as polkit-backendd will simply run as root
    • Can take advantage of the daemon used by Avahi
  2. Port the current (local file) backend over to this daemon
    • Replace backend in libpolkit with D-BUS calls to call into org.freedesktop.PolicyKit.BackendPrivate

      • Can't use dbus-glib.so
      • Rely on libdbus.so (painful, but only needs to be done once)
      • libpolkit.so will grow a libdbus.so dependency
        • libpolkit and libpolkit-dbus can be merged on next API rev
      • May require revving the public API to get better mainloop integration
        • Only really needed for async notifications, so may be able to punt this for a bit
        • Just use sync calls initially

Other Details

Plug-in ABI

Enable=1 or 0
Priority (0 lowest) specifying what order to check authorization. E.g. localfiles would probably have priorty 0, freeIPA would have something higher.
Module=/lib/PolicyKitPlugins/libpk_localfiles.so (location/names TBD)
ModuleParameters= (optional parameters to change module behavior)

The plugin architecture will need to support, at minimum, the following interfaces:
get_name()
get_version(): version the ABI to ensure backwards-compatibility in the future
get_priority(): the plugin should be able to specify its default priority, which can be overridden by the config file, as described above
get_funcs(): Get a list of function pointers supported by the plugin.