Skip to content

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

@kishankarun

Description

@kishankarun

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 ssh@dut.com
    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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions