X2Go dev team | 9 Oct 13:16 2012

python-x2go.git - master (branch) updated: 0.2.0.10-25-g2c2e237

The branch, master has been updated
       via  2c2e237a244d60c893b607249cf3bce65ca8ff7b (commit)
       via  cac70a5c83b14573d816108094bea2b9700b70f9 (commit)
      from  54ba077c24f31891f5c466e5a0ba3a39897c8a53 (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 -----------------------------------------------------------------
commit 2c2e237a244d60c893b607249cf3bce65ca8ff7b
Author: Mike Gabriel <mike.gabriel <at> das-netzwerkteam.de>
Date:   Tue Oct 9 13:16:37 2012 +0200

    bump version towards 0.2.1.0

commit cac70a5c83b14573d816108094bea2b9700b70f9
Author: Mike Gabriel <mike.gabriel <at> das-netzwerkteam.de>
Date:   Tue Oct 9 13:15:54 2012 +0200

    Implement SSH agent authentication forwarding.

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                               |    5 +++--
 x2go/__init__.py                               |    2 +-
 x2go/backends/control/_stdout.py               |   14 +++++++++++++-
 x2go/client.py                                 |    5 ++++-
 x2go/defaults.py                               |    2 +-
 x2go/{monkey_patch_paramiko.py => paramiko.py} |    9 ++++++++-
 x2go/registry.py                               |    4 ++++
 x2go/session.py                                |    5 +++++
 x2go/utils.py                                  |   23 +++++++++++++++++++++++
 9 files changed, 62 insertions(+), 7 deletions(-)
 rename x2go/{monkey_patch_paramiko.py => paramiko.py} (92%)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 9811041..d44d061 100644
--- a/debian/changelog
+++ b/debian/changelog
 <at>  <at>  -1,6 +1,6  <at>  <at> 
-python-x2go (0.2.0.11-0~x2go1) UNRELEASED; urgency=low
+python-x2go (0.2.1.0-0~x2go1) UNRELEASED; urgency=low

-  * New upstream version (0.2.0.11):
+  * New upstream version (0.2.1.0):
     - Prepare for staying compatible with new SSH proxy feature
       in X2Go Client.
     - Add sshproxy_port option to session (SSH proxy) options.
 <at>  <at>  -16,6 +16,7  <at>  <at>  python-x2go (0.2.0.11-0~x2go1) UNRELEASED; urgency=low
       _NET_WORKAREA is not available from the window manager.
     - Mention ,,maximize'' as possible value for session option geometry
       in __doc__string of class X2goTerminalSessionSTDOUT.
+    - Implement SSH agent authentication forwarding.
   * /debian/rules:
     + Allow package build on systems with missing dh_python2.

diff --git a/x2go/__init__.py b/x2go/__init__.py
index 4292a8d..b0567cd 100644
--- a/x2go/__init__.py
+++ b/x2go/__init__.py
 <at>  <at>  -178,7 +178,7  <at>  <at>  Contact
 """

 __NAME__    = 'python-x2go'
-__VERSION__ = '0.2.0.11'
+__VERSION__ = '0.2.1.0'

 from gevent import monkey
 monkey.patch_all()
diff --git a/x2go/backends/control/_stdout.py b/x2go/backends/control/_stdout.py
index 7e8259b..903ef37 100644
--- a/x2go/backends/control/_stdout.py
+++ b/x2go/backends/control/_stdout.py
 <at>  <at>  -38,6 +38,7  <at>  <at>  import locale
 import threading
 import cStringIO

+from distutils import version
 from gevent import socket

 # Python X2Go modules
 <at>  <at>  -117,6 +118,7  <at>  <at>  class X2goControlSessionSTDOUT(paramiko.SSHClient):
                  profile_name='UNKNOWN',
                  add_to_known_hosts=False,
                  known_hosts=None,
+                 forward_sshagent=False,
                  terminal_backend=_X2goTerminalSession,
                  info_backend=_X2goServerSessionInfo,
                  list_backend=_X2goServerSessionList,
 <at>  <at>  -140,6 +142,8  <at>  <at>  class X2goControlSessionSTDOUT(paramiko.SSHClient):
          <at> type add_to_known_hosts: C{bool}
          <at> param known_hosts: the underlying Paramiko/SSH systems C{known_hosts} file
          <at> type known_hosts: C{str}
+         <at> param forward_sshagent: forward SSH agent authentication requests to the X2Go client-side
+         <at> type forward_sshagent: C{bool}
          <at> param terminal_backend: X2Go terminal session backend to use
          <at> type terminal_backend: C{class}
          <at> param info_backend: backend for handling storage of server session information
 <at>  <at>  -173,6 +177,7  <at>  <at>  class X2goControlSessionSTDOUT(paramiko.SSHClient):
         self.profile_name = profile_name
         self.add_to_known_hosts = add_to_known_hosts
         self.known_hosts = known_hosts
+        self.forward_sshagent = forward_sshagent

         self.hostname = None
         self.port = None
 <at>  <at>  -825,9 +830,16  <at>  <at>  class X2goControlSessionSTDOUT(paramiko.SSHClient):
         ssh_transport._x2go_session_marker = True
         self._session_password = password

-        if self.get_transport():
+        if ssh_transport is not None:
             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)

         self._remote_home = None
         if not self.home_exists():
diff --git a/x2go/client.py b/x2go/client.py
index 53a3ab2..a22df3a 100644
--- a/x2go/client.py
+++ b/x2go/client.py
 <at>  <at>  -856,7 +856,7  <at>  <at>  class X2goClient(object):
                          allow_printing=False, 
                          allow_share_local_folders=False, share_local_folders=[], 
                          allow_mimebox=False, mimebox_extensions=[], mimebox_action='OPEN',
-                         add_to_known_hosts=False, known_hosts=None,
+                         add_to_known_hosts=False, known_hosts=None, forward_sshagent=False,
                          proxy_options={},
                          return_object=False, **kwargs):
         """\
 <at>  <at>  -913,6 +913,8  <at>  <at>  class X2goClient(object):
          <at> type add_to_known_hosts: C{bool}
          <at> param known_hosts: full path to C{known_hosts} file
          <at> type known_hosts: C{str}
+         <at> param forward_sshagent: forward SSH agent authentication requests to the X2Go client-side
+         <at> type forward_sshagent: C{bool}
          <at> param proxy_options: a set of very C{X2goProxy*} backend specific options; any option that is not known
             to the C{X2goProxy*} backend will simply be ignored
          <at> type proxy_options: C{dict}
 <at>  <at>  -992,6 +994,7  <at>  <at>  class X2goClient(object):
                                                       keep_controlsession_alive=True,
                                                       add_to_known_hosts=add_to_known_hosts,
                                                       known_hosts=known_hosts,
+                                                      forward_sshagent=forward_sshagent,
                                                       **_params)

         self.logger('initializing X2Go session...', log.loglevel_NOTICE, tag=self._logger_tag)
