SSH Remote Command

Discover more about the SSH Remote Command component and how to use it on the Digibee Integration Platform.

SSH Remote Command allows a connection with an SSH server to be established and shell scripts to be executed.

Parameters

Take a look at the configuration options for the component. Parameters supported by Double Braces expressions are marked with (DB).

Parameter
Description
Default value
Data type

Account (DB)

Account to be used by the component. Supported accounts: Basic, Kerberos, and Private Key.

N/A

String

Username (DB)

Must be used only when the account type is Private Key.

N/A

String

Host (DB)

Name of the host or IP address to make the connection.

N/A

String

Port (DB)

Number of the port - generally 22.

22

Integer

Server Host Key

Specifies any additional algorithms to be supported for the server host key configuration. Each algorithm must be set separately.

N/A

String

Public Key Algorithms

Specifies any additional algorithms to be supported for the public key algorithms configuration. Each algorithm must be set separately.

N/A

String

KEX Algorithms

Specifies any additional algorithms to be supported for the KEX (key exchange) algorithms configuration. Each algorithm must be set separately.

N/A

String

Custom Environment Variables

If the option is enabled, you must inform the environment variables in a custom way in the Environment Variables field (e.g., [{"key": "MYVAR", "value": "VAR_VALUE"}])

N/A

String (JSON)

Environment Properties

Name and value of the environment variables to be provided for the remote SSH server execution. These variables must be registered in sshd_config. Example of register in ssh_config: AcceptEnv MYVAR

N/A

String (JSON)

Command

Field used to specify the commands to be executed in the SSH server.

N/A

String

Ignore Output

If the option is enabled, the pipeline execution ignores the responses displayed in stdout or stderr in the SSH server. Otherwise, they’ll be displayed in the stdout and stderr fields of the component output.

False

Boolean

Stdout As File

If the option is enabled, the stdout result answer will be recorded in a file. Otherwise, it’ll be displayed as a string in the component output.

False

Boolean

Stdout File Name

Name of the file to be created with the stdout information.

N/A

String

Stderr As File

If the option is enabled, the stderr result answer will be recorded in a file. Otherwise, it’ll be displayed as a string in the component output.

False

Boolean

Stderr File Name

Name of the file to be created with the stderr information.

N/A

String

Connection Timeout

Expiration time of the connection with the server (in milliseconds).

30000

Integer

Server Alive Interval

Time the component will keep the connection active (in milliseconds).

30000

Integer

Fail On Error

If the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

False

Boolean

The SSH Remote Command connector uses an implementation library that has disabled by default specific algorithms that are considered unsafe. The Server Host Key, Public Key Algorithms and KEX Algorithms parameters are available for when it's necessary to enable those algorithms to be able to establish a SSH connection. Although is possible to use this configuration, it's not recommended to use unsafe algorithms.

Messages flow

Input

No specific input message is expected.

Output

When executing an SFTP component using the download, upload, or move operations, the following JSON structure will be generated:

{
    "stdout": "xpto",
    "stderr": "xpto_err",
    "stdoutFileName": "stdout.txt",
    "stderrFileName": "stderr.txt",
    "success": "true"
}
  • stdout: successful response of the script execution.

  • stderr: response with errors of the script execution.

  • stdoutFileName: file path saved with the information displayed in stdout. This property will be displayed only if the Stdout As File flag is enabled.

  • stderrFileName: file path saved with the information displayed in stderr. This property will be displayed only if the Stderr As File flag is enabled.

  • success: "true" if there’s been a connection and the script has been executed, even if errors in stderr were returned.

Output with error

{
 "success": false,
 "message": "Could not execute the SSH remote command",
 "error": "java.net.SocketTimeoutException: connect timed out"
}
  • success: “false” when the operation fails.

  • message: a message about the error.

  • exception: information about the occurred error type.

The file manipulation inside a pipeline occurs in a protected way. The files are available in a temporary directory that only the pipeline being executed has access to.

To better understand the messages flow in the Digibee Integration Platform, read the Messages processing article.

SSH Remote Command in Action

Executing a script and receiving the information in the component JSON answer

Hostname: <HOST>

Port: <PORT>

Command: echo $MYNAME && echo error output >&2

Environment Variables: [{"key":"MYNAME", "value":"TEST"}]

Stdout As File: disabled

Stderr As File: disabled

Fail On Error: disabled

Result:

{
    "stdout": "TEST",
    "stderr": "error output",
    "success": "true"
}

Executing a script and saving the information in files

Hostname: <HOST>

Port: <PORT>

Command: echo $MYNAME && echo error output >&2

Environment Variables: [{"key":"MYNAME", "value":"TEST"}]

Stdout As File: enabled

Stdout File Name: stdout.txt

Stderr As File: enabled

Stderr File Name: stderr.txt

Fail On Error: disabled

Result:

{
    "stdoutFileName": "stdout.txt",
    "stderrFileName": "stderr.txt",
    "success": "true"
}

Last updated