The branch, twofactorauth has been updated via 21c8f1eaffd64391842746ca2475957901b607e2 (commit) from b5333aed586ed72e33d8346eaf3f8be9594b680f (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/terminal/_stdout.py | 11 +++++++++++ x2go/client.py | 2 ++ x2go/rforward.py | 13 ++++++++++--- x2go/session.py | 11 +++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) The diff of changes is: diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py index 2745d76..4726654 100644 --- a/x2go/backends/terminal/_stdout.py +++ b/x2go/backends/terminal/_stdout.py @@ -236,6 +236,7 @@ class X2goTerminalSessionSTDOUT(object): client_rootdir=os.path.join(_LOCAL_HOME, _X2GO_CLIENT_ROOTDIR), sessions_rootdir=os.path.join(_LOCAL_HOME, _X2GO_SESSIONS_ROOTDIR), client_instance=None, + session_instance=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ Initialize an X2go session. With the L{X2goTerminalSessionSTDOUT} class you can start @@ -293,6 +294,7 @@ class X2goTerminalSessionSTDOUT(object): self.print_action = print_action self.print_action_args = print_action_args self.printing_backend = printing_backend + self.session_instance = session_instance self.client_instance = client_instance self._mk_sessions_rootdir(self.params.rootdir) @@ -342,6 +344,13 @@ class X2goTerminalSessionSTDOUT(object): else: raise OSError, e + def set_session_instance(self, session_instance): + """\ + STILL UNDOCUMENTED + + """ + self.session_instance = session_instance + def get_session_name(self): """\ STILL UNDOCUMENTED @@ -379,6 +388,7 @@ class X2goTerminalSessionSTDOUT(object): remote_host='localhost', remote_port=4713, ssh_transport=self.control_session.get_transport(), + session_instance=self.session_instance, logger=self.logger ) else: @@ -404,6 +414,7 @@ class X2goTerminalSessionSTDOUT(object): remote_host='localhost', remote_port=16001, ssh_transport=self.control_session.get_transport(), + session_instance=self.session_instance, logger=self.logger ) diff --git a/x2go/client.py b/x2go/client.py index 70b3c24..59bf3c9 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -299,6 +299,8 @@ class X2goClient(object): self.logger('HOOK_pulseaudio_server_died: The pulseaudio daemon has just died away') def HOOK_on_sound_tunnel_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN'): self.logger('HOOK_on_sound_tunnel_failed: setting up X2go sound for %s (%s) support failed' % (profile_name, session_name)) + def HOOK_rforward_request_denied(self, profile_name='UNKNOWN', session_name='UNKNOWN', server_port=0): + self.logger('TCP port (reverse) forwarding request for session %s to server port %s has been denied by the X2go server. This is a common issue with SSH, it might help to restart the X2go server\'s SSH daemon.' % (session_name, server_port), loglevel=log.loglevel_WARN) def HOOK_on_session_has_started_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'): self.logger('HOOK_on_session_has_started_by_me (session_uuid: %s, profile_name: %s): a new session %s has been started by this application' % (session_uuid, profile_name, session_name), loglevel=log.loglevel_NOTICE) diff --git a/x2go/rforward.py b/x2go/rforward.py index 93fa5a0..9a0d0fe 100644 --- a/x2go/rforward.py +++ b/x2go/rforward.py @@ -77,7 +77,7 @@ class X2goRevFwTunnel(threading.Thread): through Paramiko/SSH. """ - def __init__(self, server_port, remote_host, remote_port, ssh_transport, logger=None, loglevel=log.loglevel_DEFAULT): + def __init__(self, server_port, remote_host, remote_port, ssh_transport, session_instance=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ Setup a reverse tunnel through Paramiko/SSH. @@ -115,6 +115,7 @@ class X2goRevFwTunnel(threading.Thread): self.remote_host = remote_host self.remote_port = remote_port self.ssh_transport = ssh_transport + self.session_instance = session_instance self.open_channels = {} self.incoming_channel = threading.Condition() @@ -184,8 +185,14 @@ class X2goRevFwTunnel(threading.Thread): # if port forward request fails, we try to tell the server to cancel all foregoing port forward requests on # self.server_port self.ssh_transport.cancel_port_forward('', self.server_port) - gevent.sleep(0.5) - self._requested_port = self.ssh_transport.request_port_forward('', self.server_port, handler=x2go_transport_tcp_handler) + gevent.sleep(1) + try: + self._requested_port = self.ssh_transport.request_port_forward('', self.server_port, handler=x2go_transport_tcp_handler) + except paramiko.SSHException, e: + if self.session_instance: + self.session_instance.HOOK_rforward_request_denied(server_port=self.server_port) + else: + self.logger('Encountered SSHException: %s (for reverse TCP port forward with local destination port %s' % (str(e), self.server_port), loglevel=log.loglevel_WARN) def run(self): """\ diff --git a/x2go/session.py b/x2go/session.py index f7dd3d6..fdde85b 100644 --- a/x2go/session.py +++ b/x2go/session.py @@ -183,6 +183,16 @@ class X2goSession(object): self.init_control_session() self.terminal_session = None + def HOOK_rforward_request_denied(self, server_port=0): + """\ + STILL UNDOCUMENTED + + """ + 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) + def init_control_session(self): """\ STILL UNDOCUMENTED @@ -613,6 +623,7 @@ class X2goSession(object): _terminal = _control.resume(session_name=self.session_name, logger=self.logger, **self.terminal_params) self.terminal_session = _terminal + self.terminal_session.set_session_instance(self) if self.session_name is None: _new_session = True 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).