[Pkg-libvirt-maintainers] Bug#513599: Bug#513599: Can't connect to remote host via ssh without ssh-askpass*

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Sun Feb 8 19:06:22 UTC 2009


* Guido Günther | 2009-02-07 18:19:52 [+0100]:

>On Thu, Feb 05, 2009 at 01:33:12PM +0100, Sebastian Andrzej Siewior wrote:
>> Did you have something like the attached patch in mind?
>Yes, but we should check if the error originates from virConnectOpenAuth
>to make sure we're not even more confusing.
>Could you add that too?
I'm not sure if I understood you. According to the code:
|def openAuth(uri, auth, flags):
|    ret = libvirtmod.virConnectOpenAuth(uri, auth, flags)
|    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
|    return virConnect(_obj=ret)

I would say that the error always originates from virConnectOpenAuth()
since this is the only place where an exception is thrown. The
virConnect() call looks like a constructor which can't fail / does not
throw anything.
I was thinking about parsing "value" which contains the error message.
However the message depends on the locale and shouldn't be used.
Furthermore I'm always getting "connection reset by peer" no matter if I
entered my password wrong or had a typo in the hostname.

openAuth() is called for all protocols so I modified my patch to give
this "install ssh-askpass" just if the protocol is ssh.

> -- Guido

Sebastian
-------------- next part --------------
--- a/src/virtManager/connection.py
+++ b/src/virtManager/connection.py
@@ -489,13 +489,19 @@ class vmmConnection(gobject.GObject):
         except:
             self.state = self.STATE_DISCONNECTED
 
+            if self.uri.find("+ssh://") > 0:
+                  hint = "\nMaybe you need to install ssh-askpass " + \
+                         "in order to authenticate."
+            else:
+                  hint = ""
+
             (type, value, stacktrace) = sys.exc_info ()
             # Detailed error message, in English so it can be Googled.
             self.connectError = \
                     ("Unable to open connection to hypervisor URI '%s':\n" %
                      str(self.uri)) + \
                     str(type) + " " + str(value) + "\n" + \
-                    traceback.format_exc (stacktrace)
+                    traceback.format_exc (stacktrace) + hint
             logging.error(self.connectError)
 
         # We want to kill off this thread asap, so schedule a gobject


More information about the Pkg-libvirt-maintainers mailing list