Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to libvirt server using password, requires ssh key #17

Closed
sthirugn opened this issue Feb 17, 2017 · 4 comments
Closed

Comments

@sthirugn
Copy link
Contributor

# virt-who --one-shot --debug
2017-02-17 17:10:05,169 [virtwho.init WARNING] MainProcess(27378):MainThread @config.py:checkOptions:328 - Password authentication doesn't work with ssh transport on libvirt backend, copy your public ssh key to the remote machine
2017-02-17 17:10:05,169 [virtwho.init DEBUG] MainProcess(27378):MainThread @executor.py:__init__:66 - Using config named 'virt-who-config-2'
2017-02-17 17:10:05,169 [virtwho.init INFO] MainProcess(27378):MainThread @main.py:main:165 - Using configuration "virt-who-config-2" ("libvirt" mode)
2017-02-17 17:10:05,169 [virtwho.init INFO] MainProcess(27378):MainThread @main.py:main:167 - Using reporter_id='<hidden.-162c36e5653242ecaf1e49629c311950'
2017-02-17 17:10:05,204 [virtwho.virt-who-config-2 DEBUG] Libvirtd-1(27384):MainThread @virt.py:run:379 - Virt backend 'virt-who-config-2' started
2017-02-17 17:10:05,204 [virtwho.virt-who-config-2 INFO] Libvirtd-1(27384):MainThread @libvirtd.py:_get_url:125 - Protocol is not specified in libvirt url, using qemu+ssh://
2017-02-17 17:10:05,205 [virtwho.virt-who-config-2 INFO] Libvirtd-1(27384):MainThread @libvirtd.py:_get_url:136 - Libvirt path is not specified in the url, using /system
2017-02-17 17:10:05,205 [virtwho.virt-who-config-2 INFO] Libvirtd-1(27384):MainThread @libvirtd.py:_connect:157 - Using libvirt url: qemu+ssh://root@<hidden>/system?no_tty=1
2017-02-17 17:10:05,415 [virtwho.virt-who-config-2 ERROR] Libvirtd-1(27384):MainThread @libvirtd.py:_connect:165 - Error in libvirt backend
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/virt/libvirtd/libvirtd.py", line 161, in _connect
    v = libvirt.openAuth(url, auth, libvirt.VIR_CONNECT_RO)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 105, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Cannot recv data: Host key verification failed.: Connection reset by peer
2017-02-17 17:10:05,417 [virtwho.virt-who-config-2 ERROR] Libvirtd-1(27384):MainThread @virt.py:run:390 - Virt backend 'virt-who-config-2' fails with error: Cannot recv data: Host key verification failed.: Connection reset by peer
2017-02-17 17:10:05,417 [virtwho.virt-who-config-2 DEBUG] Libvirtd-1(27384):MainThread @virt.py:enqueue:372 - Report for config "virt-who-config-2" gathered, putting to queue for sending
2017-02-17 17:10:05,423 [virtwho.virt-who-config-2 DEBUG] Libvirtd-1(27384):MainThread @virt.py:run:400 - Virt backend 'virt-who-config-2' stopped after sending one report
2017-02-17 17:10:05,424 [virtwho.main WARNING] MainProcess(27378):MainThread @executor.py:run:252 - Unable to collect report for config "virt-who-config-2"
2017-02-17 17:10:05,425 [virtwho.main DEBUG] MainProcess(27378):MainThread @__main__.py:main:23 - virt-who terminated
2017-02-17 17:10:05,425 [virtwho.main DEBUG] MainProcess(27378):MainThread @executor.py:terminate:308 - virt-who is shutting down
@sthirugn
Copy link
Contributor Author

My config:

yum install -y virt-who
cr_password=`virt-who-password --password <hidden> 2> /dev/null`
user_password=`virt-who-password --password "uHCscz2QtEHY5VhH" 2> /dev/null`

cat > /etc/virt-who.d/virt-who-config-2.conf << EOF
[virt-who-config-2]
type=libvirt
hypervisor_id=hostname
owner=Default Organization
env=Library
server=<hidden>
username=root
encrypted_password=$cr_password
rhsm_hostname=https://<hidden>
rhsm_username=virt_who_reporter_2
rhsm_encrypted_password=$user_password
rhsm_prefix=/rhsm
EOF

cat > /etc/cron.d/virt-who-config-virt-who-config-2 << EOF
0 * * * * virt-who --one-shot --debug --config=/etc/virt-who.d/virt-who-config-2.conf 
EOF

@sthirugn
Copy link
Contributor Author

I found the problem, the libvirt backend doesnt support password as per https://bugzilla.redhat.com/show_bug.cgi?id=1258726

# virt-who --one-shot --config=/etc/virt-who.d/virt-who-config-3.conf 
2017-02-20 14:08:46,898 WARNING: Password authentication doesn't work with ssh transport on libvirt backend, copy your public ssh key to the remote machine
2017-02-20 14:08:46,899 WARNING: Password authentication doesn't work with ssh transport on libvirt backend, copy your public ssh key to the remote machine

After configuring the ssh key for the user as mentioned in the warning above, the permission error is gone and it starts working.

@sthirugn sthirugn changed the title Unable to connect to libvirt server using the satellite generated config Unable to connect to libvirt server using password, requires ssh key Feb 20, 2017
@ares
Copy link
Member

ares commented Feb 21, 2017

I think this is depending on how you specify the libvirt server. For local libvirt, qemu:///system without any username and password should work. For classic username and password configuration of libvirt, please see https://libvirt.org/auth.html#ACL_server_username

Maybe we should provide inline help for libvirt fields with some examples.

Please let me know if this helps.

@ares
Copy link
Member

ares commented Feb 21, 2017

@ares ares closed this as completed Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants