diff options
-rw-r--r-- | rumba/model.py | 3 | ||||
-rw-r--r-- | rumba/ssh_support.py | 16 | ||||
-rw-r--r-- | rumba/testbeds/jfed.py | 5 |
3 files changed, 21 insertions, 3 deletions
diff --git a/rumba/model.py b/rumba/model.py index c2c4cfa..4ada554 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -128,9 +128,10 @@ class NormalDIF(DIF): # SSH Configuration # class SSHConfig: - def __init__(self, hostname, port=22): + def __init__(self, hostname, port=22, proxycommand=None): self.hostname = hostname self.port = port + self.proxycommand = proxycommand # A node in the experiment # diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index 30ada62..e66db43 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -49,10 +49,16 @@ def execute_commands(testbed, ssh_config, commands, time_out=3): ''' ssh_client = get_ssh_client() + if ssh_config.proxycommand != None: + proxy = paramiko.ProxyCommand(ssh_config.proxycommand) + else: + proxy = None + try: ssh_client.connect(ssh_config.hostname, ssh_config.port, testbed.username, testbed.password, - look_for_keys=True, timeout=time_out) + look_for_keys=True, timeout=time_out, + sock=proxy) o = "" for command in commands: print("%s@%s:%s >> %s" % (testbed.username, @@ -101,11 +107,17 @@ def copy_file_to_testbed(testbed, ssh_config, text, file_name): ''' ssh_client = get_ssh_client() + if ssh_config.proxycommand != None: + proxy = paramiko.ProxyCommand(ssh_config.proxycommand) + else: + proxy = None + try: ssh_client.connect(ssh_config.hostname, ssh_config.port, testbed.username, testbed.password, - look_for_keys=True) + look_for_keys=True, + sock=proxy) cmd = "touch " + file_name + \ "; chmod a+rwx " + file_name diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index 0dfc904..f09bb4e 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -113,6 +113,11 @@ class Testbed(mod.Testbed): auth_name_r = self.auth_name.replace(".", "-") node.ssh_config.hostname = node.name + "." + self.exp_name + "." + \ auth_name_r + "." + self.auth_name + node.ssh_config.proxycommand = "ssh -i '" + self.cert_file + \ + "' -o StrictHostKeyChecking=no " + \ + self.username + \ + "@bastion.test.iminds.be nc " + \ + node.ssh_config.hostname + " 22" subprocess.call(["java", "-jar", self.jfed_jar, "create", "-S", \ self.proj_name, "--rspec", \ |