Skip to content

PolKit support, the proper way

Jan Blackquill requested to merge work/janb/auth-daemon into master

This commit introduces PolKit support to KIO on UNIX-likes, cleaning up previous efforts to attempt to do so.

This uses a new daemon that communicates using D-Bus directly, instead of relying on an extra abstraction layer. This allows us to take advantage of Qt D-Bus's code generation for more type safety instead of stuffing stuff to and from QVariants over the wire. We can also pass file descriptors using DBus directly, removing the need for a buggy and overcomplicated side channel to transfer them.

Setup

If you're building from a dev setup, there are a few things you will likely have to do.

Copying The Files

PolKit Policy

From the source directory, copy the following file:

/src/ioslaves/file/auth-daemon/org.kde.kio.filemanagement.policy -> copy to /usr/share/polkit-1/actions/

systemctl restart polkit afterwards.

DBus

You only need to copy the following files if your DBus isn't set up to read from your install dir. If you want, you can configure DBus to do so:

Don't Copy Method

/etc/dbus-1/system.d/kde.conf

<busconfig>
    <servicedir>/kde-usr/share/dbus-1/services/</servicedir>
    <servicedir>/kde-usr/share/dbus-1/system-services/</servicedir>
    <includedir>/kde-usr/share/dbus-1/system.d/</includedir>
    <includedir>/kde-usr/share/dbus-1/interfaces/</includedir>
</busconfig>

Change /kde-usr to reflect your install dirs.

Otherwise, you're going to need to copy the DBus configuration files to the appropriate system directories.

Do copy method

From the build directory, copy the following file:

src/ioslaves/file/auth-daemon/org.kde.kio.filemanagement.service -> copy to /etc/dbus-1/system-services/

From the source directory, copy the following file:

/src/ioslaves/file/auth-daemon/org.kde.kio.filemanagement.conf -> copy to /etc/dbus-1/system.d/

systemctl reload dbus after making the appropriate changes for your system and DBus should be fine to go.

Distro Security Quirks

If your distro ships with a security policy that forbids DBus from launching user-owned files as root, you can execute the root helper manually while testing: sudo ./bin/kio_root_helper in the build directory.

Restart Your Daemons And Apps

kdeinit5 and restart Dolphin or your preferred KIO consumer. Try doing stuff as root.

Edited by Jan Blackquill

Merge request reports

Loading