Comment # 7 on bug 1199337 from
(In reply to James Fehlig from comment #6)
> Are you sure the private key file corresponds to the root user? I see the
> same error when specifying a different keyfile, e.g. the
> qa-automation@suse.de one. But I see other problems when specifying root's
> keyfile:
>
> error: authentication failed: authentication with private key
> '/root/.ssh/id_rsa' has failed: Unable to extract public key from private
> key file: Unable to open private key file
>
> Hmm, the process trying to open the file is running as root. Using password
> auth works fine:
>
> virsh -c qemu+libssh2://virt81/system?known_hosts=/root/.ssh/known_hosts
> hostname
> Enter root's password for virt81: ****
> virt81.devlab.prv.suse.com
>
> IMO, this is not a virtualization problem, but one of correct key management
> for libssh2. Sorry I'm not familiar enough with the topic to provide
> suggestions. I can look deeper, but I suspect others (e.g. Marcus) will be
> more helpful.

Hi James,

The private key of the root user is correct and it is generated manually,
here is the test code:
https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/tests/console/libssh.pm#L117

I downloaded the resource code of libvirt from GitLab and tried to compile
the latest "GIT version" by using following command:
```
meson build \
    -Ddriver_qemu=enabled -Ddriver_libvirtd=enabled -Ddriver_remote=enabled \
    -Dlibssh=enabled -Dlibssh2=enabled \
    --prefix=/root/usr
```

Referring the steps from:
https://libvirt.org/compiling.html#building-from-a-git-checkout

After that, I found the pub-key verification fail is on this line:
https://github.com/libvirt/libvirt/blob/2ba73a10fd79637888235cfee8110fe2a21a9f7e/src/rpc/virnetsshsession.c#L580

The function `libssh2_userauth_publickey_fromfile` failed to verify the
public key.

Then I found this issue about this function in the GitHub repo of libssh2:
https://github.com/libssh2/libssh2/issues/659

Seems like that the bug has already fixed in the source code,
but libssh2 did not release a new version until now.


You are receiving this mail because: