• J
    virsh: Add support for text based polkit authentication · ea48397b
    John Ferlan 提交于
    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
    
    $
    ea48397b
virsh.c 28.1 KB