Last year, I wrote about beginning to learn Python, and a utility I was writing back then called PolicyKit Editor.
I was using the Gtk toolkit at that time, and then there’s been a bit of a hiatus because I moved from Japan to Scotland.
I recently decided to have a look at that program again, and decided to change from Gtk to the Qt toolkit.
After a week or so of learning how Qt4 and Python fit together, and coding, I have produced Polkit Explorer.
What is it?
Polkit Explorer allows a user to view the default Polkit system policies as set by any package which makes use of Polkit (older name PolicyKit) for user permissions to perform tasks.
Why is it?
I wrote it because;
- I wanted to learn Python,
- Wading through the raw XML for each policy is an awful, awful thing,
- It’s handy to see what default permissions your system has for certain tasks.
Polkit? PolicyKit?
See here : http://scarygliders.net/2012/06/20/a-brief-guide-to-policykit/
Basically, my program turns this:
Into this :
Obtaining the program
You can obtain it from the repository at GitHub…
git clone git://github.com/scarygliders/Polkit-Explorer.git PolkitEditor
You can download it as a zip file from GitHub at https://github.com/scarygliders/Polkit-Explorer
Read the README.md file.
If it’s useful to you please consider sending a donation.
Polkit Explorer v1.0 Released,Feedback is welcome.
Great little tool! Been using it all morning. A lot easier than scrolling through .XML files. Thanks again!
Got it to run on OpenSUSE 12.1 x64 after I got the python-lxml package.
Thanks for the feedback – nice to see it also running on non-Debian distros, as it should ;)
I’ve updated the README.md file for clarity, and added python-lxml in the list of requirements.
Regards!
FYI to edit polkit-1 in OpenSUSE is a lot different than Debian-based distros
http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/478534-policykit-settings-dont-stick.html
Good question. My experience has been that the graphical tool does not work, or at least not with network manager related policies I’ve tried to alter recently. When I get time, I’d like to investigate this further.
One method is to set the policies in /etc/polkit-default-privs.local
For example, suppose you have a policy ‘org.freedesktop.udisks.filesystem-mount’, with the following implicit privileges
Code:
org.freedesktop.udisks.filesystem-mount:
description: Mount a device
message: Authentication is required to mount the device
vendor: The udisks Project
vendor_url: http://udisks.freedesktop.org/
icon: drive-removable-media
implicit any: no
implicit inactive: no
implicit active: yes
You might want root authentication to mount removable media. So, you could add a line to /etc/polkit-default-privs.local like this
Code:
org.freedesktop.udisks.filesystem-mount no:no:auth_admin
To apply any changes made here, you then run (as root)
Code:
set_polkit_default_privs
Good comments…
My next project will expand upon Polkit Explorer, and will allow you to create custom policies as .pkla files which will override the defaults.
Regards
Kev.
[…] Polkit Explorer v1.0 Released […]