[X2Go-Commits] [pyhoca-cli] 01/01: Handle SSHException 'No authentication methods available' for key-only authentication attempts gracefully.

git-admin at x2go.org git-admin at x2go.org
Wed Dec 17 16:21:59 CET 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository pyhoca-cli.

commit 7120e88032ccdd27d0c39e479b462bf350ff4d0e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Dec 17 16:21:52 2014 +0100

    Handle SSHException 'No authentication methods available' for key-only authentication attempts gracefully.
---
 debian/changelog       |    2 ++
 pyhoca/cli/frontend.py |    8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 37f9fcd..9c7c22d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ pyhoca-cli (0.5.0.2-0x2go2) UNRELEASED; urgency=medium
   * New upstream version (0.5.0.2):
     - Handle SSHException 'Incompatible ssh peer (no acceptable kex algorithm)'
       gracefully.
+    - Handle SSHException 'No authentication methods available' for key-only
+      authentication attempts gracefully.
   * debian/control:
     + Bump Standards: to 3.9.6. No changes needed.
   * debian/copyright:
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index 04b9c40..f756624 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
@@ -454,18 +454,22 @@ class PyHocaCLI(x2go.X2GoClient):
                 try:
                     self._X2GoClient__connect_session(self.x2go_session_hash, username=_username, password=self.args.password, force_password_auth=force_password_auth)
                     connected = True
+                    force_password_auth = False
                 except x2go.PasswordRequiredException, e:
                     self._pyhoca_logger('unlock SSH key file (%s)' % self.args.ssh_privkey, loglevel=x2go.loglevel_NOTICE, )
                     self.args.password = getpass.getpass()
                 except x2go.AuthenticationException, e:
                     force_password_auth = True
-                    self._pyhoca_logger('interactive login for user ,,%s\'\'' % _username, loglevel=x2go.loglevel_NOTICE, )
+                    self._pyhoca_logger('passwordless login for ,,%s\'\' failed' % _username, loglevel=x2go.loglevel_WARN, )
+                    self._pyhoca_logger('proceeding to interactive login for user ,,%s\'\'' % _username, loglevel=x2go.loglevel_NOTICE, )
                 except x2go.BadHostKeyException:
                     self._runtime_error('SSH host key verification for remote host [%s]:%s failed' % (self.args.server, self.args.remote_ssh_port), exitcode=-254)
                 except x2go.SSHException, e:
-                    if str(e) not in ('not a valid DSA private key file', 'Incompatible ssh peer (no acceptable kex algorithm)'):
+                    if str(e) not in ('not a valid DSA private key file', 'Incompatible ssh peer (no acceptable kex algorithm)', 'No authentication methods available'):
                         self._runtime_error(str(e), exitcode=253)
                     force_password_auth = True
+                    self._pyhoca_logger('passwordless login for ,,%s\'\' failed' % _username, loglevel=x2go.loglevel_WARN, )
+                    self._pyhoca_logger('proceeding to interactive login for user ,,%s\'\'' % _username, loglevel=x2go.loglevel_NOTICE, )
 
                 if force_password_auth:
                     self.args.password = getpass.getpass()

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-cli.git


More information about the x2go-commits mailing list