Available as of Camel 2.10
The SSH component enables access to SSH servers such that you can send an SSH command, and process the response.
Maven users will need to add the following dependency to their
pom.xml for this component:
<!-- use the same version as your Camel core version -->
Hostname of SSH Server
Port of the SSH Server
Username used for authenticating with SSH Server.
Password used for authenticating with SSH Server. Used if
keyPairProvider is null.
Refers to a
org.apache.sshd.common.KeyPairProvider to use for loading keys for authentication. If this option is used, then
password is not used.
Refers to a key type to load from
keyPairProvider. The key types can for example be "ssh-rsa" or "ssh-dss".
Camel 2.11: Path reference to a public key certificate. Prefix path with
certResource instead. Refers to a filename to use within file based
Milliseconds to wait beforing timing out connection to SSH Server.
Consumer Only Options
Milliseconds before polling the SSH server starts.
Milliseconds before the next poll of the SSH Server.
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.
Command to send to SSH Server during each poll cycle. You may need to end your command with a newline, and that must be URL encoded
Usage as a Producer endpoint
When the SSH Component is used as a Producer (
.to("ssh://...")), it will send the message body as the command to execute on the remote SSH server.
Here is an example of this within the XML DSL. Note that the command has an XML encoded newline (
The SSH Component can authenticate against the remote SSH server using one of two mechanisms: Public Key certificate or username/password. Configuring how the SSH Component does authentication is based on how and which options are set.
- First, it will look to see if the
certResource option has been set, and if so, use it to locate the referenced Public Key certificate and use that for authentication.
certResource is not set, it will look to see if a
keyPairProvider has been set, and if so, it will use that to for certificate based authentication.
- If neither
keyPairProvider are set, it will use the
password options for authentication.
The following route fragment shows an SSH polling consumer using a certificate from the classpath.
In the XML DSL,
In the Java DSL,
An example of using Public Key authentication is provided in
You will need to add some additional runtime dependencies if you use certificate based authentication. The dependency versions shown are as of Camel 2.11, you may need to use later versions depending what version of Camel you are using.
examples/camel-example-ssh-security in the Camel distribution.