diff --git a/x2go/defaults.py b/x2go/defaults.py
index 96115f3..73816cb 100644
--- a/x2go/defaults.py
+++ b/x2go/defaults.py
 <at>  <at>  -304,7 +304,7  <at>  <at>  X2GO_SESSIONPROFILE_DEFAULTS = {
     'usekbd': True, 'layout': 'us', 'type': 'pc105/us', 'variant': '',
     'sound': False, 'soundsystem': 'pulse', 'startsoundsystem': False, 'soundtunnel':True,
'defsndport':True, 'sndport':4713,
     'name': 'NEW_PROFILE', 'icon': ':icons/128x128/x2gosession.png',
-    'host': 'server.mydomain', 'user': CURRENT_LOCAL_USER, 'key': '', 'sshport': 22, 'krblogin': False,
+    'host': 'server.mydomain', 'user': CURRENT_LOCAL_USER, 'key': '', 'sshport': 22, 'krblogin':
False, 'forwardsshagent': False,
     'rootless': True, 'applications': X2GO_GENERIC_APPLICATIONS, 'command':'TERMINAL', 'published': False,
     'directrdp': False, 'directrdpsettings': '', 'rdpclient': 'rdesktop', 'rdpport': 3389,
     'rdpoptions': '-u X2GO_USER -p X2GO_PASSWORD', 'rdpserver': '',
diff --git a/x2go/monkey_patch_paramiko.py b/x2go/paramiko.py
similarity index 92%
rename from x2go/monkey_patch_paramiko.py
rename to x2go/paramiko.py
index f9b373b..caafb5f 100644
--- a/x2go/monkey_patch_paramiko.py
+++ b/x2go/paramiko.py
 <at>  <at>  -18,11 +18,18  <at>  <at> 
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

 """\
-Monkey Patch for Python Paramiko
+Monkey Patch and feature map for Python Paramiko

 """

 import paramiko
+from x2go.utils import compare_versions
+
+PARAMIKO_VERSION = paramiko.__version__.split()[0]
+PARAMIKO_FEATURE = {
+    'forward-ssh-agent': compare_versions(PARAMIKO_VERSION, ">=", '1.8'),
+    'use-compression': compare_versions(PARAMIKO_VERSION, ">=", '1.7.7.1'),
+}

 def _SSHClient_save_host_keys(self, filename):
     """\
diff --git a/x2go/registry.py b/x2go/registry.py
index 85ddf3f..61ceba3 100644
--- a/x2go/registry.py
+++ b/x2go/registry.py
 <at>  <at>  -460,6 +460,7  <at>  <at>  class X2goSessionRegistry(object):
                  keep_controlsession_alive=True,
                  add_to_known_hosts=False,
                  known_hosts=None,
+                 forward_sshagent=False,
                  **kwargs):
         """\
         Register a new L{X2goSession} instance with this L{X2goSessionRegistry}.
 <at>  <at>  -498,6 +499,8  <at>  <at>  class X2goSessionRegistry(object):
          <at> type add_to_known_hosts: C{bool}
          <at> param known_hosts: the underlying Paramiko/SSH systems C{known_hosts} file
          <at> type known_hosts: C{str}
+         <at> param forward_sshagent: forward SSH agent authentication requests to the X2Go client-side
+         <at> type forward_sshagent: C{bool}
          <at> param kwargs: all other options will be passed on to the constructor of the to-be-instantiated
L{X2goSession} instance
          <at> type C{dict}

 <at>  <at>  -555,6 +558,7  <at>  <at>  class X2goSessionRegistry(object):
                                 keep_controlsession_alive=keep_controlsession_alive,
                                 add_to_known_hosts=add_to_known_hosts,
                                 known_hosts=known_hosts,
+                                forward_sshagent=forward_sshagent,
                                 logger=self.logger, **kwargs)

         session_uuid = s._X2goSession__get_uuid()
