[libvirt] Accessing libvirtd remotely as non-root user

Dan Mossor danofsatx at gmail.com
Fri Jun 12 16:14:23 UTC 2015


On 06/12/2015 03:48 AM, Daniel P. Berrange wrote:
> On Thu, Jun 11, 2015 at 05:26:20PM -0500, Dan Mossor wrote:
>> I manage libvirtd on a few remote machines, and my security policies require
>> me to disable root login via SSH. Up to this point, I've been using root due
>> to the systems being in staging, but this is the final step before they're
>> moved to production.
>>
>> What is the current proscribed method of connecting virt-manager or virsh to
>> a remote system with a non-root account? I keep getting "authentication
>> failed: no agent is available to authenticate" with a user that is in the
>> kvm and qemu groups on the systems I've tried using the ssh transport.
>
> This guide ought to help you set it up
>
>     http://wiki.libvirt.org/page/SSHPolicyKitSetup
>
> Regards,
> Daniel
>
Ok, so I finally got it working.

The SSHPolicyKitSetup page at the libvirt wiki states right at the top 
that "As of polkit 0.106 the .pkla format is no more, and these 
configuration files must be written in Javascript."

Further down the page, it reinforces this statement with "The 
information in this section is obsolete; see the top of this page for 
more information."

However, both of those statements are incorrect. Following the 
directions provided by [1] from the wiki page produced zero results - 
the operation still failed with "authentication failed: no agent is 
available to authenticate" when attempting to connect.

Various hits from a Google search on that specific error string found 
_plenty_ of recent forum posts (recent as in less than 6 months old) 
with the exact same issue as me, with zero solutions. I did see one 
promising thing in passing that polkit-pkla-compat is still shipped by 
default as part of the polkit suite.

So, further digging led me to [2], which in essence was the section of 
the libvirtd wiki page that the page claimed was obsolete. Creating the 
.pkla authorization file finally enabled non-root privileged user 
management of a remote KVM host.

Now, the next step is to tie the polkit authorization into LDAP. More 
research....

Dan

[1] 
http://goldmann.pl/blog/2012/12/03/configuring-polkit-in-fedora-18-to-access-virt-manager/

[2] 
https://fedorapeople.org/groups/docs/cookbook/#access-to-libvirt-without-root-privileges

-- 
Dan Mossor, RHCSA
Systems Engineer
Fedora Server WG | Fedora KDE WG | Fedora QA Team
Fedora Infrastructure Apprentice
FAS: dmossor IRC: danofsatx
San Antonio, Texas, USA




More information about the libvir-list mailing list