Camel Spring Boot

SSH

Execute commands on remote hosts using SSH.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-ssh-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 33 options, which are listed below.

Name Description Default Type

camel.component.ssh.allow-username-and-password-from-headers

Whether the producer may take the user name and the password from the CamelSshUsername and CamelSshPassword headers, in place of the username and password options. The CamelSshUsername header is then also used with public key authentication (certResource or keyPairProvider): the configured key logs in as the user that the header names. This is disabled by default, and the headers are then ignored. Enable it only when the route sets these headers itself.

false

Boolean

camel.component.ssh.auth-timeout

The time in milliseconds that Apache MINA SSHD allows for the authentication before it closes the session. If 0 or less, its default of 2 minutes applies. The timeout option also limits how long the component waits for the authentication.

Long

camel.component.ssh.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.ssh.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.ssh.cert-resource

The resource with the private key for public key authentication, in OpenSSH or PEM format, for example classpath:id_ed25519 or file:/home/camel/.ssh/id_ed25519. When set, it is used instead of keyPairProvider, and the password option and the CamelSshPassword header are not used.

String

camel.component.ssh.cert-resource-password

The passphrase of the private key in certResource, when that key is encrypted.

String

camel.component.ssh.channel-open-timeout

The time in milliseconds that the component waits for the channel that runs the command to open. If 0 or less, the timeout option applies.

Long

camel.component.ssh.channel-type

The type of SSH channel that runs the command: exec runs it as a single command, and shell writes it to an interactive shell and reads the output up to the shellPrompt text. The endpoint fails to start with another value.

exec

String

camel.component.ssh.ciphers

A comma-separated list of the ciphers that the client proposes, in order of preference, for example aes256-ctr,aes128-ctr. It replaces the default list of Apache MINA SSHD. Names that are not known are skipped with a warning.

String

camel.component.ssh.client-builder

To use a custom org.apache.sshd.client.ClientBuilder to create the SSH client, for example to set a ServerKeyVerifier. The producer and the consumer each create a client with it when they start, and the options of this endpoint that are set are applied over its settings. The option is a org.apache.sshd.client.ClientBuilder type.

ClientBuilder

camel.component.ssh.compressions

A comma-separated list of the compression algorithms that the client proposes, in order of preference, for example zlib,none. If not set, the client uses no compression.

String

camel.component.ssh.configuration

The shared configuration of the endpoints: each endpoint starts from a copy of it. The option is a org.apache.camel.component.ssh.SshConfiguration type.

SshConfiguration

camel.component.ssh.connect-timeout

The time in milliseconds that the socket connection to the server may take. If 0 or less, the default of Apache MINA SSHD, 1 minute, applies. The timeout option also limits how long the component waits for the connection.

Long

camel.component.ssh.enabled

Whether to enable auto configuration of the ssh component. This is enabled by default.

Boolean

camel.component.ssh.fail-on-unknown-host

Whether to reject a server whose host has no entry without a marker in knownHostsResource. When false, such a server is accepted and a warning is logged. A server whose host has such entries is always rejected when none of them lists the key it presents, and so is a key listed in a matching entry with the revoked marker. This option has no effect when knownHostsResource is not set.

false

Boolean

camel.component.ssh.health-check-consumer-enabled

Used for enabling or disabling all consumer based health checks from this component

true

Boolean

camel.component.ssh.health-check-producer-enabled

Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true.

true

Boolean

camel.component.ssh.heartbeat-interval

The interval in milliseconds at which the client sends keep-alive requests to the server while a command runs. If 0 or less, no keep-alive requests are sent.

Long

camel.component.ssh.heartbeat-reply-max-wait

The number of keep-alive requests without reply after which the client closes the session, when heartbeatInterval is set. If 0 or less, the default of Apache MINA SSHD applies.

Integer

camel.component.ssh.idle-timeout

The time in milliseconds after which Apache MINA SSHD closes a session without traffic. The session is open while a command runs. The default, 10 minutes, is the default of Apache MINA SSHD. If 0 or less, the session has no idle timeout.

600000

Long

camel.component.ssh.kex

A comma-separated list of the key exchange algorithms that the client proposes, in order of preference, for example mlkem768x25519-sha256,curve25519-sha256. It replaces the default list of Apache MINA SSHD, which already proposes the post-quantum hybrid algorithms. Names that are not known are skipped with a warning.

String

camel.component.ssh.key-pair-provider

The org.apache.sshd.common.keyprovider.KeyPairProvider that gives the key pair for public key authentication. It is not used when certResource is set, and when it is used, the password option and the CamelSshPassword header are not. The option is a org.apache.sshd.common.keyprovider.KeyPairProvider type.

KeyPairProvider

camel.component.ssh.key-type

The key type of the key pair to use from certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-sha2-nistp256. If not set, the first key pair is used.

String

camel.component.ssh.known-hosts-resource

The resource of a file in the OpenSSH known_hosts format, such as file:/etc/camel/known_hosts, that the server host key is verified against. It is read at each connection, and a resource or a line that cannot be read makes every connection fail. When not set, the server host key is not verified and any server is accepted, unless clientBuilder sets a ServerKeyVerifier, which this option replaces when it is set.

String

camel.component.ssh.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.ssh.macs

A comma-separated list of the message authentication code (MAC) algorithms that the client proposes, in order of preference, for example hmac-sha2-512,hmac-sha2-256. It replaces the default list of Apache MINA SSHD. Names that are not known are skipped with a warning.

String

camel.component.ssh.password

The password for password authentication, which is used only when neither certResource nor keyPairProvider is set. With allowUsernameAndPasswordFromHeaders=true, the CamelSshPassword header replaces it for the producer.

String

camel.component.ssh.poll-command

The command that the consumer runs on the SSH server at each poll. The consumer needs it, as each poll fails without it. Some servers need the command to end with a newline, which is written %0A in an endpoint URI.

String

camel.component.ssh.shell-prompt

The text that the shell prompt ends with, which channelType=shell needs: the endpoint fails to start without it. The component reads the output of the shell until it ends with this text, before and after it writes the command, and the message body is the text between the first and the last line break of that output.

String

camel.component.ssh.signatures

A comma-separated list of the signature algorithms that the client supports, in order of preference, for example ssh-ed25519,rsa-sha2-512. It replaces the default list of Apache MINA SSHD. Names that are not known are skipped with a warning.

String

camel.component.ssh.sleep-for-shell-prompt

The time in milliseconds between two reads of the shell output while the component waits for the shellPrompt text, with channelType=shell.

100

Long

camel.component.ssh.timeout

The time in milliseconds that the component waits for each step of setting up the session: the connection, the authentication and the opening of the channel, unless channelOpenTimeout is set. It does not limit how long the command runs.

30000

Long

camel.component.ssh.username

The user name to log in with. With allowUsernameAndPasswordFromHeaders=true, the CamelSshUsername header replaces it for the producer.

String