SSHLibrary icon indicating copy to clipboard operation
SSHLibrary copied to clipboard

Connect via ssh to a remote machine from an intermediate (jump host) machine

Open kishankarun opened this issue 1 year ago • 0 comments

The current SSH Library supports connecting to a remote machine and execute commands.

In a case where there is a "jump" server which only has a connection to my actual targeted machine (Device Under Test [DUT]),

Development Machine (Laptop) ---> Jump Server (jumpserver.com) ---> DUT (dut.com)

This could be approached now in 2 tedious ways:

  1. Open Connection | jumpserver.com 1.1. Write [email protected] 1.2. Wait for password prompt and address it (check for prompt, provide password etc) 1.3. Keep using the combination of Write and Read for the commands to be executed (Write whoami, $result=Read 2s)

  2. Create a tunnel through jump server to the DUT and keep it running in the background (which will simulate a direct connection) 2.1. Connect to the tunnel and proceed to work as if the Laptop is connected directly to DUT

  • The first approach is too tedious as we don't get to leverage all the keywords provided by SSHLibrary, as it is dependent only on Write and Read
  • The second approach has a dependency on the created tunnel, and if the tunnel is broken, the tests start failing (especially challenging when run with automation tools like Jenkins)

Would it be possible to provide a 2 level Open Connection or a support for "nested" Open Connection, just in case there are more than one jump servers

Is there any alternate way to approach this situation?

kishankarun avatar Jul 06 '24 04:07 kishankarun