This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new a5fcef2db chore: ssh-source and ssh-sink can log in with a private key
(#3170) (#3197)
a5fcef2db is described below
commit a5fcef2db89648991365a5e3e463052be2b622ec
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 18 15:12:08 2026 +0100
chore: ssh-source and ssh-sink can log in with a private key (#3170) (#3197)
Many SSH servers turn off password login, and the SSH Kamelets could
only log in with a password, which was required.
Both Kamelets now take, all optional and without a default:
- privateKeyResource, mapped to certResource (file:, classpath:, http:
or https:, with the same pattern as knownHostsResource)
- privateKeyPassphrase, mapped to certResourcePassword in RAW(), a
secret
- failOnUnknownHost, which refuses a server not listed in
knownHostsResource
- timeout, for the connection, the login and the start of the command
password is no longer required and is now optional in the URI. With a
key set, camel-ssh logs in with the key only; with neither set, every
command fails with "No password provided" before anything is sent.
When none of the new options is set the endpoint URI is the same as
before, checked with camel get endpoint.
Verified with Camel JBang against OpenSSH servers with and without
password login: OpenSSH and PEM keys with and without a passphrase,
wrong keys and passphrases, password login, host key checking and the
timeout.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../ROOT/partials/ssh-sink-description.adoc | 36 +++++++++++++++++++++-
.../ROOT/partials/ssh-source-description.adoc | 36 +++++++++++++++++++---
kamelets/ssh-sink.kamelet.yaml | 29 ++++++++++++++---
kamelets/ssh-source.kamelet.yaml | 29 ++++++++++++++---
.../main/resources/META-INF/kamelets-index.json | 4 +--
.../main/resources/kamelets/ssh-sink.kamelet.yaml | 29 ++++++++++++++---
.../resources/kamelets/ssh-source.kamelet.yaml | 29 ++++++++++++++---
7 files changed, 169 insertions(+), 23 deletions(-)
diff --git a/docs/modules/ROOT/partials/ssh-sink-description.adoc
b/docs/modules/ROOT/partials/ssh-sink-description.adoc
index dd644ca72..bf470523d 100644
--- a/docs/modules/ROOT/partials/ssh-sink-description.adoc
+++ b/docs/modules/ROOT/partials/ssh-sink-description.adoc
@@ -10,7 +10,40 @@ The body of each message is run as a command in the shell of
`username`, and the
=== Authentication Methods
-The Kamelet logs in with a username and a password. The key of the server is
checked only when `knownHostsResource` is set; without it, any server is
accepted.
+The Kamelet logs in as `username`, either with `password` or with a private
key in `privateKeyResource`. Use the key when the server does not take
passwords. When a key is set, the password is not used.
+
+- `privateKeyResource` is where to read the key from: `file:` followed by the
path of the key file, `classpath:`, `http:` or `https:`. OpenSSH keys, such as
those made with `ssh-keygen`, and PEM keys can be read. The matching public key
must be in the `authorized_keys` file of `username` on the server.
+- `privateKeyPassphrase` is the passphrase of the key, when it has one.
+
+The key of the server is checked only when `knownHostsResource` is set;
without it, any server is accepted. A server that is not listed in that file is
still accepted, unless `failOnUnknownHost` is true. A server that is listed
with another key is always refused. The lines of the file can be made with
`ssh-keyscan`, such as `ssh-keyscan -p 22 server.example.com > known_hosts`.
+
+`connectTimeout` is how long to wait for the connection, for the login and for
the command to start, in milliseconds (30000 when it is not set). It does not
limit how long the command runs.
+
+=== Example with a Private Key
+
+[source,yaml,subs='+attributes,macros']
+----
+- route:
+ from:
+ uri: "kamelet:webhook-source"
+ parameters:
+ subpath: "restart"
+ steps:
+ - setBody:
+ constant: "systemctl restart myapp"
+ - to:
+ uri: "kamelet:ssh-sink"
+ parameters:
+ connectionHost: "server.example.com"
+ connectionPort: "22"
+ username: "deploy"
+ privateKeyResource: "file:/etc/ssh-keys/id_ed25519"
+ privateKeyPassphrase: "{{ssh.key.passphrase}}"
+ knownHostsResource: "file:/etc/ssh-keys/known_hosts"
+ failOnUnknownHost: true
+----
+
+The command is fixed in the route, not taken from the request, so that callers
of the webhook cannot choose what runs on the server.
=== Security Features
@@ -18,6 +51,7 @@ SSH provides comprehensive security features:
- Strong encryption for all communications
- Host key verification, when `knownHostsResource` is set
+- Login with a private key, when `privateKeyResource` is set
- User authentication and authorization
- Session integrity and confidentiality
diff --git a/docs/modules/ROOT/partials/ssh-source-description.adoc
b/docs/modules/ROOT/partials/ssh-source-description.adoc
index 17cf67208..397e50425 100644
--- a/docs/modules/ROOT/partials/ssh-source-description.adoc
+++ b/docs/modules/ROOT/partials/ssh-source-description.adoc
@@ -2,7 +2,7 @@
=== Authentication
-This Kamelet supports SSH authentication using username and password
credentials. It can execute commands on remote SSH servers and retrieve the
output.
+The Kamelet logs in as `username`, either with `password` or with a private
key in `privateKeyResource`. Use the key when the server does not take
passwords. When a key is set, the password is not used. It runs the command on
the server and sends what it printed.
=== Configuration
@@ -11,9 +11,13 @@ The SSH Source Kamelet supports the following configurations:
- **Connection Host** (`connectionHost`): SSH server hostname or IP address
(required)
- **Connection Port** (`connectionPort`): SSH server port (default: 22)
- **Username** (`username`): Username for SSH authentication (required)
-- **Password** (`password`): Password for SSH authentication (required)
+- **Password** (`password`): Password of `username`; leave it empty to log in
with a private key
+- **Private Key Resource** (`privateKeyResource`): private key to log in with,
such as `file:/etc/ssh-keys/id_ed25519`; OpenSSH and PEM keys can be read
+- **Private Key Passphrase** (`privateKeyPassphrase`): passphrase of the
private key, when it has one
- **Poll Command** (`pollCommand`): Command to execute on the remote server
(required)
- **Known Hosts Resource** (`knownHostsResource`): known_hosts file to verify
the key of the server; without it, any server is accepted
+- **Fail On Unknown Host** (`failOnUnknownHost`): if true, a server that is
not listed in `knownHostsResource` is refused; otherwise it is accepted
+- **Connect Timeout** (`connectTimeout`): milliseconds to wait for the
connection, the login and the start of the command (default: 30000); it does
not limit how long the command runs
- **Delay** (`delay`): Milliseconds between two runs of the command (default:
500)
=== Output Format
@@ -39,6 +43,30 @@ The body is what the command printed on its standard output,
as text. The exit c
uri: "kamelet:log-sink"
----
+=== Example with a Private Key
+
+For a server that does not take passwords. The key of the server must be in
the known_hosts file, which can be made with `ssh-keyscan -p 22
server.example.com > known_hosts`.
+
+[source,yaml,subs='+attributes,macros']
+----
+- route:
+ from:
+ uri: "kamelet:ssh-source"
+ parameters:
+ connectionHost: "server.example.com"
+ connectionPort: "22"
+ username: "monitor"
+ privateKeyResource: "file:/etc/ssh-keys/id_ed25519"
+ privateKeyPassphrase: "{{ssh.key.passphrase}}"
+ knownHostsResource: "file:/etc/ssh-keys/known_hosts"
+ failOnUnknownHost: true
+ pollCommand: "df -h /"
+ delay: 60000
+ steps:
+ - to:
+ uri: "kamelet:log-sink"
+----
+
=== Example with System Monitoring
[source,yaml,subs='+attributes,macros']
@@ -77,8 +105,8 @@ The body is what the command printed on its standard output,
as text. The exit c
=== Security Considerations
-- Use strong passwords
-- Set `knownHostsResource` so that the key of the server is checked
+- Log in with a private key, or use strong passwords
+- Set `knownHostsResource`, and `failOnUnknownHost` to true, so that the key
of the server is checked
- Limit the commands that can be executed
- Consider using dedicated monitoring users with restricted permissions
- Monitor SSH access logs for security purposes
diff --git a/kamelets/ssh-sink.kamelet.yaml b/kamelets/ssh-sink.kamelet.yaml
index b05cf1a28..caff37f1e 100644
--- a/kamelets/ssh-sink.kamelet.yaml
+++ b/kamelets/ssh-sink.kamelet.yaml
@@ -39,12 +39,11 @@ spec:
Output: the body afterwards is what the command printed on its standard
output, as a stream. The `CamelSshExitValue` header holds the exit code of the
command, and `CamelSshStderr` what it printed on its standard error, as a
stream.
- Good to know: it runs whatever command it receives, with the rights of
`username`. Never send it messages from an untrusted source, and log in with an
account that may do only what is needed. A command that ends with an exit code
other than 0 does not fail the message: check `CamelSshExitValue`. The key of
the server is checked only when `knownHostsResource` is set; without it, any
server is accepted.
+ Good to know: it runs whatever command it receives, with the rights of
`username`. Never send it messages from an untrusted source, and log in with an
account that may do only what is needed. A command that ends with an exit code
other than 0 does not fail the message: check `CamelSshExitValue`. Log in with
`password`, or with a private key in `privateKeyResource` when the server does
not take passwords; when a key is set, the password is not used. The key of the
server is checked [...]
required:
- connectionHost
- connectionPort
- username
- - password
type: object
properties:
connectionHost:
@@ -65,7 +64,20 @@ spec:
- urn:camel:group:credentials
password:
title: Password
- description: The password of `username` on the SSH server.
+ description: The password of `username` on the SSH server. Leave it
empty to log in with a private key in `privateKeyResource` instead; when a key
is set, the password is not used. With neither of them set, every command fails
with `No password provided`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ privateKeyResource:
+ title: Private Key Resource
+ description: A private key to log in with instead of a password,
starting with `file:` followed by the path of the key file, `classpath:`,
`http:` or `https:`. The matching public key must be in the `authorized_keys`
file of `username` on the server. OpenSSH keys, such as those made with
`ssh-keygen`, and PEM keys can be read. A key that cannot be read, or a wrong
passphrase, makes every command fail with `No key-pair to add`.
+ type: string
+ pattern: "^(http|https|file|classpath|ref|bean):.*"
+ example: file:/etc/ssh-keys/id_ed25519
+ privateKeyPassphrase:
+ title: Private Key Passphrase
+ description: The passphrase of the key in `privateKeyResource`, when
the key is protected by one.
type: string
format: password
x-descriptors:
@@ -76,6 +88,15 @@ spec:
type: string
pattern: "^(http|https|file|classpath|ref|bean):.*"
example: file:/etc/ssh/known_hosts
+ failOnUnknownHost:
+ title: Fail On Unknown Host
+ description: If true, a server that is not listed in
`knownHostsResource` is refused. When it is not set or false, such a server is
accepted, and only a server that is listed with another key is refused. Only
used when `knownHostsResource` is set.
+ type: boolean
+ connectTimeout:
+ title: Connect Timeout
+ description: How long to wait for the connection, for the login and
for the command to start, each in milliseconds. It does not limit how long the
command runs. When it is not set, it is 30000, which is 30 seconds.
+ type: integer
+ example: 10000
types:
in:
mediaType: text/plain
@@ -101,4 +122,4 @@ spec:
uri: kamelet:source
steps:
- to:
- uri:
"ssh://{{connectionHost}}:{{connectionPort}}?knownHostsResource={{?knownHostsResource}}&password=RAW({{password}})&username=RAW({{username}})"
+ uri:
"ssh://{{connectionHost}}:{{connectionPort}}?certResource={{?privateKeyResource}}&certResourcePassword=RAW({{?privateKeyPassphrase}})&failOnUnknownHost={{?failOnUnknownHost}}&knownHostsResource={{?knownHostsResource}}&password=RAW({{?password}})&timeout={{?connectTimeout}}&username=RAW({{username}})"
diff --git a/kamelets/ssh-source.kamelet.yaml b/kamelets/ssh-source.kamelet.yaml
index a5832d70e..ca0eb51e5 100644
--- a/kamelets/ssh-source.kamelet.yaml
+++ b/kamelets/ssh-source.kamelet.yaml
@@ -37,12 +37,11 @@ spec:
Output: the body is what the command printed on its standard output, as
text. The `CamelSshExitValue` header holds the exit code of the command, and
`CamelSshStderr` what it printed on its standard error, as a stream.
- Good to know: it runs `pollCommand` with the rights of `username`, so
log in with an account that may do only what is needed. It runs it every half
second by default; set `delay` to how often you need it. A command that fails
still sends a message, with its exit code in `CamelSshExitValue`. The key of
the server is checked only when `knownHostsResource` is set; without it, any
server is accepted.
+ Good to know: it runs `pollCommand` with the rights of `username`, so
log in with an account that may do only what is needed. It runs it every half
second by default; set `delay` to how often you need it. A command that fails
still sends a message, with its exit code in `CamelSshExitValue`. Log in with
`password`, or with a private key in `privateKeyResource` when the server does
not take passwords; when a key is set, the password is not used. The key of the
server is checked only [...]
required:
- connectionHost
- connectionPort
- username
- - password
- pollCommand
type: object
properties:
@@ -64,7 +63,20 @@ spec:
- urn:camel:group:credentials
password:
title: Password
- description: The password of `username` on the SSH server.
+ description: The password of `username` on the SSH server. Leave it
empty to log in with a private key in `privateKeyResource` instead; when a key
is set, the password is not used. With neither of them set, every run fails
with `No password provided`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ privateKeyResource:
+ title: Private Key Resource
+ description: A private key to log in with instead of a password,
starting with `file:` followed by the path of the key file, `classpath:`,
`http:` or `https:`. The matching public key must be in the `authorized_keys`
file of `username` on the server. OpenSSH keys, such as those made with
`ssh-keygen`, and PEM keys can be read. A key that cannot be read, or a wrong
passphrase, makes every run fail with `No key-pair to add`.
+ type: string
+ pattern: "^(http|https|file|classpath|ref|bean):.*"
+ example: file:/etc/ssh-keys/id_ed25519
+ privateKeyPassphrase:
+ title: Private Key Passphrase
+ description: The passphrase of the key in `privateKeyResource`, when
the key is protected by one.
type: string
format: password
x-descriptors:
@@ -75,6 +87,15 @@ spec:
type: string
pattern: "^(http|https|file|classpath|ref|bean):.*"
example: file:/etc/ssh/known_hosts
+ failOnUnknownHost:
+ title: Fail On Unknown Host
+ description: If true, a server that is not listed in
`knownHostsResource` is refused. When it is not set or false, such a server is
accepted, and only a server that is listed with another key is refused. Only
used when `knownHostsResource` is set.
+ type: boolean
+ connectTimeout:
+ title: Connect Timeout
+ description: How long to wait for the connection, for the login and
for the command to start, each in milliseconds. It does not limit how long the
command runs. When it is not set, it is 30000, which is 30 seconds.
+ type: integer
+ example: 10000
delay:
title: Delay
description: How long to wait between two runs of the command, in
milliseconds. For example, 60000 is one minute.
@@ -102,7 +123,7 @@ spec:
- "camel:kamelet"
template:
from:
- uri:
"ssh://{{connectionHost}}:{{connectionPort}}?delay={{delay}}&knownHostsResource={{?knownHostsResource}}&password=RAW({{password}})&pollCommand={{pollCommand}}&username=RAW({{username}})"
+ uri:
"ssh://{{connectionHost}}:{{connectionPort}}?delay={{delay}}&certResource={{?privateKeyResource}}&certResourcePassword=RAW({{?privateKeyPassphrase}})&failOnUnknownHost={{?failOnUnknownHost}}&knownHostsResource={{?knownHostsResource}}&password=RAW({{?password}})&pollCommand={{pollCommand}}&timeout={{?connectTimeout}}&username=RAW({{username}})"
steps:
- convertBodyTo:
type: java.lang.String
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index d2a01b4d9..b3d7279fb 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -2155,7 +2155,7 @@
"supportLevel" : "Stable",
"title" : "SSH Sink",
"summary" : "Runs the text of each message as a command on a remote server
over SSH, and returns what the command prints.",
- "description" : "Runs the text of each message as a command on a remote
server over SSH, and returns what the command prints.\n\nUse it to run a script
or a maintenance command on a server when something happens, for example
restart a service after a deployment or clear a cache when data changes. To run
a fixed command on a schedule and read its output, use `ssh-source`; to run a
command on the machine of the integration, use `exec-sink`.\n\nInput: the body
is the command to run, as [...]
+ "description" : "Runs the text of each message as a command on a remote
server over SSH, and returns what the command prints.\n\nUse it to run a script
or a maintenance command on a server when something happens, for example
restart a service after a deployment or clear a cache when data changes. To run
a fixed command on a schedule and read its output, use `ssh-source`; to run a
command on the machine of the integration, use `exec-sink`.\n\nInput: the body
is the command to run, as [...]
"group" : "SSH",
"namespace" : "File",
"provider" : "Apache Software Foundation"
@@ -2165,7 +2165,7 @@
"supportLevel" : "Stable",
"title" : "SSH Source",
"summary" : "Runs a command on a remote server over SSH again and again,
at a regular interval, and sends what the command prints as a message each
time.",
- "description" : "Runs a command on a remote server over SSH again and
again, at a regular interval, and sends what the command prints as a message
each time.\n\nUse it to watch a server without installing anything on it, for
example check the free disk space, the state of a service or the last lines of
a log file every minute. To run a command for each incoming message instead,
use `ssh-sink`.\n\nOutput: the body is what the command printed on its standard
output, as text. The `Camel [...]
+ "description" : "Runs a command on a remote server over SSH again and
again, at a regular interval, and sends what the command prints as a message
each time.\n\nUse it to watch a server without installing anything on it, for
example check the free disk space, the state of a service or the last lines of
a log file every minute. To run a command for each incoming message instead,
use `ssh-sink`.\n\nOutput: the body is what the command printed on its standard
output, as text. The `Camel [...]
"group" : "SSH",
"namespace" : "File",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/ssh-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/ssh-sink.kamelet.yaml
index b05cf1a28..caff37f1e 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/ssh-sink.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/ssh-sink.kamelet.yaml
@@ -39,12 +39,11 @@ spec:
Output: the body afterwards is what the command printed on its standard
output, as a stream. The `CamelSshExitValue` header holds the exit code of the
command, and `CamelSshStderr` what it printed on its standard error, as a
stream.
- Good to know: it runs whatever command it receives, with the rights of
`username`. Never send it messages from an untrusted source, and log in with an
account that may do only what is needed. A command that ends with an exit code
other than 0 does not fail the message: check `CamelSshExitValue`. The key of
the server is checked only when `knownHostsResource` is set; without it, any
server is accepted.
+ Good to know: it runs whatever command it receives, with the rights of
`username`. Never send it messages from an untrusted source, and log in with an
account that may do only what is needed. A command that ends with an exit code
other than 0 does not fail the message: check `CamelSshExitValue`. Log in with
`password`, or with a private key in `privateKeyResource` when the server does
not take passwords; when a key is set, the password is not used. The key of the
server is checked [...]
required:
- connectionHost
- connectionPort
- username
- - password
type: object
properties:
connectionHost:
@@ -65,7 +64,20 @@ spec:
- urn:camel:group:credentials
password:
title: Password
- description: The password of `username` on the SSH server.
+ description: The password of `username` on the SSH server. Leave it
empty to log in with a private key in `privateKeyResource` instead; when a key
is set, the password is not used. With neither of them set, every command fails
with `No password provided`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ privateKeyResource:
+ title: Private Key Resource
+ description: A private key to log in with instead of a password,
starting with `file:` followed by the path of the key file, `classpath:`,
`http:` or `https:`. The matching public key must be in the `authorized_keys`
file of `username` on the server. OpenSSH keys, such as those made with
`ssh-keygen`, and PEM keys can be read. A key that cannot be read, or a wrong
passphrase, makes every command fail with `No key-pair to add`.
+ type: string
+ pattern: "^(http|https|file|classpath|ref|bean):.*"
+ example: file:/etc/ssh-keys/id_ed25519
+ privateKeyPassphrase:
+ title: Private Key Passphrase
+ description: The passphrase of the key in `privateKeyResource`, when
the key is protected by one.
type: string
format: password
x-descriptors:
@@ -76,6 +88,15 @@ spec:
type: string
pattern: "^(http|https|file|classpath|ref|bean):.*"
example: file:/etc/ssh/known_hosts
+ failOnUnknownHost:
+ title: Fail On Unknown Host
+ description: If true, a server that is not listed in
`knownHostsResource` is refused. When it is not set or false, such a server is
accepted, and only a server that is listed with another key is refused. Only
used when `knownHostsResource` is set.
+ type: boolean
+ connectTimeout:
+ title: Connect Timeout
+ description: How long to wait for the connection, for the login and
for the command to start, each in milliseconds. It does not limit how long the
command runs. When it is not set, it is 30000, which is 30 seconds.
+ type: integer
+ example: 10000
types:
in:
mediaType: text/plain
@@ -101,4 +122,4 @@ spec:
uri: kamelet:source
steps:
- to:
- uri:
"ssh://{{connectionHost}}:{{connectionPort}}?knownHostsResource={{?knownHostsResource}}&password=RAW({{password}})&username=RAW({{username}})"
+ uri:
"ssh://{{connectionHost}}:{{connectionPort}}?certResource={{?privateKeyResource}}&certResourcePassword=RAW({{?privateKeyPassphrase}})&failOnUnknownHost={{?failOnUnknownHost}}&knownHostsResource={{?knownHostsResource}}&password=RAW({{?password}})&timeout={{?connectTimeout}}&username=RAW({{username}})"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/ssh-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/ssh-source.kamelet.yaml
index a5832d70e..ca0eb51e5 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/ssh-source.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/ssh-source.kamelet.yaml
@@ -37,12 +37,11 @@ spec:
Output: the body is what the command printed on its standard output, as
text. The `CamelSshExitValue` header holds the exit code of the command, and
`CamelSshStderr` what it printed on its standard error, as a stream.
- Good to know: it runs `pollCommand` with the rights of `username`, so
log in with an account that may do only what is needed. It runs it every half
second by default; set `delay` to how often you need it. A command that fails
still sends a message, with its exit code in `CamelSshExitValue`. The key of
the server is checked only when `knownHostsResource` is set; without it, any
server is accepted.
+ Good to know: it runs `pollCommand` with the rights of `username`, so
log in with an account that may do only what is needed. It runs it every half
second by default; set `delay` to how often you need it. A command that fails
still sends a message, with its exit code in `CamelSshExitValue`. Log in with
`password`, or with a private key in `privateKeyResource` when the server does
not take passwords; when a key is set, the password is not used. The key of the
server is checked only [...]
required:
- connectionHost
- connectionPort
- username
- - password
- pollCommand
type: object
properties:
@@ -64,7 +63,20 @@ spec:
- urn:camel:group:credentials
password:
title: Password
- description: The password of `username` on the SSH server.
+ description: The password of `username` on the SSH server. Leave it
empty to log in with a private key in `privateKeyResource` instead; when a key
is set, the password is not used. With neither of them set, every run fails
with `No password provided`.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ privateKeyResource:
+ title: Private Key Resource
+ description: A private key to log in with instead of a password,
starting with `file:` followed by the path of the key file, `classpath:`,
`http:` or `https:`. The matching public key must be in the `authorized_keys`
file of `username` on the server. OpenSSH keys, such as those made with
`ssh-keygen`, and PEM keys can be read. A key that cannot be read, or a wrong
passphrase, makes every run fail with `No key-pair to add`.
+ type: string
+ pattern: "^(http|https|file|classpath|ref|bean):.*"
+ example: file:/etc/ssh-keys/id_ed25519
+ privateKeyPassphrase:
+ title: Private Key Passphrase
+ description: The passphrase of the key in `privateKeyResource`, when
the key is protected by one.
type: string
format: password
x-descriptors:
@@ -75,6 +87,15 @@ spec:
type: string
pattern: "^(http|https|file|classpath|ref|bean):.*"
example: file:/etc/ssh/known_hosts
+ failOnUnknownHost:
+ title: Fail On Unknown Host
+ description: If true, a server that is not listed in
`knownHostsResource` is refused. When it is not set or false, such a server is
accepted, and only a server that is listed with another key is refused. Only
used when `knownHostsResource` is set.
+ type: boolean
+ connectTimeout:
+ title: Connect Timeout
+ description: How long to wait for the connection, for the login and
for the command to start, each in milliseconds. It does not limit how long the
command runs. When it is not set, it is 30000, which is 30 seconds.
+ type: integer
+ example: 10000
delay:
title: Delay
description: How long to wait between two runs of the command, in
milliseconds. For example, 60000 is one minute.
@@ -102,7 +123,7 @@ spec:
- "camel:kamelet"
template:
from:
- uri:
"ssh://{{connectionHost}}:{{connectionPort}}?delay={{delay}}&knownHostsResource={{?knownHostsResource}}&password=RAW({{password}})&pollCommand={{pollCommand}}&username=RAW({{username}})"
+ uri:
"ssh://{{connectionHost}}:{{connectionPort}}?delay={{delay}}&certResource={{?privateKeyResource}}&certResourcePassword=RAW({{?privateKeyPassphrase}})&failOnUnknownHost={{?failOnUnknownHost}}&knownHostsResource={{?knownHostsResource}}&password=RAW({{?password}})&pollCommand={{pollCommand}}&timeout={{?connectTimeout}}&username=RAW({{username}})"
steps:
- convertBodyTo:
type: java.lang.String