Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
virt-manager: libvirtd started but how to define auth?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Thu Feb 04, 2010 10:44 pm    Post subject: virt-manager: libvirtd started but how to define auth? Reply with quote

I'm trying out virt-manager for the first time on Gentoo. There is no emerge --config step defined for virt-manager. I have libvirtd started, but I get the following error on startup:

Code:
Unable to open a connection to the libvirt management daemon.

Libvirt URI is: qemu:///system

Verify that:
 - The 'libvirtd' daemon has been started

Details:

Unable to open connection to hypervisor URI 'qemu:///system':
authentication failed
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 871, in _try_open
    None], flags)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 111, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: authentication failed

I don't have qemu proper, I use qemu-kvm instead:
Code:
# emerge qemu-kvm -pv
[ebuild   R   ] app-emulation/qemu-kvm-9999  USE="aio gnutls ncurses pulseaudio sasl sdl vde -alsa -bluetooth -curl -esd -fdt -hardened -kvm-trace" QEMU_SOFTMMU_TARGETS="arm cris i386 m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb sh4 sh4eb sparc sparc64 x86_64" QEMU_USER_TARGETS="alpha arm armeb cris i386 m68k microblaze mips mipsel ppc ppc64 ppc64abi32 sh4 sh4eb sparc sparc32plus sparc64 x86_64" 0 kB

libvirt is emerged with the following use vars:
Code:
# emerge libvirt -pv
[ebuild   R   ] app-emulation/libvirt-0.7.6-r1  USE="avahi libvirtd lxc network nls parted policykit python qemu sasl udev -caps -iscsi -lvm -nfs -numa -openvz -phyp (-selinux) -uml -virtualbox -xen" 0 kB

Any suggestions on how to configure the requested authentication?

Thanks.
Back to top
View user's profile Send private message
vaxbrat
l33t
l33t


Joined: 05 Oct 2005
Posts: 731
Location: DC Burbs

PostPosted: Sat Feb 27, 2010 6:03 am    Post subject: Defer for the moment? Reply with quote

I've just started switching from doing my own kvm/qemu to using it with virt-manager myself. Rather than dealing with certs and auth for the moment, I decided to just keep things open but keep the listening to localhost. I'm also more interested for now at a single user desktop where I want a Windows guest on top of Linux in order to consolidate developer hardware footprint. I'll look at the server scenario later. I also throttle back the connection counts for the single user desktop.

Here's my current libvirtd.conf:

Code:
# Master libvirt daemon configuration file                       
#                                                               
# For further information consult http://libvirt.org/format.html
#                                                               
# NOTE: the tests/daemon-conf regression test script requires   
# that each "PARAMETER = VALUE" line in this file have the parameter
# name just after a leading "#".                                   

#################################################################
#                                                               
# Network connectivity controls                                 
#                                                               

# Flag listening for secure TLS connections on the public TCP/IP port.
# NB, must pass the --listen flag to the libvirtd process for this to
# have any effect.                                                   
#                                                                     
# It is necessary to setup a CA and issue server certificates before 
# using this capability.                                             
#                                                                     
# This is enabled by default, uncomment this to disable it           
#listen_tls = 0                                                       

# Listen for unencrypted TCP connections on the public TCP/IP port.
# NB, must pass the --listen flag to the libvirtd process for this to
# have any effect.                                                   
#                                                                   
# Using the TCP socket requires SASL authentication by default. Only
# SASL mechanisms which support data encryption are allowed. This is
# DIGEST_MD5 and GSSAPI (Kerberos5)                                 
#                                                                   
# This is disabled by default, uncomment this to enable it.         
listen_tcp = 1                                                       



# Override the port for accepting secure TLS connections
# This can be a port number, or service name           
#                                                       
#tls_port = "16514"                                     

# Override the port for accepting insecure TCP connections
# This can be a port number, or service name             
#                                                         
tcp_port = "16509"                                       


# Override the default configuration which binds to all network
# interfaces. This can be a numeric IPv4/6 address, or hostname
#                                                             
listen_addr = "127.0.0.1"                                     


# Flag toggling mDNS advertizement of the libvirt service.
#                                                         
# Alternatively can disable for all services on a host by
# stopping the Avahi daemon                               
#                                                         
# This is enabled by default, uncomment this to disable it
#mdns_adv = 0                                             

# Override the default mDNS advertizement name. This must be
# unique on the immediate broadcast network.               
#                                                           
# The default is "Virtualization Host HOSTNAME", where HOSTNAME
# is subsituted for the short hostname of the machine (without domain)
#                                                                     
#mdns_name = "Virtualization Host Joe Demo"                           


#################################################################
#                                                               
# UNIX socket access controls                                   
#                                                               

# Set the UNIX domain socket group ownership. This can be used to
# allow a 'trusted' set of users access to management capabilities
# without becoming root.                                         
#                                                                 
# This is restricted to 'root' by default.                       
unix_sock_group = "kvm"                                           

