
A few weeks back I posted some prototype patches for PolicyKit support to allow the main libvirt daemon socket to be made world-accessible. PolicyKit then can do ACLs on incoming connections, allowing definition of rules which could for example, allow only the user who owns the active X login sesion http://www.redhat.com/archives/libvir-list/2007-August/msg00027.html This is an updated patch which takes account of a change in the PolicyKit XML file syntax between 0.4 and 0.5 releases. The configure.in scripts has been tweaked to automatically disable PolicyKit if pkg-config is not available instead of aborting. The code for getting UNIX socket credentials has been factored out into its own method. There is still only a Linux implementation. I was going to take the code for other OS from DBus, but DBus is currently under a GPL/Academic license options, which is not compatible with LGPL. Fortunately DBus is in middle of re-licensing to X11 style which is LGPL compatible, so in a week or so's time we'll be able to safely take their OS portability code for socket credentials. I short-circuit the logic to always allow root. This allows existing people running libvirt tools as root to continue use without any regressions. There is one small issue still that the default policy I provide only allows the use of read-only connections if the user is logged into to the desktop. This is a partial regression - the admin can edit /etc/PolicyKit/PolicyKit.conf and add a site-local rule allowing all users access, regardless of whether they're in a session. I've spoken with David Zeuthan and he's going to add ability to specify rules for non-session clients in the default policy config files, which will fix this minor regression. Once this is done the libvirt default policy will be identical to current file permission based policy (root == full access, non-root == read only). As I mentioned previously, with this change it is now possible to open a full read-write connection from virt-manager running as non-root. Depending on site policy it will optionally prompt for root password (su style equiv) or the user's password (sudo style equiv) without needing virt-manager itself to gain any elevated privileges. When compiling with PolicyKit support, the default file permissions for both the main & readonly UNIX sockets in the daemon switch to 0777, instead of the previous 0700 & 0777. It is possible to turn off PolicyKit auth in the daemon config file, even if it is compiled in - in which case the default permissions get set back to 0700 & 0777. Although in previous feedback Daniel suggested I leave the LIBVIRTD_AUTH_POLKIT constant compiled in all the time, I feel it is better to remove it when the policykit support is disabled in configure. This removes the need to have extra switch/case statements to explicitly reject LIBVIRTD_AUTH_POLKIT auth, since it will be handle by the 'default:' statement which already has code to reject connections. I've done more extensive testing with virt-manager since my previous patch, and its working very nicely with the new UI which allows multiple hypervisor connections. Instead of asking for the root password up-front at app start time, we now only need ask for it if the user connects to a local HV. If they only ever manage remote connections we don't need to do anything with the local root password. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|