Close SSH Tunnel
Verb: closeSSHTunnel
Available from: <Enterprise>
Closes an SSH tunnel.
Syntax
closeSSHTunnel --forwardedport(SSHForwardedPort)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--forwardedport | SSH Tunnel | Required | SSH Forwarded | Variable containing the data of the connection established with the SSH tunnel.
The required variable is generated by the Open SSH Tunnel command. |
Example
The command Close SSH Tunnel closes the SSH tunnel opened from the connection initiated with the server by the command SSH Login. This connection was previously used to send the command "Is", through the command Run SSH Command, to get the list of files in the current directory on the destination server.
defVar --name sshConnection --type SSHSession
defVar --name sshTunnel --type SSHForwardedPort
defVar --name result --type String
// Initiates the connection with an SSH server and tunneling with the destination server.
startSSH --host "172.16.4.200" --username "User Name" --password password --port 22 --keygen "File with private key" --passphrase "Key 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 command "ls" to the SSH server, to obtain a list of the names of the files in the current directory of the destination server.
executeSSH --client ${sshConnection} --command ls --timeout 00:00:05 result=value
// Closes the established SSH tunnel.
closeSSHTunnel --forwardedport ${sshTunnel}
// Terminate the SSH connection.
closeSSH --client ${sshConnection}
// The connection to an SSH server is demonstrated to send commands to it. All host, port and connection data are for example only, requiring the client services and the SSH server to be installed.