Bug 804376

Summary: polkit-default-privs doesn't seem to work anymore (localauthority backend gone)
Product: [openSUSE] openSUSE 12.3 Reporter: Ralf Haferkamp <ralf>
Component: OtherAssignee: Marcus Meissner <meissner>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Critical    
Priority: P1 - Urgent CC: coolo, forgotten_DV81ZEWZkN, lnussel, mcatanzaro, meissner, one, wstephenson
Version: RC 1Flags: coolo: SHIP_STOPPER+
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 831400    

Description Ralf Haferkamp 2013-02-19 09:03:53 UTC
On my 12.3RC1 system (upgraded from 12.2) I have the following line to /etc/polkit-default-privs.local:

org.libvirt.unix.manage                                         yes

But even after running set_polkit_default_privs I still get prompted to enter the root password to authorize for exactly that action (org.libvirt.unix.manage). E.g. when connecting to the local running libvirtd via virsh (as a normal user):

virsh -c qemu:///system
Comment 1 Marcus Meissner 2013-02-20 07:57:14 UTC
can you give the content of 
/var/lib/polkit-1/localauthority/10-vendor.d/org.libvirt.unix.manage* ?
Comment 2 Ralf Haferkamp 2013-02-20 09:36:28 UTC
Here you are:

# l /var/lib/polkit-1/localauthority/10-vendor.d/org.libvirt.unix.manage*
-rw-r--r-- 1 root root 129 Feb 18 13:52 /var/lib/polkit-1/localauthority/10-vendor.d/org.libvirt.unix.manage.pkla

# cat  /var/lib/polkit-1/localauthority/10-vendor.d/org.libvirt.unix.manage.pkla
[org.libvirt.unix.manage]
Identity=unix-group:*
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
Comment 3 Marcus Meissner 2013-02-20 22:06:18 UTC
the whole localauthority backend (that we use here) got thrown away during devcelopment  and we failed to notice

helpful hint now "you can just implement this in JavaScript".