# Set the UNIX socket permissions for the R/O socket. This is used
# for monitoring VM status only                                   
#                                                                 
# Default allows any user. If setting group ownership may want to
# restrict this to:                                               
unix_sock_ro_perms = "0777"                                       

# Set the UNIX socket permissions for the R/W socket. This is used
# for full management of VMs                                     
#                                                                 
# Default allows only root. If PolicyKit is enabled on the socket,
# the default will change to allow everyone (eg, 0777)           
#                                                                 
# If not using PolicyKit and setting group ownership for access   
# control then you may want to relax this to:                     
unix_sock_rw_perms = "0770"                                       

# Set the name of the directory in which sockets will be found/created.
#unix_sock_dir = "/var/run/libvirt"                                   

#################################################################
#                                                               
# Authentication.                                               
#                                                               
#  - none: do not perform auth checks. If you can connect to the
#          socket you are allowed. This is suitable if there are
#          restrictions on connecting to the socket (eg, UNIX   
#          socket permissions), or if there is a lower layer in 
#          the network providing auth (eg, TLS/x509 certificates)
#                                                               
#  - sasl: use SASL infrastructure. The actual auth scheme is then
#          controlled from /etc/sasl2/libvirt.conf. For the TCP   
#          socket only GSSAPI & DIGEST-MD5 mechanisms will be used.
#          For non-TCP or TLS sockets,  any scheme is allowed.     
#                                                                 
#  - polkit: use PolicyKit to authenticate. This is only suitable 
#            for use on the UNIX sockets. The default policy will 
#            require a user to supply their own password to gain   
#            full read/write access (aka sudo like), while anyone 
#            is allowed read/only access.                         
#                                                                 
# Set an authentication scheme for UNIX read-only sockets         
# By default socket permissions allow anyone to connect           
#                                                                 
# To restrict monitoring of domains you may wish to enable         
# an authentication mechanism here                                 
auth_unix_ro = "none"                                             

# Set an authentication scheme for UNIX read-write sockets
# By default socket permissions only allow root. If PolicyKit
# support was compiled into libvirt, the default will be to 
# use 'polkit' auth.                                         
#                                                           
# If the unix_sock_rw_perms are changed you may wish to enable
# an authentication mechanism here                           
auth_unix_rw = "none"                                         

# Change the authentication scheme for TCP sockets.
#                                                 
# If you don't enable SASL, then all TCP traffic is cleartext.
# Don't do this outside of a dev/test scenario. For real world
# use, always enable SASL and use the GSSAPI or DIGEST-MD5   
# mechanism in /etc/sasl2/libvirt.conf                       
auth_tcp = "none"                                             

# Change the authentication scheme for TLS sockets.
#                                                 
# TLS sockets already have encryption provided by the TLS
# layer, and limited authentication is done by certificates
#                                                         
# It is possible to make use of any SASL authentication   
# mechanism as well, by using 'sasl' for this option       
auth_tls = "none"                                         



#################################################################
#                                                               
# TLS x509 certificate configuration                             
#                                                               


# Override the default server key file path
#                                         
key_file = "/etc/pki/libvirt/private/serverkey.pem"

# Override the default server certificate file path
#                                                 
cert_file = "/etc/pki/libvirt/servercert.pem"     

# Override the default CA certificate path
#                                         
ca_file = "/etc/pki/CA/cacert.pem"       

# Specify a certificate revocation list.
#                                       
# Defaults to not using a CRL, uncomment to enable it
crl_file = "/etc/pki/CA/crl.pem"                     



#################################################################
#                                                               
# Authorization controls                                         
#                                                               


# Flag to disable verification of client certificates
#                                                   
# Client certificate verification is the primary authentication mechanism.
# Any client which does not present a certificate signed by the CA       
# will be rejected.                                                       
#                                                                         
# Default is to always verify. Uncommenting this will disable             
# verification - make sure an IP whitelist is set                         
#tls_no_verify_certificate = 1                                           


# A whitelist of allowed x509  Distinguished Names
# This list may contain wildcards such as         
#                                                 
#    "C=GB,ST=London,L=London,O=Red Hat,CN=*"     
#                                                 
# See the POSIX fnmatch function for the format of the wildcards.
#                                                               
# NB If this is an empty list, no client can connect, so comment out
# entirely rather than using empty list to disable these checks     
#                                                                   
# By default, no DN's are checked                                   
#tls_allowed_dn_list = ["DN1", "DN2"]                               


# A whitelist of allowed SASL usernames. The format for usernames
# depends on the SASL authentication mechanism. Kerberos usernames
# look like username@REALM                                       
#                                                                 
# This list may contain wildcards such as                         
#                                                                 
#    "*@EXAMPLE.COM"                                             
#                                                                 
# See the POSIX fnmatch function for the format of the wildcards.
#                                                                 
# NB If this is an empty list, no client can connect, so comment out
# entirely rather than using empty list to disable these checks     
#                                                                   
# By default, no Username's are checked                             
#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ]



