From 86b219debb3950df2f7acc2770dbb68a51e45d18 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 18 May 2018 15:23:48 -0500 Subject: [PATCH] Update sshtunnel.py A very simple change to use ProxyCommand facility in Paramiko in order to support host jumping mehod described in https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#Passing_Through_a_Gateway_Using_stdio_Forwarding_(Netcat_Mode) --- library/sshtunnel/sshtunnel.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/sshtunnel/sshtunnel.py b/library/sshtunnel/sshtunnel.py index 48c8c6157..b22605379 100644 --- a/library/sshtunnel/sshtunnel.py +++ b/library/sshtunnel/sshtunnel.py @@ -300,7 +300,8 @@ def _connect_ssh(self): has_key = bool(self._keyfile) self._client.connect(self._server[0], self._server[1], username=self._username, key_filename=self._keyfile, password=self._password, - look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT) + look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT, + sock=paramiko.ProxyCommand(opts['proxycommand']) if 'proxycommand' in opts else None) except paramiko.BadHostKeyException, exc: self.notify_exception_error('ERROR',format_bad_host_exception(exc, '%s\ssh\known_hosts' % mforms.App.get().get_user_data_folder() if platform.system().lower() == "windows" else "~/.ssh/known_hosts file")) return False