Open SSH Tunnel

Opens an SSH tunnel using the opened SSH connection to the server, remote and local ports, the destination and the host.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Opens an SSH tunnel using the opened SSH connection to the server, remote and local ports, the destination and the host.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

openSSHTunnel --client(SSHSession) --port(Numeric) --boundport(Numeric) [--destination(DestinationType)] [--host(String)] (SSHForwardedPort)=value

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
SSH Connection client Required SSH Session Variable containing the opened SSH connection.
Remote Port port Required Number Destination host port number.
Local Port boundport Required Number Source host port number.
Destination destination Optional DestinationType Destination selection option:

- Local

- Remote
Host host Optional Text Path to the destination host.

Output parameters

Designer mode label Script mode name Accepted variable types Description
SSH Tunnel value SSH Forwarded SSH tunnel with the connection established.

Example

A connection to an SSH server is initiated and tunneling to the destination server is opened, and the command "ls" is sent to get the file list from the current directory of the destination server.

defVar --name sshConnection --type SSHSession
defVar --name sshTunnel --type SSHForwardedPort
defVar --name result --type String
// Initiates the connection to an SSH server and tunneling to the destination server.
startSSH --host "172.16.4.200" --username "User Name" --password password --port 22 --keygen "File with private key" --passphrase "password phrase" --timeout 00:00:05 sshConnection=value
openSSHTunnel --client ${sshConnection} --port 80 --boundport 8090 --destination "Local" --host "192.168.0.10" sshTunnel=value
// Sending the "ls" command to the SSH server for a list of file names from the current directory of the destination server.
executeSSH --client ${sshConnection} --command ls --timeout 00:00:05 result=value
// Connection to an SSH server to send commands to it is demonstrated.
//All host, port, and connection data is for example only, with both client services and SSH server installed.
// The user must enter valid data for a valid SSH connection!

Limitations

The open connection required by the SSH Connection parameter is generated by the SSH Login command.