]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Add support for text based polkit authentication
authorJohn Ferlan <jferlan@redhat.com>
Tue, 9 Feb 2016 19:08:42 +0000 (14:08 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 1 Mar 2016 11:50:16 +0000 (06:50 -0500)
commitea48397b016683933104c5ce059a33443a79cdbb
tree37edcb8f20af504dd367c40e10fe9e4f539717bc
parent6fb96a7f8b2f4b0c488e340628a5b8f49382f9c2
virsh: Add support for text based polkit authentication

https://bugzilla.redhat.com/show_bug.cgi?id=872166

When the login session doesn't have an ssh -X type display agent in
order for libvirtd to run the polkit session authentication, attempts
to run 'virsh -c qemu:///system list' from an unauthorized user (or one
that isn't part of the libvirt /etc/group) will fail with the following
error from libvirtd:

error: authentication unavailable: no polkit agent available to
       authenticate action 'org.libvirt.unix.manage'

In order to handle the local authentication, we will use the new
virPolkitAgentCreate API in order to create a text based authentication
agent for our non readonly session to authenticate with.

The new code will execute in a loop allowing 5 failures to authenticate
before failing out.

With this patch in place, the following occurs:

$ virsh -c qemu:///system list
==== AUTHENTICATING FOR org.libvirt.unix.manage ===
System policy prevents management of local virtualized systems
Authenticating as: Some User (SUser)
Password:
==== AUTHENTICATION COMPLETE ===
 Id    Name                           State
 ----------------------------------------------------
  1     somedomain                     running

$
tools/virsh.c
tools/virsh.h