From 540662296627b050150ab81ada77906dce209f89 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 25 Jul 2018 09:49:35 +0200 Subject: ssh_support: Set keepalive on Transport object This will set a keepalive on the Transport object to prevent disconnects by firewalls. --- rumba/ssh_support.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index cfe8c26..87ee0ab 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -95,6 +95,7 @@ def ssh_connect(hostname, port, username, password, time_out, proxy_server): look_for_keys=True, timeout=time_out) trans = proxy_client.get_transport() + trans.set_keepalive(30) proxy = trans.open_channel('direct-tcpip', (hostname, port), ('127.0.0.1', 0)) else: @@ -134,6 +135,7 @@ def ssh_chan(ssh_config, testbed, time_out): max_retries = 2 while retry < max_retries: try: + ssh_config.client.get_transport().set_keepalive(30) chan = ssh_config.client.get_transport().open_session() return chan except paramiko.ssh_exception.SSHException as e: -- cgit v1.2.3