Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 437914 - app-emulation/libvirt with latest sys-auth/polkit and the problem of converting XML .pkla rules to JS .rules file(s)
Summary: app-emulation/libvirt with latest sys-auth/polkit and the problem of converti...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Doug Goldstein (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-11 01:13 UTC by lsching17
Modified: 2012-10-18 17:47 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
xfce4.10 session autostart (session_autostart.png,66.87 KB, image/png)
2012-10-11 01:14 UTC, lsching17
Details
authenication_dialog (auth.png,22.66 KB, image/png)
2012-10-11 01:15 UTC, lsching17
Details
libvirt policy (org.libvirt.unix.policy,1.58 KB, text/plain)
2012-10-11 01:15 UTC, lsching17
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lsching17 2012-10-11 01:13:21 UTC
$ emerge --info libvirt polkit consolekit
Portage 2.1.11.9 (default/linux/amd64/10.0/desktop, gcc-4.6.3, glibc-2.15-r2, 3.5.5-custom x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.5.5-custom-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.1
Timestamp of tree: Wed, 10 Oct 2012 00:45:01 +0000
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.7-r5
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.5 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fuse-linker-plugin -march=native -ftree-vectorize"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -fuse-linker-plugin -march=native -ftree-vectorize"
DISTDIR="/custom/tmp/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parallel-install parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.aditsu.net"
LANG="en_HK.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j16"
PKGDIR="/custom/tmp/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/custom/tmp/portage/tmp"
PORTDIR="/custom/tmp/portage/tree"
PORTDIR_OVERLAY=""
SYNC=""
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 berkdb bluetooth bzip2 cairo caps cdda cdr cjk cli consolekit cracklib crypt cups custom-optimization cxx dbus dga dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif gnutls gpm gtk iconv ipv6 jpeg lcms ldap libnotify lzma lzo mad mmx mmxext mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl ogg openal opengl openmp pam pango pcre pdf png policykit ppds pppd qt3support qt4 readline sasl sdl session smp spell sse sse2 sse3 ssl ssse3 startup-notification svg tcl tcpd threads tiff truetype udev udisks unicode upower usb vdpau vorbis wifi wxwidgets x264 xattr xcb xft xml xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="intel r600 radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

app-emulation/libvirt-0.10.2-r1 was built with the following:
USE="caps libvirtd lxc macvtap (multilib) nls policykit python qemu sasl udev vepa -audit -avahi -debug -iscsi -lvm -nfs -numa -openvz -parted -pcap -phyp -rbd (-selinux) -uml -virt-network -virtualbox -xen"


sys-auth/polkit-0.107-r1 was built with the following:
USE="gtk introspection (multilib) nls pam -examples -kde (-selinux) (-systemd)"


sys-auth/consolekit-0.4.5_p20120320-r1 was built with the following:
USE="acl (multilib) pam policykit -debug -doc (-selinux) -test"



Reproducible: Always

Steps to Reproduce:
I use virsh (libvirt) to connect to qemu

$ virsh --connect qemu:///system start Windows
error: authentication failed: polkit\56retains_authorization_after_challenge=1
Authorization requires authentication but no agent is available.

error: failed to connect to the hypervisor

But i check that the polkit agent is in the xfce4.10 session startup dialog (screenshot)

So i start the polkit agent manually in another xfce terminal

/usr/libexec/polkit-gnome-authentication-agent-1

Then i connect to qemu again

$ virsh --connect qemu:///system start Windows

This times it requires me to support root password (see screenshot)

However, I have already placed the following config in /etc/polkit-1/localauthority/50-local.d, and i expect that i do not need to supply password for this

[libvirt-manage]
Identity=unix-group:zusers
Action=org.libvirt.unix.manage
ResultAny=no
ResultInactive=no
ResultActive=yes

P.S. there is no member in wheel group and i am in the zusers group.




The problem is fixed after downgrade polkit-0.104-r1

This version of polkit is a crap. Please do not mark it stable.
Comment 1 lsching17 2012-10-11 01:14:25 UTC
Created attachment 326246 [details]
xfce4.10 session autostart
Comment 2 lsching17 2012-10-11 01:15:05 UTC
Created attachment 326248 [details]
authenication_dialog
Comment 3 lsching17 2012-10-11 01:15:56 UTC
Created attachment 326250 [details]
libvirt policy
Comment 4 Jens Kleikamp 2012-10-11 09:27:24 UTC
See this commit: http://cgit.freedesktop.org/polkit/commit/?id=8dc28b8939f4e02a6de69d50fa3509e33f64335e

"This is polkit 0.106. There's a major change in this release which is a switch from .pkla files (keyfile-format) to .rules files (JavaScript)"

A new javascript rule like this may work for you:

polkit.addRule(function(action, subject) {
    if (action.id == "org.libvirt.unix.manage" &&
        subject.isInGroup("zusers")) {
        return "yes";
    }
});

placed in: /usr/share/polkit-1/rules.d/99-authfoo.rules
Comment 5 lsching17 2012-10-11 23:52:09 UTC
Soory to misjudeg this version as a crap.

But i am unware of this fundamental change, and the "man pklocalauthority" is outdated.

Is the "/etc/polkit-1/localauthority" folder obsolete?
Comment 6 Jens Kleikamp 2012-10-14 16:57:53 UTC
(In reply to comment #5)
> Is the "/etc/polkit-1/localauthority" folder obsolete?

I don´t have any further information on this, for me that old path doesn´t work anymore.
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2012-10-15 13:41:27 UTC
/etc/polkit-1/localauthority/50-local.d is obsolete and the .pkla files with it,
and replaced by JavaScript based rules in /etc/polkit-1/rules.d/99-foobar.rules

I don't see how this is a polkit bug, since the change was done it purpose, so moving to libvirt maintainers: See how .pkla are converted to .rules in net-misc/networkmanager and net-misc/modemmanager ebuilds in Portage if you need an example. "man polkit" will also tell how the .rules files work.
Comment 8 Doug Goldstein (RETIRED) gentoo-dev 2012-10-15 14:11:36 UTC
(In reply to comment #7)
> /etc/polkit-1/localauthority/50-local.d is obsolete and the .pkla files with
> it,
> and replaced by JavaScript based rules in
> /etc/polkit-1/rules.d/99-foobar.rules
> 
> I don't see how this is a polkit bug, since the change was done it purpose,
> so moving to libvirt maintainers: See how .pkla are converted to .rules in
> net-misc/networkmanager and net-misc/modemmanager ebuilds in Portage if you
> need an example. "man polkit" will also tell how the .rules files work.

So basically we bumped polkit which uses completely incompatible files and didn't put blockers in all the users of polkit? So now I need to put blockers for !>=polkit-0.106 in all existing versions of libvirt and make a new ebuild for one that supports the newer files?

Ah more David Z crappy software and design changes.
Comment 9 lsching17 2012-10-15 23:37:15 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > /etc/polkit-1/localauthority/50-local.d is obsolete and the .pkla files with
> > it,
> > and replaced by JavaScript based rules in
> > /etc/polkit-1/rules.d/99-foobar.rules
> > 
> > I don't see how this is a polkit bug, since the change was done it purpose,
> > so moving to libvirt maintainers: See how .pkla are converted to .rules in
> > net-misc/networkmanager and net-misc/modemmanager ebuilds in Portage if you
> > need an example. "man polkit" will also tell how the .rules files work.
> 
> So basically we bumped polkit which uses completely incompatible files and
> didn't put blockers in all the users of polkit? So now I need to put
> blockers for !>=polkit-0.106 in all existing versions of libvirt and make a
> new ebuild for one that supports the newer files?
> 
> Ah more David Z crappy software and design changes.

oh, there is no need for blocking >=polkit-0.106

It seems that the polkit "actions" file of libvirt is still functioning

my libvirt works after placing a new "rule" file in /usr/share/polkit-1/rules.d/, although i still need to launch the polkit agent manually sometimes.
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2012-10-18 17:47:54 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > /etc/polkit-1/localauthority/50-local.d is obsolete and the .pkla files with
> > > it,
> > > and replaced by JavaScript based rules in
> > > /etc/polkit-1/rules.d/99-foobar.rules
> > > 
> > > I don't see how this is a polkit bug, since the change was done it purpose,
> > > so moving to libvirt maintainers: See how .pkla are converted to .rules in
> > > net-misc/networkmanager and net-misc/modemmanager ebuilds in Portage if you
> > > need an example. "man polkit" will also tell how the .rules files work.
> > 
> > So basically we bumped polkit which uses completely incompatible files and
> > didn't put blockers in all the users of polkit? So now I need to put
> > blockers for !>=polkit-0.106 in all existing versions of libvirt and make a
> > new ebuild for one that supports the newer files?
> > 
> > Ah more David Z crappy software and design changes.
> 
> oh, there is no need for blocking >=polkit-0.106
> 
> It seems that the polkit "actions" file of libvirt is still functioning
> 
> my libvirt works after placing a new "rule" file in
> /usr/share/polkit-1/rules.d/, although i still need to launch the polkit
> agent manually sometimes.

almost correct but...

nonono, use /etc/polkit-1/rules.d/ to override /usr instead. there is no CONFIG_PROTECT for anything in /usr/share/polkit-1/