diff --git a/x2go/session.py b/x2go/session.py
index 346a452..73cc969 100644
--- a/x2go/session.py
+++ b/x2go/session.py
 <at>  <at>  -155,6 +155,7  <at>  <at>  class X2goSession(object):
                  keep_controlsession_alive=False,
                  add_to_known_hosts=False,
                  known_hosts=None,
+                 forward_sshagent=False,
                  logger=None, loglevel=log.loglevel_DEFAULT,
                  connected=False, activated=False, virgin=True, running=None, suspended=None, terminated=None, faulty=None,
                  client_instance=None,
 <at>  <at>  -216,6 +217,8  <at>  <at>  class X2goSession(object):
          <at> type add_to_known_hosts: C{bool}
          <at> param known_hosts: the underlying Paramiko/SSH systems C{known_hosts} file
          <at> type known_hosts: C{str}
+         <at> param forward_sshagent: forward SSH agent authentication requests to the SSH agent on the X2Go client-side
+         <at> type forward_sshagent: C{bool}
          <at> param connected: manipulate session state »connected« by giving a pre-set value
          <at> type connected: C{bool}
          <at> param activated: normal leave this untouched, an activated session is a session that is about to be used
 <at>  <at>  -330,6 +333,7  <at>  <at>  class X2goSession(object):

         self.add_to_known_hosts = add_to_known_hosts
         self.known_hosts = known_hosts
+        self.forward_sshagent = forward_sshagent

         self._current_status = {
             'timestamp': time.time(),
 <at>  <at>  -504,6 +508,7  <at>  <at>  class X2goSession(object):
             self.control_session = self.control_backend(profile_name=self.profile_name,
                                                         add_to_known_hosts=self.add_to_known_hosts,
                                                         known_hosts=self.known_hosts,
+                                                        forward_sshagent=self.forward_sshagent,
                                                         terminal_backend=self.terminal_backend,
                                                         info_backend=self.info_backend,
                                                         list_backend=self.list_backend,
diff --git a/x2go/utils.py b/x2go/utils.py
index f8dee91..49aa9d6 100644
--- a/x2go/utils.py
+++ b/x2go/utils.py
 <at>  <at>  -33,6 +33,7  <at>  <at>  import socket
 import gevent
 import string
 import subprocess
+import distutils.version

 # Python X2Go modules
 from defaults import X2GOCLIENT_OS as _X2GOCLIENT_OS
 <at>  <at>  -209,6 +210,7  <at>  <at>  def _convert_SessionProfileOptions_2_SessionParams(options):
             'published': 'published_applications',
             'autostart': 'auto_start_or_resume',
             'autologin': 'auto_connect',
+            'forwardsshagent': 'forward_sshagent',

     }
     _speed_dict = {
 <at>  <at>  -720,3 +722,24  <at>  <at>  def merge_ordered_lists(l1, l2):

     return ordered_list

+def compare_versions(version_a, op, version_b):
+    """\
+    Compare <version_a> with <version_b> using operator <op>.
+    In the background C{distutils.version.LooseVersion} is
+    used for the comparison operation.
+
+     <at> param version_a: a version string
+     <at> type version_a: C{str}
+     <at> param op: an operator provide as string (e.g. '<', '>', '==', '>=' etc.)
+     <at> type op: C{str}
+     <at> param version_b: another version string that is to be compared with <version_a>
+     <at> type version_b: C{str}
+
+    """
+
+    ### FIXME: this comparison is not reliable with beta et al. version strings
+
+    ver_a = distutils.version.LooseVersion(version_a)
+    ver_b = distutils.version.LooseVersion(version_b)
+
+    return eval("ver_a %s ver_b" % op)

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).

_______________________________________________
X2go-commits mailing list
X2go-commits <at> lists.berlios.de
https://lists.berlios.de/mailman/listinfo/x2go-commits

Gmane