#################################################################
#                                                               
# Processing controls                                           
#                                                               

# The maximum number of concurrent client connections to allow
# over all sockets combined.                                 
max_clients = 2                                               


# The minimum limit sets the number of workers to start up
# initially. If the number of active clients exceeds this,
# then more threads are spawned, upto max_workers limit. 
# Typically you'd want max_workers to equal maximum number
# of clients allowed                                     
min_workers = 1                                           
max_workers = 2                                           

# Total global limit on concurrent RPC calls. Should be
# at least as large as max_workers. Beyond this, RPC requests
# will be read into memory and queued. This directly impact 
# memory usage, currently each request requires 256 KB of   
# memory. So by default upto 5 MB of memory is used         
#                                                           
# XXX this isn't actually enforced yet, only the per-client 
# limit is used so far                                       
max_requests = 3                                             

# Limit on concurrent requests from a single client
# connection. To avoid one client monopolizing the server
# this should be a small fraction of the global max_requests
# and max_workers parameter                                 
max_client_requests = 1                                     

#################################################################
#                                                               
# Logging controls                                               
#                                                               

# Logging level: 4 errors, 3 warnings, 2 informations, 1 debug
# basically 1 will log everything possible                   
log_level = 2                                                 

# Logging filters:
# A filter allows to select a different logging level for a given category
# of logs                                                                 
# The format for a filter is:                                             
#    x:name                                                               
#      where name is a match string e.g. remote or qemu                   
# the x prefix is the minimal level where matching messages should be logged
#    1: DEBUG
#    2: INFO
#    3: WARNING
#    4: ERROR
#
# Multiple filter can be defined in a single @filters, they just need to be
# separated by spaces.
#
# e.g:
# log_filters="3:remote 4:event"
# to only get warning or errors from the remote layer and only errors from
# the event layer.

# Logging outputs:
# An output is one of the places to save logging informations
# The format for an output can be:
#    x:stderr
#      output goes to stderr
#    x:syslog:name
#      use syslog for the output and use the given name as the ident
#    x:file:file_path
#      output to a file, with the given filepath
# In all case the x prefix is the minimal level, acting as a filter
#    1: DEBUG
#    2: INFO
#    3: WARNING
#    4: ERROR
#
# Multiple output can be defined, they just need to be separated by spaces.
# e.g.:
# log_outputs="3:syslog:libvirtd"
# to log all warnings and errors to syslog under the libvirtd ident
Back to top
View user's profile Send private message
direwolf
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2003
Posts: 125
Location: Richmond, VA

PostPosted: Mon Oct 10, 2011 7:10 pm    Post subject: socket perms Reply with quote

I've been using KVM just managing config files and manual startups, decided to try libvirt.

I'm not using any network connections yet, and at this point I seem to be stuck on a permissions issue. In libvirtd.conf I have:

Code:
# Set the UNIX domain socket group ownership. This can be used to
# allow a 'trusted' set of users access to management capabilities
# without becoming root.
#
# This is restricted to 'root' by default.
unix_sock_group = "libvirt"

# Set the UNIX socket permissions for the R/O socket. This is used
# for monitoring VM status only
#
# Default allows any user. If setting group ownership may want to
# restrict this to:
unix_sock_ro_perms = "0777"

# Set the UNIX socket permissions for the R/W socket. This is used
# for full management of VMs
#
# Default allows only root. If PolicyKit is enabled on the socket,
# the default will change to allow everyone (eg, 0777)
#
# If not using PolicyKit and setting group ownership for access
# control then you may want to relax this to:
unix_sock_rw_perms = "0770"

# Set the name of the directory in which sockets will be found/created.
unix_sock_dir = "/var/run/libvirt"


The sockets created seem to be created correctly:

Code:

srwxrwx--- 1 root libvirt    0 Oct 10 15:07 libvirt-sock
srwxrwxrwx 1 root libvirt    0 Oct 10 15:07 libvirt-sock-ro


My user is in the specified group:
Code:

id user1
uid=1000(user1) gid=100(users) groups=100(users),7(lp),10(wheel),18(audio),19(cdrom),27(video),250(portage),16(cron),1001(kvm),1004(plugdev),35(games),1016(libvirt)


And yet libvirt still refuses to allow the connection:

Code:

Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1055, in _try_open
    None], flags)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied


It works if I use root. Am I overlooking something obvious, here? Anybody got any ideas?
_________________
========================================================
"Somebody has to do something, and it's just incredibly pathetic that it has to be us."
- Jerry Garcia
Back to top
View user's profile Send private message
drizer
n00b
n00b


Joined: 30 Jun 2005
Posts: 11

PostPosted: Thu Mar 30, 2017 11:33 am    Post subject: Reply with quote

try running the command as root

Code:
sudo virt-manger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum