Plumbum - Nested SSH Remoting / Jump Host

228 Views Asked by At

Is there a good built-in way to connect through a 'jump host' with Plumbum.

I've thought about subclassing ParamikoMachine to provide my own SSHClient object.

Any other ideas?

1

There are 1 best solutions below

0
On BEST ANSWER

Try using ssh_opts of SshMachine: (see https://github.com/tomerfiliba/plumbum/blob/4e4a35394c1385721cc0e07eb6e9414f3466c5b3/plumbum/machines/ssh_machine.py#L60)

with SshMachine("finalhost", ssh_opts=["-o ProxyCommand='ssh -W finalhost:22 user@jumphost'"]) as rem:
    r_ls = rem["ls"]