ssh
Experimental. For evaluation. Interfaces, configuration, and behavior may change incompatibly.
Executes remote commands and transfers files through native SSH or Teleport.
Prerequisites
- Reachable SSH hosts and an authorized login. For managed Bash commands, the login user must belong to
group_nameon each target host. The default ismaestro-svc-usersand the group must already exist. - Worker-readable private key and trusted
known_hostsfile.
Setup
- Configure native SSH:
- Create
maestro-svc-usersand add the login user, or setgroup_nameto an existing group the user belongs to.
This module must be enabled in your Remediation Orchestrator config before it is available to scripts.
This module provides functionality for executing commands over SSH. It supports authentication via ssh-agent, private key (with optional passphrase), or password. Host key verification can be done using a known_hosts file or disabled (not recommended for untrusted networks).
Members
bash
ssh.bash(host, script, cluster_id?, env?, connection_strategy?, client_options_name?, timeout?, keep_descendants_alive?, node_id?)Execute a bash script (one-liner or multi-line) over SSH on the specified node. The script is passed via stdin to ‘bash -s’. Returns an ExecuteResult.
hoststringThe target host (hostname or IP address) to execute the script on.scriptstringThe Bash script string to execute.cluster_id?optionalstringThe cluster ID of the target host.env?optionaldict[string:string]A dict of environment variables (string:string) to set for the script.connection_strategy?optionalstringThe connection strategy to use for the SSH connection. Either ‘native’ or ‘teleport’. If not provided, the strategy is determined by modules.ssh.use_teleport, falling back to the ‘ssh_use_teleport’ feature flag when the setting is absent. Set this explicitly when a workflow needs to override that default.client_options_name?optionalstringThe name of the client options to use for the SSH connection. If not provided, the default client options are used.timeout?optionalstringTimeout duration as a string (e.g. ‘2m’, ’30s’, ‘1h’). If not provided, no user timeout is applied. Instead, Temporal will timeout the activity based on the default timeout policy.keep_descendants_alive?optionalboolIf true, only kill the wrapper processes (nohup, sg, sh, bash) on timeout, leaving spawned descendant processes running. If false (default), kill all descendants.node_id?optionalstringOptional node-registry identity used to resolve the transport host.resultssh.ExecuteResultAn ExecuteResult object containing stdout, stderr, and exit_code.execute
ssh.execute(host, command, cluster_id?, env?, stdin?, node_id?, activity_timeout?, maximum_attempts?)Execute a command over SSH on the specified host. Returns an ExecuteResult.
hoststringThe target host (hostname or IP address) for the SSH command.commandstringThe command string to execute.cluster_id?optionalstringThe cluster ID of the target host.env?optionaldict[string:string]A dict of environment variables (string:string) to set for the command.stdin?optionalstringOptional string content to pass to the command’s standard input.node_id?optionalstringOptional node-registry identity used to resolve the transport host.activity_timeout?optionalstringOptional per-call Temporal activity budget such as 31m. Both start-to-close and schedule-to-close use this value.maximum_attempts?optionalintOptional maximum Temporal activity attempts. Zero preserves the SSH module default; one disables retries.resultssh.ExecuteResultAn ExecuteResult object containing stdout, stderr, and exit_code.write_file
ssh.write_file(host, path, file, cluster_id?)Write a file to a remote host via SFTP. Creates parent directories if needed.
hoststringThe target host (hostname or IP address) to write the file to.pathstringThe destination path on the remote host.filescriptrt.FileThe File object to transfer.cluster_id?optionalstringThe cluster ID of the target host.bytes_writtenintNumber of bytes written to the remote file.