[X2Go-Commits] python-x2go.git - brokerclient (branch) updated: 0.0.37.0-41-gc17955c

X2Go dev team git-admin at x2go.org
Tue Jan 7 16:20:10 CET 2014


The branch, brokerclient has been updated
       via  c17955ccc33e7ce2f13428968e46f8b3e2a03803 (commit)
      from  d9cb960c2336786493ec889a86c6978aa4d21e36 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 x2go/backends/control/_stdout.py |   11 +++++++++++
 x2go/client.py                   |   12 ++++++++++++
 x2go/session.py                  |   28 ++++++++++++++++++++++++++--
 3 files changed, 49 insertions(+), 2 deletions(-)

The diff of changes is:
diff --git a/x2go/backends/control/_stdout.py b/x2go/backends/control/_stdout.py
index 370b9ff..59d4bd3 100644
--- a/x2go/backends/control/_stdout.py
+++ b/x2go/backends/control/_stdout.py
@@ -234,6 +234,17 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
     def set_profile_name(self, profile_name):
         self.profile_name = profile_name
 
+    def check_host(self, host, port=22):
+        """\
+        Perform a Paramiko/SSH host key check.
+
+        """
+        #paramiko.SSHClient.connect(host=host, port=port, username='foo', password='bar')
+        _host = host
+        _port = port
+        _fingerprint = 'dummy fingerprint'
+        return (False, _host, _port, _fingerprint)
+
     def connect(self, hostname, port=22, username='', password='', pkey=None,
                 use_sshproxy=False, sshproxy_host='', sshproxy_user='', sshproxy_password='',
                 sshproxy_key_filename='', sshproxy_tunnel='',
diff --git a/x2go/client.py b/x2go/client.py
index a8e8999..ffee146 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -294,6 +294,10 @@ class X2goClient(object):
             self.logger('HOOK_printaction_error: incoming print job ,, %s'' on printer %s caused error: %s' % (filename, printer, err_msg), loglevel=log.loglevel_ERROR)
         else:
             self.logger('HOOK_printaction_error: incoming print job ,, %s'' caused error: %s' % (filename, err_msg), loglevel=log.loglevel_ERROR)
+    def HOOK_check_host_dialog(self, profile_name='UNKNOWN', host='UNKNOWN', port=22, fingerprint='no fingerprint'):
+        self.logger('HOOK_check_host_dialog: host check requested for session profile %s: Automatically adding host [%s]:%s with fingerprint: ,,%s\'\' as a known host.' % (profile_name, host, port, fingerprint), loglevel=log.loglevel_WARN)
+        # this HOOK has to return either True (accept host connection) or False (deny host conection)
+        return True
     def HOOK_on_control_session_death(self, profile_name):
         self.logger('HOOK_on_control_session_death: the control session of profile %s has died unexpectedly' % profile_name, loglevel=log.loglevel_WARN)
     def HOOK_pulseaudio_not_supported_in_RDPsession(self):
@@ -681,6 +685,14 @@ class X2goClient(object):
         """
         return self.session_registry(session_uuid).set_username(username=username)
 
+    def check_session_host(self, session_uuid):
+        """\
+        Provide a mechanism to evaluate the validity of an X2go server host.
+
+        """
+        return self.session_registry(session_uuid).check_host()
+    __check_session_host = check_session_host
+
     def connect_session(self, session_uuid,
                         username='',
                         password='',
diff --git a/x2go/session.py b/x2go/session.py
index 66fb9bf..0a15069 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -188,7 +188,7 @@ class X2goSession(object):
         if self.client_instance:
             self.client_instance.HOOK_rforward_request_denied(profile_name=self.profile_name, session_name=self.session_name, server_port=server_port)
         else:
-            self.logger('TCP port (reverse) forwarding request for session %s to server port %s has been denied by server %s. This is a common issue with SSH, it might help to restart the server\'s SSH daemon.' % (self.session_name, server_port, self.profile_name), loglevel=log.loglevel_WARN)
+            self.logger('HOOK_rforward_request_denied: TCP port (reverse) forwarding request for session %s to server port %s has been denied by server %s. This is a common issue with SSH, it might help to restart the server\'s SSH daemon.' % (self.session_name, server_port, self.profile_name), loglevel=log.loglevel_WARN)
 
     def HOOK_forwarding_tunnel_setup_failed(self, chain_host='UNKNOWN', chain_port=0):
         """\
@@ -198,7 +198,18 @@ class X2goSession(object):
         if self.client_instance:
             self.client_instance.HOOK_forwarding_tunnel_setup_failed(profile_name=self.profile_name, session_name=self.session_name, chain_host=chain_host, chain_port=chain_port)
         else:
-            self.logger('Forwarding tunnel request to [%s]:%s for session %s (%s) was denied by remote X2go/SSH server. Session startup failed.' % (chain_host, chain_port, self.session_name, self.profile_name), loglevel=log.loglevel_WARN)
+            self.logger('HOOK_forwarding_tunnel_setup_failed: Forwarding tunnel request to [%s]:%s for session %s (%s) was denied by remote X2go/SSH server. Session startup failed.' % (chain_host, chain_port, self.session_name, self.profile_name), loglevel=log.loglevel_WARN)
+
+    def HOOK_check_host_dialog(self, host, port, fingerprint='no fingerprint'):
+        """\
+        STILL UNDOCUMENTED
+
+        """
+        if self.client_instance:
+            return self.client_instance.HOOK_check_host_dialog(profile_name=self.profile_name, host=host, port=port, fingerprint=fingerprint)
+        else:
+            self.logger('HOOK_check_host_dialog: host check requested for [%s]:%s with fingerprint: ,,%s.\'\'. Automatically adding host as known host.' % (host, port, fingerprint), loglevel=log.loglevel_WARN)
+            return True
 
     def init_control_session(self):
         """\
@@ -459,6 +470,19 @@ class X2goSession(object):
         return self.terminal_session is not None
     __has_terminal_session = has_terminal_session
 
+    def check_host(self):
+        """\
+        Provide a host check mechanism.
+
+        """
+        if self.connected:
+            return True
+
+        _port = self.control_params['port']
+        (_valid, _host, _port, _fingerprint) = self.control_session.check_host(self.server, port=_port)
+        return _valid or self.HOOK_check_host_dialog(host=_host, port=_port, fingerprint=_fingerprint)
+    __check_host = check_host
+
     def connect(self, username='', password='', add_to_known_hosts=False, force_password_auth=False,
                 use_sshproxy=False, sshproxy_user='', sshproxy_password=''):
         """\


hooks/post-receive
-- 
python-x2go.git (Python X2Go Client API)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).




More information about the x2go-commits mailing list