[X2Go-Commits] [pyhoca-cli] 01/01: pyhoca-cli: Add --force-password command line switch to override SSH key detection code.

git-admin at x2go.org git-admin at x2go.org
Tue Mar 6 21:18:52 CET 2018


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

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

commit 835cd53bd275130a3a6f5b7582d7de44a0c5bff5
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Mar 6 20:17:50 2018 +0000

    pyhoca-cli: Add --force-password command line switch to override SSH key detection code.
---
 pyhoca-cli             | 1 +
 pyhoca/cli/frontend.py | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyhoca-cli b/pyhoca-cli
index c5ac402..24913f5 100755
--- a/pyhoca-cli
+++ b/pyhoca-cli
@@ -156,6 +156,7 @@ x2go_options =    [
                     {'args':['-c','--command'], 'default': 'TERMINAL', 'help': 'command to run with -R mode on server (default: xterm)', },
                     {'args':['-u','--username'], 'default': None, 'help': 'username for the session (default: current user)', },
                     {'args':['--password'], 'default': None, 'help': 'user password for session authentication', },
+                    {'args':['--force-password'], 'default': False, 'action': 'store_true', 'help': 'enforce username/password authentication', },
                     {'args':['-p','--remote-ssh-port'], 'default': '22', 'help': 'remote SSH port (default: 22)', },
                     {'args':['-k','--ssh-privkey'], 'default': None, 'help': 'use file \'SSH_PRIVKEY\' as private key for the SSH connection (e.g. ~/.ssh/id_rsa)', },
                     {'args':['--add-to-known-hosts'], 'default': False, 'action': 'store_true', 'help': 'add RSA host key fingerprint to ~/.ssh/known_hosts if authenticity of server can\'t be established (default: not set)', },
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index ce0415a..be0fcbc 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
@@ -441,7 +441,8 @@ class PyHocaCLI(x2go.X2GoClient):
 
         """
         connected = False
-        force_password_auth = False
+        force_password_auth = self.args.force_password
+
         _username = self.args.username or self._X2GoClient__get_session_username(self.x2go_session_hash)
 
         # if we still don't have a valid user name, try the broker...
@@ -452,6 +453,8 @@ class PyHocaCLI(x2go.X2GoClient):
             _auth_count = self.auth_attempts +1
             while not connected and _auth_count:
                 try:
+                    if force_password_auth:
+                        self.args.password = getpass.getpass()
                     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

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-cli.git


More information about the x2go-commits mailing list