Will see that I can do this in the next days. :(
Comment 4 Ludwig Nussel 2013-02-21 08:15:55 UTC
there are two ways, either generate the javascript code from set_polkit_default_privs or write javascript code that parses the files itself. I guess the latter is harder but would be more correct.
Comment 5 Ludwig Nussel 2013-02-21 08:33:35 UTC
hmm, or patch src/polkitbackend/polkitbackendjsauthority.c polkit_backend_js_authority_check_authorization_sync()
Comment 6 Ludwig Nussel 2013-02-21 14:20:55 UTC
Settings overwritten that were not enforced in last betas:

de.berlios.smb4k.mounthelper.mount                              yes -> auth_admin_keep
de.berlios.smb4k.mounthelper.unmount                            yes -> auth_admin_keep
org.freedesktop.consolekit.system.stop-multiple-users           auth_admin_keep -> yes
org.freedesktop.consolekit.system.restart-multiple-users        auth_admin_keep -> yes
org.freedesktop.login1.inhibit-block-shutdown                   yes -> auth_admin_keep
org.freedesktop.login1.inhibit-delay-shutdown                   yes -> auth_admin_keep
org.freedesktop.login1.inhibit-block-sleep                      yes -> auth_admin_keep
org.freedesktop.login1.inhibit-delay-sleep                      yes -> auth_admin_keep
org.freedesktop.login1.inhibit-block-idle                       yes -> auth_admin_keep
org.freedesktop.login1.inhibit-handle-power-key                 yes -> auth_admin_keep
org.freedesktop.login1.inhibit-handle-suspend-key               yes -> auth_admin_keep
org.freedesktop.login1.inhibit-handle-hibernate-key             yes -> auth_admin_keep
org.freedesktop.login1.inhibit-handle-lid-switch                yes -> auth_admin_keep
org.freedesktop.login1.power-off-multiple-sessions              auth_admin_keep -> yes
org.freedesktop.login1.reboot-multiple-sessions                 auth_admin_keep -> yes
org.freedesktop.ModemManager.Device.Control                     auth_self_keep -> yes
org.freedesktop.ModemManager.USSD                               yes -> auth_admin
org.freedesktop.NetworkManager.sleep-wake                       no -> yes
org.freedesktop.NetworkManager.wifi.share.protected             yes -> auth_admin
org.freedesktop.NetworkManager.wifi.share.open                  yes -> auth_admin
org.freedesktop.packagekit.system-network-proxy-configure       yes -> auth_admin_keep
org.freedesktop.timedate1.set-timezone                          auth_admin_keep -> yes
org.freedesktop.udisks2.rescan                                  yes -> auth_admin_keep
org.freedesktop.udisks2.ata-check-power                         yes -> auth_admin_keep
org.freedesktop.udisks2.ata-standby                             yes -> auth_admin_keep
org.freedesktop.udisks2.cancel-job                              yes -> auth_admin_keep
org.opensuse.cupspkhelper.mechanism.job-edit                    yes -> auth_admin_keep
Comment 7 Stephan Kulow 2013-02-21 14:34:49 UTC
especially the login1 and udisk2 we can't start testing with RC2 ;(
Comment 8 Ludwig Nussel 2013-02-21 15:54:24 UTC
I've hacked generating js code into chkstat-polkit. Needs some testing of course. I did not modify the privileges (except for some mistakes in .restrictive).
Comment 9 Bernhard Wiedemann 2013-02-21 16:00:09 UTC
This is an autogenerated message for OBS integration:
This bug (804376) was mentioned in
https://build.opensuse.org/request/show/155990 Factory / polkit-default-privs
Comment 10 Bernhard Wiedemann 2013-02-22 09:00:21 UTC
This is an autogenerated message for OBS integration:
This bug (804376) was mentioned in
https://build.opensuse.org/request/show/156059 Factory / polkit-default-privs
https://build.opensuse.org/request/show/156061 Factory / polkit-default-privs
Comment 11 Michael Catanzaro 2013-02-26 16:00:45 UTC
*** Bug 796059 has been marked as a duplicate of this bug. ***
Comment 12 Ludwig Nussel 2013-02-27 10:38:35 UTC
as discussed in IRC and off-line I've submitted a polkit-default-privs that sets the inhibit rules to upstream defaults. I've also added a requirement to libmozjs as otherwise polkit wont actually apply the policy.
Comment 13 Bernhard Wiedemann 2013-02-27 11:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (804376) was mentioned in
https://build.opensuse.org/request/show/156660 Factory / polkit-default-privs
https://build.opensuse.org/request/show/156661 Maintenance /
Comment 14 Bernhard Wiedemann 2013-02-27 16:00:36 UTC
This is an autogenerated message for OBS integration:
This bug (804376) was mentioned in
https://build.opensuse.org/request/show/156711 Factory / polkit-default-privs
https://build.opensuse.org/request/show/156712 Maintenance /
Comment 15 Swamp Workflow Management 2013-02-28 17:27:37 UTC
openSUSE-RU-2013:0366-1: An update that has one recommended fix can now be installed.

Category: recommended (low)
Bug References: 804376
CVE References: 
Sources used:
openSUSE 12.3 (src):    polkit-default-privs-12.3-6.11.1
Comment 16 Michael Catanzaro 2013-05-12 13:55:16 UTC
Helpfully coming at us a couple of months late: 

http://lists.fedoraproject.org/pipermail/devel/2013-May/182579.html

https://git.fedorahosted.org/cgit/polkit-pkla-compat.git/
Comment 17 Forgotten User DV81ZEWZkN 2013-07-22 23:19:09 UTC
Do we need another report for Factory?

E.g.
/etc/polkit-1/rules-d/90-default-privs:
'org.freedesktop.login1.suspend':
	[ 'auth_admin', 'auth_admin', 'auth_admin' ],


Both suspending within KDE session and
qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend true
does *not* ask for password:

pkaction --action-id org.freedesktop.login1.suspend --verbose
org.freedesktop.login1.suspend:
  description:       Suspend the system
  message:           Authentication is required for suspending the system.
  vendor:            The systemd Project
  vendor_url:        http://www.freedesktop.org/wiki/Software/systemd
  icon:              
  implicit any:      auth_admin_keep
  implicit inactive: auth_admin_keep
  implicit active:   yes
Comment 18 Marcus Meissner 2013-07-23 08:22:42 UTC
rpm -qf /etc/polkit-1/rules-d/90-default-privs

is this your own file?
Comment 19 Forgotten User DV81ZEWZkN 2013-07-23 11:35:18 UTC
(In reply to comment #18)
> rpm -qf /etc/polkit-1/rules-d/90-default-privs
rpm -qf /etc/polkit-1/rules.d/90-default-privs.rules 
polkit-default-privs-13.1-192.2.noarch

i | polkit-default-privs | package | 13.1-192.2 | noarch | Base_System

> is this your own file?
Not sure i understand the question :-)
I've tried both changing polkit-default-privs.standard and adding auth_admin to polkit-default-privs.local, with the same result...
Comment 20 Marcus Meissner 2013-07-23 11:50:30 UTC
hmm, it should get evaluated... perhaps we again miss the javascript library...

can you run:


rpm -qa|grep mozjs
Comment 21 Forgotten User DV81ZEWZkN 2013-07-23 11:57:13 UTC
Sure, i have both:
libmozjs185-1_0-1.8.5-3.53.x86_64
libmozjs-17_0-17.0-2.4.x86_64
Comment 22 Michele Cherici 2014-03-13 18:22:34 UTC
I use opensuse 13.1 and here set_polkit_default_privs doesn't work.
I've added the following line to /etc/polkit-default-privs.local

org.freedesktop.udisks2.filesystem-mount auth_admin:auth_admin:yes

but after executing set_polkit_default_privs I have the following result from pkaction command:

pkaction --action-id org.freedesktop.udisks2.filesystem-mount-system --verbose

org.freedesktop.udisks2.filesystem-mount-system:
  description:       Mount a filesystem on a system device
  message:           Authentication is required to mount the filesystem
  vendor:            The udisks Project
  vendor_url:        http://udisks.freedesktop.org/
  icon:              drive-removable-media
  implicit any:      auth_admin
  implicit inactive: auth_admin
  implicit active:   auth_admin_keep


I think the bug should be reopened or a new bug should be filed for 13.1
Comment 23 Michele Cherici 2014-03-14 08:57:10 UTC
I've done a cut and paste error, the line in /etc/polkit-default-privs.local is:

org.freedesktop.udisks2.filesystem-mount-system auth_admin:auth_admin:yes
Comment 24 Michele Cherici 2014-03-14 09:26:32 UTC
After more investigation the changes done to /etc/polkit-default-privs.local are correctly applied to the system (after executing set_polkit_default_privs) but pkaction shows the wrong permissions.
This is a bug in pkaction or I've misunderstood pkaction's behavior?
Comment 25 Marcus Meissner 2014-03-14 09:32:11 UTC
it is actually a design issue I think.

as far as I remember, pkaction does not evaluate the javascript polkit rules, these are only applied once you actually try to do the action.
Comment 26 Michele Cherici 2014-03-14 10:05:15 UTC
Thanks for your reply.
Unfortunately this makes pkaction useless, I hope polkit developers will correct this bug.