You are not logged in.

#1 2013-03-05 13:23:49

stupidus
Member
Registered: 2012-02-27
Posts: 124

Polkit permissions for packagekit

Hello,

I have a question regarding polkit permissions. In my special case it's about packagekit, but I think it is a general problem with my understanding of this subject.

The specific problem is the following: I use packagekit with apper in KDE to update my system. By default, I can do this without having to provide any password. But I don't like this behaviour. I would prefer having to authenticate as root to update packages.

Now I understand I have to use polkit rules to change this. The arch wiki article on polkit says that it is a bad thing to change it directly in /usr/share/polkit-1/actions.
Considering that these files might be overwritten in an update of polkit and that they are impossible to read xml files, I totally understand that.

As an alternative the wiki article suggests to use .pkla files in /etc/polkit-1/localauthority/50-local.d
So I tried that (I had to create the folders localauthority and 50-local.d, though) and created the file /etc/polkit-1/localauthority/50-local.d/org.freedesktop.packagekit.pkla

Identity=unix-group:users
Action=org.freedesktop.packagekit.system-update
ResultAny=no
ResultInactive=no
ResultActive=auth_admin_keep

The way I understand polkit, this should do the trick. Unfortunately, it does not change anything. I can still update packages without a password.

Does anyone know where I did a mistake or how I can solve this problem?

Offline

#2 2013-03-05 13:41:24

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Polkit permissions for packagekit

This rule doesn't work with the latest polkit version because the rule configuration has been changed. You now have to write polkit rules with JavaScript (yes, seriously, JavaScript).
The polkit man page should have all the information you need, including examples:

man polkit

Offline

#3 2013-03-05 14:48:10

stupidus
Member
Registered: 2012-02-27
Posts: 124

Re: Polkit permissions for packagekit

What the frell? Are the developers of polkit completely out of their mind? Do they really expect users to learn Javascript?
This makes it really hard for normal users to change the rules, if they are not programmers.

Anyway, I think I managed to get it done:

 polkit.addRule(function(action, subject) {
               if (action.id == "org.freedesktop.packagekit.system-update" &&
                   subject.isInGroup("users")) {
                   return polkit.Result.AUTH_ADMIN_KEEP;
               }
           });

I hope this does not do anything that might compromise the security of my system.

Offline

Board footer

Powered by FluxBB