[X2Go-Commits] [python-x2go] 01/01: End session gracefully if we fail setting up the SSH agent forwarding socket.

git-admin at x2go.org git-admin at x2go.org
Mon Mar 9 13:01:35 CET 2015


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

x2go pushed a commit to branch master
in repository python-x2go.

commit 19feeccdd7c9fa1112545542f1ff816451cfec8e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Mon Mar 9 13:00:37 2015 +0100

    End session gracefully if we fail setting up the SSH agent forwarding socket.
---
 debian/changelog               |    2 ++
 x2go/backends/control/plain.py |   21 ++++++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f3fbe01..7a6d4b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ python-x2go (0.5.0.4-0x2go1) UNRELEASED; urgency=medium
 
   * New upstream version (0.5.0.4):
     - No such constant loglevel_WARNING, must be logolevel_WARN.
+    - End session gracefully if we fail setting up the SSH agent forwarding
+      socket.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Thu, 26 Feb 2015 10:16:25 +0100
 
diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py
index 3039b97..415973f 100644
--- a/x2go/backends/control/plain.py
+++ b/x2go/backends/control/plain.py
@@ -872,6 +872,7 @@ class X2GoControlSession(paramiko.SSHClient):
         @raise X2GoSSHProxyException: any SSH proxy exception is passed through while establishing the SSH proxy connection and tunneling setup
         @raise X2GoSSHAuthenticationException: any SSH proxy authentication exception is passed through while establishing the SSH proxy connection and tunneling setup
         @raise X2GoRemoteHomeException: if the remote home directory does not exist or is not accessible
+        @raise X2GoControlSessionException: if the remote peer has died event unexpectedly
 
         """
         _fake_hostname = None
@@ -1130,13 +1131,19 @@ class X2GoControlSession(paramiko.SSHClient):
 
             self.session_died = False
             self.query_server_features(force=True)
-            if self.forward_sshagent:
-                if x2go._paramiko.PARAMIKO_FEATURE['forward-ssh-agent']:
-                    self.agent_chan = ssh_transport.open_session()
-                    self.agent_handler = paramiko.agent.AgentRequestHandler(self.agent_chan)
-                    self.logger('Requesting SSH agent forwarding for control session of connected session profile %s' % self.profile_name, loglevel=log.loglevel_INFO)
-                else:
-                    self.logger('SSH agent forwarding is not available in the Paramiko version used with this instance of Python X2Go', loglevel=log.loglevel_WARN)
+            try:
+                if self.forward_sshagent:
+                    if x2go._paramiko.PARAMIKO_FEATURE['forward-ssh-agent']:
+                        self.agent_chan = ssh_transport.open_session()
+                        self.agent_handler = paramiko.agent.AgentRequestHandler(self.agent_chan)
+                        self.logger('Requesting SSH agent forwarding for control session of connected session profile %s' % self.profile_name, loglevel=log.loglevel_INFO)
+                    else:
+                        self.logger('SSH agent forwarding is not available in the Paramiko version used with this instance of Python X2Go', loglevel=log.loglevel_WARN)
+           except EOFError, e:
+                # if we come across an EOFError here, we must assume the session is dead...
+                self.session_died = True
+                raise x2go_exceptions.X2GoControlSessionException('The SSH connection was dropped while setting up SSH agent forwarding socket.')
+
         else:
             self.close()
             if self.sshproxy_session:

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


More information about the x2go-commits mailing list