This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d14db01867c8 CAMEL-27702: camel-ssh - Apply channelOpenTimeout and
idleTimeout, and fail with a clear error instead of a NullPointerException
(#31040)
d14db01867c8 is described below
commit d14db01867c849d84b360381c27c14b51eab1bd7
Author: Ayush Kulshreshtha <[email protected]>
AuthorDate: Sat Nov 28 14:45:48 2026 +0530
CAMEL-27702: camel-ssh - Apply channelOpenTimeout and idleTimeout, and fail
with a clear error instead of a NullPointerException (#31040)
- channelOpenTimeout, when set, limits the wait for the channel that runs
the command, instead of timeout.
- idleTimeout defaults to 600000, the 10 minutes Apache MINA SSHD used
before, and 0 or less now turns the idle timeout off.
- A channel that the server refuses fails with "The server refused to open
the ... channel" and the reason; a channel that does not open in time
fails with an exception that names the timeout, instead of a
NullPointerException in the producer or consumer.
- A certResource or keyPairProvider that gives no key pair, or none of the
keyType, fails with an exception that names them (a base64: or mem:
resource only by its scheme).
- An endpoint with a channelType other than exec or shell fails to start,
and the option lists exec,shell as its values.
- A consumer without pollCommand fails to start.
- kex also matches the registered key exchange extensions, as the other
algorithm options do, and lists the available ones at TRACE.
The authentication failure message and the labels of the user name and
password headers are left to CAMEL-27707 (#31036).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../org/apache/camel/catalog/components/ssh.json | 16 +-
.../org/apache/camel/component/ssh/ssh.json | 16 +-
.../camel/component/ssh/SshConfiguration.java | 22 +-
.../apache/camel/component/ssh/SshConsumer.java | 5 +
.../apache/camel/component/ssh/SshEndpoint.java | 4 +
.../org/apache/camel/component/ssh/SshHelper.java | 58 ++++-
.../org/apache/camel/component/ssh/SshUtils.java | 17 +-
.../component/ssh/SshAlgorithmParametersTest.java | 4 +
.../component/ssh/SshConfigurationErrorsTest.java | 243 +++++++++++++++++++++
.../camel/component/ssh/SshIdleTimeoutTest.java | 8 +-
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 15 ++
.../component/dsl/SshComponentBuilderFactory.java | 21 +-
.../endpoint/dsl/SshEndpointBuilderFactory.java | 108 +++++----
13 files changed, 433 insertions(+), 104 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
index e76a6683a16a..fcaa6d6e28ac 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
@@ -25,21 +25,21 @@
"remote": true
},
"componentProperties": {
- "timeout": { "index": 0, "kind": "property", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authent [...]
+ "timeout": { "index": 0, "kind": "property", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authent [...]
"bridgeErrorHandler": { "index": 1, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"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 like [...]
"pollCommand": { "index": 2, "kind": "property", "displayName": "Poll
Command", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The command that the consumer runs on the SSH
server at each poll. The consumer needs it, as each poll fails wi [...]
"lazyStartProducer": { "index": 3, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"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 [...]
"authTimeout": { "index": 4, "kind": "property", "displayName": "Auth
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that Apache MINA SSHD
allows for the authentication before it closes the session. If 0 or less, i
[...]
"autowiredEnabled": { "index": 5, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"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 t [...]
- "channelOpenTimeout": { "index": 6, "kind": "property", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "Sets a channel open timeout of Apache MINA
SSHD that applies only to SSH agent forwarding, which this compo [...]
- "channelType": { "index": 7, "kind": "property", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs it as a single command, and sh [...]
+ "channelOpenTimeout": { "index": 6, "kind": "property", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for the channel that runs the command to open. If 0 or le [...]
+ "channelType": { "index": 7, "kind": "property", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"enum", "javaType": "java.lang.String", "enum": [ "exec", "shell" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs it [...]
"clientBuilder": { "index": 8, "kind": "property", "displayName": "Client
Builder", "group": "advanced", "label": "advanced", "required": false, "type":
"object", "javaType": "org.apache.sshd.client.ClientBuilder", "deprecated":
false, "autowired": true, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "To use a custom
org.apache.sshd.client.ClientBuilder to create the SSH client, for examp [...]
"compressions": { "index": 9, "kind": "property", "displayName":
"Compressions", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the compression
algorithms that the client proposes, in order of preference, for exa [...]
"configuration": { "index": 10, "kind": "property", "displayName":
"Configuration", "group": "advanced", "label": "advanced", "required": false,
"type": "object", "javaType":
"org.apache.camel.component.ssh.SshConfiguration", "deprecated": false,
"autowired": false, "secret": false, "description": "The shared configuration
of the endpoints: each endpoint starts from a copy of it." },
"connectTimeout": { "index": 11, "kind": "property", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the socket
connection to the server may take. If 0 or less, the default of Apache MIN [...]
"heartbeatInterval": { "index": 12, "kind": "property", "displayName":
"Heartbeat Interval", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The interval in milliseconds at which the
client sends keep-alive requests to the server while a command runs [...]
"heartbeatReplyMaxWait": { "index": 13, "kind": "property", "displayName":
"Heartbeat Reply Max Wait", "group": "advanced", "label": "advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The number of keep-alive requests without
reply after which the client closes the session, when hear [...]
- "idleTimeout": { "index": 14, "kind": "property", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The session is open while a comma
[...]
+ "idleTimeout": { "index": 14, "kind": "property", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 600000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The sessi [...]
"shellPrompt": { "index": 15, "kind": "property", "displayName": "Shell
Prompt", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The text that the shell prompt ends with,
which channelType=shell needs: the endpoint fails to start without i [...]
"sleepForShellPrompt": { "index": 16, "kind": "property", "displayName":
"Sleep For Shell Prompt", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 100, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds between two reads of
the shell output while the component [...]
"healthCheckConsumerEnabled": { "index": 17, "kind": "property",
"displayName": "Health Check Consumer Enabled", "group": "health", "label":
"health", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Used for enabling or disabling all consumer based health checks
from this component" },
@@ -72,7 +72,7 @@
"properties": {
"host": { "index": 0, "kind": "path", "displayName": "Host", "group":
"common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration",
"configurationField": "configuration", "description": "The host name or IP
address of the SSH server. When the .ssh\/config file in the home directory of
the user has an entry for this host, the c [...]
"port": { "index": 1, "kind": "path", "displayName": "Port", "group":
"common", "label": "", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 22,
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration",
"configurationField": "configuration", "description": "The port of the SSH
server." },
- "timeout": { "index": 2, "kind": "parameter", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authen [...]
+ "timeout": { "index": 2, "kind": "parameter", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authen [...]
"pollCommand": { "index": 3, "kind": "parameter", "displayName": "Poll
Command", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The command that the consumer runs on the SSH
server at each poll. The consumer needs it, as each poll fails w [...]
"sendEmptyMessageWhenIdle": { "index": 4, "kind": "parameter",
"displayName": "Send Empty Message When Idle", "group": "consumer", "label":
"consumer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "If the polling consumer did not poll any files, you can
enable this option to send an empty message (no body) instead." },
"bridgeErrorHandler": { "index": 5, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "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 [...]
@@ -81,14 +81,14 @@
"pollStrategy": { "index": 8, "kind": "parameter", "displayName": "Poll
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false,
"autowired": false, "secret": false, "description": "A pluggable
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your
custom implementation to control error handling usually occurred during the pol
[...]
"lazyStartProducer": { "index": 9, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "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 produc [...]
"authTimeout": { "index": 10, "kind": "parameter", "displayName": "Auth
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that Apache MINA SSHD
allows for the authentication before it closes the session. If 0 or less, [...]
- "channelOpenTimeout": { "index": 11, "kind": "parameter", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "Sets a channel open timeout of Apache MINA
SSHD that applies only to SSH agent forwarding, which this com [...]
- "channelType": { "index": 12, "kind": "parameter", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs it as a single command, and [...]
+ "channelOpenTimeout": { "index": 11, "kind": "parameter", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for the channel that runs the command to open. If 0 or [...]
+ "channelType": { "index": 12, "kind": "parameter", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"enum", "javaType": "java.lang.String", "enum": [ "exec", "shell" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs i [...]
"clientBuilder": { "index": 13, "kind": "parameter", "displayName":
"Client Builder", "group": "advanced", "label": "advanced", "required": false,
"type": "object", "javaType": "org.apache.sshd.client.ClientBuilder",
"deprecated": false, "autowired": true, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "To use a custom
org.apache.sshd.client.ClientBuilder to create the SSH client, for exa [...]
"compressions": { "index": 14, "kind": "parameter", "displayName":
"Compressions", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the compression
algorithms that the client proposes, in order of preference, for e [...]
"connectTimeout": { "index": 15, "kind": "parameter", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the socket
connection to the server may take. If 0 or less, the default of Apache MI [...]
"heartbeatInterval": { "index": 16, "kind": "parameter", "displayName":
"Heartbeat Interval", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The interval in milliseconds at which the
client sends keep-alive requests to the server while a command run [...]
"heartbeatReplyMaxWait": { "index": 17, "kind": "parameter",
"displayName": "Heartbeat Reply Max Wait", "group": "advanced", "label":
"advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The number of keep-alive requests without
reply after which the client closes the session, when hea [...]
- "idleTimeout": { "index": 18, "kind": "parameter", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The session is open while a comm
[...]
+ "idleTimeout": { "index": 18, "kind": "parameter", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 600000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The sess [...]
"shellPrompt": { "index": 19, "kind": "parameter", "displayName": "Shell
Prompt", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The text that the shell prompt ends with,
which channelType=shell needs: the endpoint fails to start without [...]
"sleepForShellPrompt": { "index": 20, "kind": "parameter", "displayName":
"Sleep For Shell Prompt", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 100, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds between two reads of
the shell output while the componen [...]
"backoffErrorThreshold": { "index": 21, "kind": "parameter",
"displayName": "Backoff Error Threshold", "group": "scheduler", "label":
"consumer,scheduler", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description": "The
number of subsequent error polls (failed due some error) that should happen
before the backoffMultipler should kick-in." },
diff --git
a/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
b/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
index e76a6683a16a..fcaa6d6e28ac 100644
---
a/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
+++
b/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
@@ -25,21 +25,21 @@
"remote": true
},
"componentProperties": {
- "timeout": { "index": 0, "kind": "property", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authent [...]
+ "timeout": { "index": 0, "kind": "property", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authent [...]
"bridgeErrorHandler": { "index": 1, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"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 like [...]
"pollCommand": { "index": 2, "kind": "property", "displayName": "Poll
Command", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The command that the consumer runs on the SSH
server at each poll. The consumer needs it, as each poll fails wi [...]
"lazyStartProducer": { "index": 3, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"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 [...]
"authTimeout": { "index": 4, "kind": "property", "displayName": "Auth
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that Apache MINA SSHD
allows for the authentication before it closes the session. If 0 or less, i
[...]
"autowiredEnabled": { "index": 5, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"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 t [...]
- "channelOpenTimeout": { "index": 6, "kind": "property", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "Sets a channel open timeout of Apache MINA
SSHD that applies only to SSH agent forwarding, which this compo [...]
- "channelType": { "index": 7, "kind": "property", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs it as a single command, and sh [...]
+ "channelOpenTimeout": { "index": 6, "kind": "property", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for the channel that runs the command to open. If 0 or le [...]
+ "channelType": { "index": 7, "kind": "property", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"enum", "javaType": "java.lang.String", "enum": [ "exec", "shell" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs it [...]
"clientBuilder": { "index": 8, "kind": "property", "displayName": "Client
Builder", "group": "advanced", "label": "advanced", "required": false, "type":
"object", "javaType": "org.apache.sshd.client.ClientBuilder", "deprecated":
false, "autowired": true, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "To use a custom
org.apache.sshd.client.ClientBuilder to create the SSH client, for examp [...]
"compressions": { "index": 9, "kind": "property", "displayName":
"Compressions", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the compression
algorithms that the client proposes, in order of preference, for exa [...]
"configuration": { "index": 10, "kind": "property", "displayName":
"Configuration", "group": "advanced", "label": "advanced", "required": false,
"type": "object", "javaType":
"org.apache.camel.component.ssh.SshConfiguration", "deprecated": false,
"autowired": false, "secret": false, "description": "The shared configuration
of the endpoints: each endpoint starts from a copy of it." },
"connectTimeout": { "index": 11, "kind": "property", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the socket
connection to the server may take. If 0 or less, the default of Apache MIN [...]
"heartbeatInterval": { "index": 12, "kind": "property", "displayName":
"Heartbeat Interval", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The interval in milliseconds at which the
client sends keep-alive requests to the server while a command runs [...]
"heartbeatReplyMaxWait": { "index": 13, "kind": "property", "displayName":
"Heartbeat Reply Max Wait", "group": "advanced", "label": "advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The number of keep-alive requests without
reply after which the client closes the session, when hear [...]
- "idleTimeout": { "index": 14, "kind": "property", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The session is open while a comma
[...]
+ "idleTimeout": { "index": 14, "kind": "property", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 600000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The sessi [...]
"shellPrompt": { "index": 15, "kind": "property", "displayName": "Shell
Prompt", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The text that the shell prompt ends with,
which channelType=shell needs: the endpoint fails to start without i [...]
"sleepForShellPrompt": { "index": 16, "kind": "property", "displayName":
"Sleep For Shell Prompt", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 100, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds between two reads of
the shell output while the component [...]
"healthCheckConsumerEnabled": { "index": 17, "kind": "property",
"displayName": "Health Check Consumer Enabled", "group": "health", "label":
"health", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Used for enabling or disabling all consumer based health checks
from this component" },
@@ -72,7 +72,7 @@
"properties": {
"host": { "index": 0, "kind": "path", "displayName": "Host", "group":
"common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration",
"configurationField": "configuration", "description": "The host name or IP
address of the SSH server. When the .ssh\/config file in the home directory of
the user has an entry for this host, the c [...]
"port": { "index": 1, "kind": "path", "displayName": "Port", "group":
"common", "label": "", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 22,
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration",
"configurationField": "configuration", "description": "The port of the SSH
server." },
- "timeout": { "index": 2, "kind": "parameter", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authen [...]
+ "timeout": { "index": 2, "kind": "parameter", "displayName": "Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "long", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for each step of setting up the session: the connection, the authen [...]
"pollCommand": { "index": 3, "kind": "parameter", "displayName": "Poll
Command", "group": "consumer", "label": "consumer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The command that the consumer runs on the SSH
server at each poll. The consumer needs it, as each poll fails w [...]
"sendEmptyMessageWhenIdle": { "index": 4, "kind": "parameter",
"displayName": "Send Empty Message When Idle", "group": "consumer", "label":
"consumer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "If the polling consumer did not poll any files, you can
enable this option to send an empty message (no body) instead." },
"bridgeErrorHandler": { "index": 5, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "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 [...]
@@ -81,14 +81,14 @@
"pollStrategy": { "index": 8, "kind": "parameter", "displayName": "Poll
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false,
"autowired": false, "secret": false, "description": "A pluggable
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your
custom implementation to control error handling usually occurred during the pol
[...]
"lazyStartProducer": { "index": 9, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "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 produc [...]
"authTimeout": { "index": 10, "kind": "parameter", "displayName": "Auth
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that Apache MINA SSHD
allows for the authentication before it closes the session. If 0 or less, [...]
- "channelOpenTimeout": { "index": 11, "kind": "parameter", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "Sets a channel open timeout of Apache MINA
SSHD that applies only to SSH agent forwarding, which this com [...]
- "channelType": { "index": 12, "kind": "parameter", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs it as a single command, and [...]
+ "channelOpenTimeout": { "index": 11, "kind": "parameter", "displayName":
"Channel Open Timeout", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the component
waits for the channel that runs the command to open. If 0 or [...]
+ "channelType": { "index": 12, "kind": "parameter", "displayName": "Channel
Type", "group": "advanced", "label": "advanced", "required": false, "type":
"enum", "javaType": "java.lang.String", "enum": [ "exec", "shell" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"exec", "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The type of SSH channel that runs the command:
exec runs i [...]
"clientBuilder": { "index": 13, "kind": "parameter", "displayName":
"Client Builder", "group": "advanced", "label": "advanced", "required": false,
"type": "object", "javaType": "org.apache.sshd.client.ClientBuilder",
"deprecated": false, "autowired": true, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "To use a custom
org.apache.sshd.client.ClientBuilder to create the SSH client, for exa [...]
"compressions": { "index": 14, "kind": "parameter", "displayName":
"Compressions", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the compression
algorithms that the client proposes, in order of preference, for e [...]
"connectTimeout": { "index": 15, "kind": "parameter", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds that the socket
connection to the server may take. If 0 or less, the default of Apache MI [...]
"heartbeatInterval": { "index": 16, "kind": "parameter", "displayName":
"Heartbeat Interval", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The interval in milliseconds at which the
client sends keep-alive requests to the server while a command run [...]
"heartbeatReplyMaxWait": { "index": 17, "kind": "parameter",
"displayName": "Heartbeat Reply Max Wait", "group": "advanced", "label":
"advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The number of keep-alive requests without
reply after which the client closes the session, when hea [...]
- "idleTimeout": { "index": 18, "kind": "parameter", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The session is open while a comm
[...]
+ "idleTimeout": { "index": 18, "kind": "parameter", "displayName": "Idle
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 600000, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds after which Apache
MINA SSHD closes a session without traffic. The sess [...]
"shellPrompt": { "index": 19, "kind": "parameter", "displayName": "Shell
Prompt", "group": "advanced", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The text that the shell prompt ends with,
which channelType=shell needs: the endpoint fails to start without [...]
"sleepForShellPrompt": { "index": 20, "kind": "parameter", "displayName":
"Sleep For Shell Prompt", "group": "advanced", "label": "advanced", "required":
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 100, "configurationClass":
"org.apache.camel.component.ssh.SshConfiguration", "configurationField":
"configuration", "description": "The time in milliseconds between two reads of
the shell output while the componen [...]
"backoffErrorThreshold": { "index": 21, "kind": "parameter",
"displayName": "Backoff Error Threshold", "group": "scheduler", "label":
"consumer,scheduler", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description": "The
number of subsequent error polls (failed due some error) that should happen
before the backoffMultipler should kick-in." },
diff --git
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
index 84bf680b93c7..dca8b3ecafb8 100644
---
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
+++
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
@@ -80,8 +80,8 @@ public class SshConfiguration implements Cloneable {
private String certResourcePassword;
@UriParam(defaultValue = "30000",
description = "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. It does not limit how long"
- + " the command runs.")
+ + " the connection, the authentication and the
opening of the channel, unless channelOpenTimeout"
+ + " is set. It does not limit how long the command
runs.")
private long timeout = 30000;
@UriParam(label = "security", security = "insecure:ssl",
description = "The resource of a file in the OpenSSH known_hosts
format, such as file:/etc/camel/known_hosts,"
@@ -97,9 +97,10 @@ public class SshConfiguration implements Cloneable {
+ " matching entry with the revoked marker. This
option has no effect when knownHostsResource is not set.")
private boolean failOnUnknownHost;
@UriParam(label = "advanced", defaultValue = Channel.CHANNEL_EXEC,
+ enums = "exec,shell",
description = "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. Other values are"
- + " not supported.")
+ + " it to an interactive shell and reads the
output up to the shellPrompt text. The endpoint fails"
+ + " to start with another value.")
private String channelType = Channel.CHANNEL_EXEC;
@UriParam(label = "advanced",
description = "The text that the shell prompt ends with, which
channelType=shell needs: the endpoint fails to"
@@ -137,11 +138,11 @@ public class SshConfiguration implements Cloneable {
description = "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.")
private String compressions;
- @UriParam(label = "advanced",
+ @UriParam(label = "advanced", defaultValue = "600000",
description = "The time in milliseconds after which Apache MINA
SSHD closes a session without traffic. The"
- + " session is open while a command runs. If 0 or
less, the default of Apache MINA SSHD, 10"
- + " minutes, applies.")
- private long idleTimeout;
+ + " 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.")
+ private long idleTimeout = 600000;
@UriParam(label = "advanced",
description = "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.")
@@ -161,9 +162,8 @@ public class SshConfiguration implements Cloneable {
+ " component waits for the connection.")
private long connectTimeout;
@UriParam(label = "advanced",
- description = "Sets a channel open timeout of Apache MINA SSHD
that applies only to SSH agent forwarding,"
- + " which this component does not use. The timeout
option limits how long the component waits"
- + " for the channel that runs the command.")
+ description = "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.")
private long channelOpenTimeout;
@UriParam(description = "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"
diff --git
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
index b59c26712761..f729c9a629b4 100644
---
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
+++
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.ssh;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.support.ScheduledPollConsumer;
+import org.apache.camel.util.ObjectHelper;
import org.apache.sshd.client.SshClient;
public class SshConsumer extends ScheduledPollConsumer {
@@ -33,6 +34,10 @@ public class SshConsumer extends ScheduledPollConsumer {
@Override
protected void doStart() throws Exception {
+ if (ObjectHelper.isEmpty(endpoint.getPollCommand())) {
+ // without it, every poll connects and authenticates, then fails
+ throw new IllegalArgumentException("The consumer needs the
pollCommand option: set it to the command to run");
+ }
client = SshUtils.createAndStartClient(endpoint.getConfiguration());
super.doStart();
diff --git
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
index 3868ded201e1..c3d70fc07bce 100644
---
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
+++
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
@@ -82,6 +82,10 @@ public class SshEndpoint extends ScheduledPollEndpoint
implements EndpointServic
@Override
protected void doStart() throws Exception {
+ if (!Channel.CHANNEL_EXEC.equals(getChannelType()) &&
!Channel.CHANNEL_SHELL.equals(getChannelType())) {
+ throw new IllegalArgumentException(
+ "Unsupported channelType " + getChannelType() + ": set
channelType to exec or shell");
+ }
if (Channel.CHANNEL_SHELL.equals(getChannelType()) &&
ObjectHelper.isEmpty(getShellPrompt())) {
throw new IllegalArgumentException(
"The shell channel needs the shellPrompt option: set
shellPrompt to the text the shell prompt ends with");
diff --git
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
index b8a2c6d0be0c..2af0eb59ae4c 100644
---
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
+++
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
@@ -31,6 +31,7 @@ import java.util.Set;
import java.util.function.Supplier;
import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.util.StringHelper;
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.channel.ClientChannelEvent;
@@ -139,6 +140,14 @@ public final class SshHelper {
} else {
pair = keyPairProvider.loadKey(session,
configuration.getKeyType());
}
+ if (pair == null) {
+ // addPublicKeyIdentity would fail with a
NullPointerException "No key-pair to add"
+ String source = describeKeySource(certResource);
+ throw new RuntimeCamelException(
+ configuration.getKeyType() != null
+ ? "No key pair of type " +
configuration.getKeyType() + " found in " + source
+ : "No key pair found in " + source);
+ }
session.addPublicKeyIdentity(pair);
} else {
@@ -174,6 +183,10 @@ public final class SshHelper {
// this approach is used to send the command and evaluate the
response
channel = session.createChannel(Channel.CHANNEL_SHELL);
in = new PipedInputStream(reply);
+ } else {
+ // SshEndpoint rejects other values when it starts
+ throw new IllegalArgumentException(
+ "Unsupported channelType " + endpoint.getChannelType()
+ ": use exec or shell");
}
channel.setIn(in);
@@ -184,17 +197,30 @@ public final class SshHelper {
ByteArrayOutputStream err = new ByteArrayOutputStream();
channel.setErr(err);
OpenFuture openFuture = channel.open();
- openFuture.await(configuration.getTimeout());
+ // channelOpenTimeout, when set, limits the wait for the channel
instead of timeout
+ long channelOpenTimeout = configuration.getChannelOpenTimeout() > 0
+ ? configuration.getChannelOpenTimeout() :
configuration.getTimeout();
+ openFuture.await(channelOpenTimeout);
+ if (!openFuture.isOpened()) {
+ String channelTo = "the " + endpoint.getChannelType() + "
channel to " + configuration.getHost() + ":"
+ + configuration.getPort();
+ Throwable refused = openFuture.getException();
+ if (refused != null) {
+ // the server answered, and refused to open the channel
+ throw new RuntimeCamelException(
+ "The server refused to open " + channelTo + ": " +
refused.getMessage(), refused);
+ }
+ throw new RuntimeCamelException(
+ "Failed to open " + channelTo + " within timeout " +
channelOpenTimeout + "ms");
+ }
SshResult result = null;
if (Channel.CHANNEL_EXEC.equals(endpoint.getChannelType())) {
- if (openFuture.isOpened()) {
- Set<ClientChannelEvent> events =
channel.waitFor(Arrays.asList(ClientChannelEvent.CLOSED), 0);
- if (!events.contains(ClientChannelEvent.TIMEOUT)) {
- result = new SshResult(
- command, channel.getExitStatus(),
- new ByteArrayInputStream(out.toByteArray()),
- new ByteArrayInputStream(err.toByteArray()));
- }
+ Set<ClientChannelEvent> events =
channel.waitFor(Arrays.asList(ClientChannelEvent.CLOSED), 0);
+ if (!events.contains(ClientChannelEvent.TIMEOUT)) {
+ result = new SshResult(
+ command, channel.getExitStatus(),
+ new ByteArrayInputStream(out.toByteArray()),
+ new ByteArrayInputStream(err.toByteArray()));
}
} else if
(Channel.CHANNEL_SHELL.equals(endpoint.getChannelType())) {
getPrompt(channel, out, endpoint);
@@ -219,6 +245,20 @@ public final class SshHelper {
}
+ /**
+ * Where the key pair comes from, for an error message. A base64: or mem:
resource holds the key itself, so only its
+ * scheme is named.
+ */
+ static String describeKeySource(String certResource) {
+ if (certResource == null) {
+ return "keyPairProvider";
+ }
+ if (certResource.startsWith("base64:") ||
certResource.startsWith("mem:")) {
+ return "certResource (" + StringHelper.before(certResource, ":") +
")";
+ }
+ return "certResource " + certResource;
+ }
+
private static String getPrompt(ClientChannel channel,
ByteArrayOutputStream output, SshEndpoint endpoint)
throws InterruptedException {
diff --git
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshUtils.java
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshUtils.java
index 92df9f90a0a0..c385db200ab9 100644
---
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshUtils.java
+++
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshUtils.java
@@ -80,7 +80,7 @@ public class SshUtils {
public static List<KeyExchangeFactory> filter(List<KeyExchangeFactory>
factories, String[] names) {
List<KeyExchangeFactory> list = new ArrayList<>();
- LOGGER.info("List of available kex algorithms : {}",
+ LOGGER.trace("List of available kex algorithms : {}",
factories.stream().map(NamedResource::getName).collect(joining(",")));
for (String name : names) {
@@ -130,9 +130,13 @@ public class SshUtils {
if (isBlank(names)) {
return;
}
- Set<BuiltinDHFactories> builtin = BuiltinDHFactories.VALUES;
- NavigableSet<DHFactory> dhFactories =
BuiltinDHFactories.getRegisteredExtensions();
- List<KeyExchangeFactory> avail =
NamedFactory.setUpTransformedFactories(false, builtin, ClientBuilder.DH2KEX);
+ Set<BuiltinDHFactories> builtIn = BuiltinDHFactories.VALUES;
+ NavigableSet<DHFactory> registered =
BuiltinDHFactories.getRegisteredExtensions();
+ Set<DHFactory> allDHFactories = new HashSet<>();
+ allDHFactories.addAll(builtIn);
+ allDHFactories.addAll(registered);
+ List<KeyExchangeFactory> avail
+ = NamedFactory.setUpTransformedFactories(false,
allDHFactories, ClientBuilder.DH2KEX);
factoryManager.setKeyExchangeFactories(filter(avail,
names.split(",")));
}
@@ -178,9 +182,8 @@ public class SshUtils {
client = configuration.getClientBuilder().build(true);
}
configureAlgorithms(configuration, client);
- if (configuration.getIdleTimeout() > 0) {
- CoreModuleProperties.IDLE_TIMEOUT.set(client,
Duration.ofMillis(configuration.getIdleTimeout()));
- }
+ // Apache MINA SSHD applies only a positive idle timeout, so 0 or less
turns it off
+ CoreModuleProperties.IDLE_TIMEOUT.set(client,
Duration.ofMillis(Math.max(0, configuration.getIdleTimeout())));
if (configuration.getHeartbeatInterval() > 0) {
CoreModuleProperties.HEARTBEAT_INTERVAL.set(client,
Duration.ofMillis(configuration.getHeartbeatInterval()));
}
diff --git
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshAlgorithmParametersTest.java
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshAlgorithmParametersTest.java
index b0e9f6eb1d01..8930c1886fbd 100644
---
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshAlgorithmParametersTest.java
+++
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshAlgorithmParametersTest.java
@@ -100,6 +100,8 @@ public class SshAlgorithmParametersTest extends
CamelTestSupport {
public void consumerCiphersParameterTest() throws Exception {
context.getComponent("ssh", SshComponent.class);
SshEndpoint endpoint = context.getEndpoint(getSshEndpointURI(),
SshEndpoint.class);
+ // a consumer needs a poll command to start
+ endpoint.setPollCommand("test");
SshConsumer consumer = (SshConsumer) endpoint.createConsumer(x -> {
});
consumer.start();
@@ -111,6 +113,8 @@ public class SshAlgorithmParametersTest extends
CamelTestSupport {
public void consumerCustomClientParameterTest() throws Exception {
context.getComponent("ssh", SshComponent.class);
SshEndpoint endpoint =
context.getEndpoint(getCustomClientSshEndpointURI(), SshEndpoint.class);
+ // a consumer needs a poll command to start
+ endpoint.setPollCommand("test");
SshConsumer consumer = (SshConsumer) endpoint.createConsumer(x -> {
});
consumer.start();
diff --git
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshConfigurationErrorsTest.java
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshConfigurationErrorsTest.java
new file mode 100644
index 000000000000..e0bf8fe8fdc5
--- /dev/null
+++
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshConfigurationErrorsTest.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.ssh;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.apache.sshd.client.SshClient;
+import org.apache.sshd.common.NamedResource;
+import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.common.channel.ChannelFactory;
+import org.apache.sshd.common.kex.AbstractDH;
+import org.apache.sshd.common.kex.BuiltinDHFactories;
+import org.apache.sshd.common.kex.DHFactory;
+import org.apache.sshd.common.kex.KeyExchangeFactory;
+import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
+import org.apache.sshd.common.session.Session;
+import org.apache.sshd.core.CoreModuleProperties;
+import org.apache.sshd.server.SshServer;
+import org.apache.sshd.server.channel.ChannelSessionFactory;
+import org.apache.sshd.server.forward.DirectTcpipFactory;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * A misconfigured endpoint fails with a message that names the problem,
instead of a NullPointerException, and the
+ * options that had no effect apply.
+ */
+public class SshConfigurationErrorsTest extends SshComponentTestSupport {
+
+ @Test
+ public void testRefusedChannelSaysSo() throws Exception {
+ // a server that accepts the session but refuses the session channel
+ SshServer refusing = SshServer.setUpDefaultServer();
+ refusing.setPort(0);
+ refusing.setKeyPairProvider(new
FileKeyPairProvider(Paths.get(getHostKey())));
+ refusing.setPasswordAuthenticator((username, password, session) ->
true);
+ // only forwarding channels: the session channel that runs the command
is refused
+ refusing.setChannelFactories(List.of(DirectTcpipFactory.INSTANCE));
+ refusing.start();
+ try {
+ String uri = "ssh://smx:smx@localhost:" + refusing.getPort() +
"?timeout=30000";
+ CamelExecutionException e
+ = assertThrows(CamelExecutionException.class, () ->
template.requestBody(uri, "test"));
+
+ Throwable cause = causeStartingWith(e, "The server refused to open
the exec channel to localhost:");
+ assertTrue(cause.getCause() != null, "the reason from the server
is the cause");
+ } finally {
+ refusing.stop(true);
+ }
+ }
+
+ @Test
+ public void testChannelThatDoesNotOpenInTimeFailsWithChannelOpenTimeout()
throws Exception {
+ // a server that does not open the session channel until the test
releases it
+ CountDownLatch release = new CountDownLatch(1);
+ SshServer slow = SshServer.setUpDefaultServer();
+ slow.setPort(0);
+ slow.setKeyPairProvider(new
FileKeyPairProvider(Paths.get(getHostKey())));
+ slow.setPasswordAuthenticator((username, password, session) -> true);
+ slow.setCommandFactory(new TestEchoCommandFactory());
+ slow.setChannelFactories(List.of(new ChannelFactory() {
+ @Override
+ public String getName() {
+ return ChannelSessionFactory.INSTANCE.getName();
+ }
+
+ @Override
+ public Channel createChannel(Session session) throws IOException {
+ try {
+ release.await(30, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ return ChannelSessionFactory.INSTANCE.createChannel(session);
+ }
+ }));
+ slow.start();
+ try {
+ // channelOpenTimeout, not timeout, limits the wait for the channel
+ String uri = "ssh://smx:smx@localhost:" + slow.getPort() +
"?timeout=30000&channelOpenTimeout=500";
+ CamelExecutionException e
+ = assertThrows(CamelExecutionException.class, () ->
template.requestBody(uri, "test"));
+
+ Throwable cause = causeStartingWith(e, "Failed to open the exec
channel to localhost:");
+ assertTrue(cause.getMessage().endsWith(" within timeout 500ms"),
cause.getMessage());
+ } finally {
+ release.countDown();
+ slow.stop(true);
+ }
+ }
+
+ @Test
+ public void testKeyTypeWithoutKeyPairNamesTheKeyType() {
+ String uri = "ssh://smx@localhost:" + port +
"?certResource=file:src/test/resources/rsa.pem&keyType=ssh-ed25519";
+ CamelExecutionException e =
assertThrows(CamelExecutionException.class, () -> template.requestBody(uri,
"test"));
+
+ causeStartingWith(e, "No key pair of type ssh-ed25519 found in
certResource file:src/test/resources/rsa.pem");
+ }
+
+ @Test
+ public void testUnreadableCertResourceNamesTheResource() {
+ String uri = "ssh://smx@localhost:" + port +
"?certResource=file:src/test/resources/no-such-key.pem";
+ CamelExecutionException e =
assertThrows(CamelExecutionException.class, () -> template.requestBody(uri,
"test"));
+
+ causeStartingWith(e, "No key pair found in certResource
file:src/test/resources/no-such-key.pem");
+ }
+
+ @Test
+ public void testKeySourceDoesNotPrintAnInlineKey() {
+ assertEquals("certResource file:/keys/id_rsa",
SshHelper.describeKeySource("file:/keys/id_rsa"));
+ assertEquals("certResource (base64)",
SshHelper.describeKeySource("base64:LS0tLS1CRUdJTiBQUklWQVRF"));
+ assertEquals("certResource (mem)",
SshHelper.describeKeySource("mem:-----BEGIN PRIVATE KEY-----"));
+ assertEquals("keyPairProvider", SshHelper.describeKeySource(null));
+ }
+
+ @Test
+ public void testUnsupportedChannelTypeFailsToStart() {
+ // the endpoint starts when it is resolved
+ ResolveEndpointFailedException e =
assertThrows(ResolveEndpointFailedException.class,
+ () -> context.getEndpoint("ssh://smx:smx@localhost:" + port +
"?channelType=subsystem"));
+
+ assertInstanceOf(IllegalArgumentException.class, e.getCause());
+ assertEquals("Unsupported channelType subsystem: set channelType to
exec or shell", e.getCause().getMessage());
+ }
+
+ @Test
+ public void testConsumerWithoutPollCommandFailsToStart() throws Exception {
+ SshEndpoint endpoint = context.getEndpoint("ssh://smx:smx@localhost:"
+ port, SshEndpoint.class);
+ SshConsumer consumer = (SshConsumer) endpoint.createConsumer(exchange
-> {
+ });
+
+ IllegalArgumentException e =
assertThrows(IllegalArgumentException.class, consumer::start);
+ assertEquals("The consumer needs the pollCommand option: set it to the
command to run", e.getMessage());
+ }
+
+ @Test
+ public void testIdleTimeoutDefaultAndZero() throws Exception {
+ // the default keeps the 10 minutes of Apache MINA SSHD, and 0 turns
the idle timeout off
+ assertEquals(Duration.ofMinutes(10),
idleTimeoutOf("ssh://smx:smx@localhost:" + port));
+ assertEquals(Duration.ZERO, idleTimeoutOf("ssh://smx:smx@localhost:" +
port + "?idleTimeout=0"));
+ assertEquals(Duration.ZERO, idleTimeoutOf("ssh://smx:smx@localhost:" +
port + "?idleTimeout=-1"));
+ }
+
+ @Test
+ public void testKexIncludesRegisteredExtensions() {
+ DHFactory extension = new
RenamedDHFactory("[email protected]", BuiltinDHFactories.ecdhp256);
+ BuiltinDHFactories.registerExtension(extension);
+ try {
+ SshClient client = SshClient.setUpDefaultClient();
+
SshUtils.configureKexAlgorithms("[email protected],ecdh-sha2-nistp384",
client);
+
+ List<String> names =
client.getKeyExchangeFactories().stream().map(KeyExchangeFactory::getName).toList();
+ assertEquals(List.of("[email protected]",
"ecdh-sha2-nistp384"), names);
+ } finally {
+ BuiltinDHFactories.unregisterExtension(extension.getName());
+ }
+ }
+
+ private static Throwable causeStartingWith(Throwable e, String prefix) {
+ for (Throwable t = e; t != null; t = t.getCause()) {
+ if (t.getMessage() != null && t.getMessage().startsWith(prefix)) {
+ return t;
+ }
+ }
+ throw new AssertionError("No cause starting with '" + prefix + "' in "
+ e, e);
+ }
+
+ private Duration idleTimeoutOf(String uri) throws Exception {
+ SshEndpoint endpoint = context.getEndpoint(uri, SshEndpoint.class);
+ SshProducer producer = (SshProducer) endpoint.createProducer();
+ producer.start();
+ try {
+ SshClient client = (SshClient) FieldUtils.readField(producer,
"client", true);
+ return CoreModuleProperties.IDLE_TIMEOUT.getRequired(client);
+ } finally {
+ producer.stop();
+ }
+ }
+
+ /**
+ * A key exchange registered under another name, as a provider of an
extension would register it.
+ */
+ private static final class RenamedDHFactory implements DHFactory {
+ private final String name;
+ private final DHFactory delegate;
+
+ RenamedDHFactory(String name, DHFactory delegate) {
+ this.name = name;
+ this.delegate = delegate;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean isSupported() {
+ return delegate.isSupported();
+ }
+
+ @Override
+ public boolean isGroupExchange() {
+ return delegate.isGroupExchange();
+ }
+
+ @Override
+ public AbstractDH create(Object... params) throws Exception {
+ return delegate.create(params);
+ }
+
+ @Override
+ public String toString() {
+ return NamedResource.class.getSimpleName() + "[" + name + "]";
+ }
+ }
+}
diff --git
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
index 0602864f5162..17657f243516 100644
---
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
+++
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
@@ -82,7 +82,7 @@ public class SshIdleTimeoutTest extends
SshComponentTestSupport {
@Test
public void testConsumerIdleTimeoutAppliedToClient() throws Exception {
SshEndpoint endpoint = context.getEndpoint(
- "ssh://smx:smx@localhost:" + port +
"?timeout=3000&idleTimeout=60000", SshEndpoint.class);
+ "ssh://smx:smx@localhost:" + port +
"?timeout=3000&idleTimeout=60000&pollCommand=test", SshEndpoint.class);
SshConsumer consumer = (SshConsumer) endpoint.createConsumer(x -> {
});
consumer.start();
@@ -94,15 +94,15 @@ public class SshIdleTimeoutTest extends
SshComponentTestSupport {
}
@Test
- public void testDefaultNoIdleTimeoutOnClient() throws Exception {
+ public void testDefaultIdleTimeoutOnClient() throws Exception {
SshEndpoint endpoint = context.getEndpoint(
"ssh://smx:smx@localhost:" + port + "?timeout=3000",
SshEndpoint.class);
SshProducer producer = (SshProducer) endpoint.createProducer();
producer.start();
SshClient client = (SshClient) FieldUtils.readField(producer,
"client", true);
- Duration idleTimeout =
CoreModuleProperties.IDLE_TIMEOUT.getOrNull(client);
- Assertions.assertNull(idleTimeout, "Idle timeout should not be
explicitly set by default");
+ // the default of the option is the default of Apache MINA SSHD, 10
minutes
+ Assertions.assertEquals(Duration.ofMinutes(10),
CoreModuleProperties.IDLE_TIMEOUT.getOrNull(client));
}
private void startDelayedServer() throws Exception {
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index f5a9fc5c8a27..5532203ea06d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -12518,6 +12518,21 @@ is, which a client or server may reject, and
camel-vertx-http failed the exchang
("a header name cannot contain some prohibited characters") after the route
had run. Headers with a valid name are
written as before.
+=== camel-ssh - idleTimeout, channelOpenTimeout, and endpoints that cannot
work fail to start
+
+The `idleTimeout` option now has the default value 600000 (10 minutes), the
idle timeout that Apache MINA SSHD used before
+when the option was not set, and a value of 0 or less now turns the idle
timeout off. Before, 0 or less also gave the 10
+minutes of Apache MINA SSHD, and there was no way to turn the idle timeout
off. A route that sets `idleTimeout=0` and
+relies on the session being closed after 10 minutes without traffic must set
`idleTimeout=600000` instead.
+
+The `channelOpenTimeout` option now limits how long the component waits for
the channel that runs the command, instead
+of the `timeout` option, when it is set. Before, it had no effect on that
channel.
+
+An endpoint with a `channelType` other than `exec` or `shell` now fails to
start, and so does a consumer without a
+`pollCommand`. Before, each exchange or poll failed after connecting and
authenticating. A channel that does not open
+within the timeout, and a `certResource` or `keyPairProvider` that gives no
key pair (or none of the `keyType`), now
+fail the exchange with an exception that says so, instead of a
`NullPointerException`.
+
=== camel-pinecone - the pinecone:embeddings transformer leaves the index name
unset
The `pinecone:embeddings` data type transformer no longer sets the
`CamelPineconeIndexName` header to
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
index 234ffba0e147..3df3fd511997 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
@@ -54,7 +54,8 @@ public interface SshComponentBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option is a: <code>long</code> type.
*
@@ -181,10 +182,9 @@ public interface SshComponentBuilderFactory {
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option is a: <code>long</code> type.
*
@@ -202,8 +202,8 @@ public interface SshComponentBuilderFactory {
/**
* 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. Other values are not
- * supported.
+ * the output up to the shellPrompt text. The endpoint fails to start
+ * with another value.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -323,13 +323,16 @@ public interface SshComponentBuilderFactory {
return this;
}
+
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option is a: <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
index fa9922de5b10..8650be9a6973 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
@@ -46,7 +46,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option is a: <code>long</code> type.
*
@@ -63,7 +64,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option will be converted to a <code>long</code> type.
*
@@ -1072,10 +1074,9 @@ public interface SshEndpointBuilderFactory {
return this;
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option is a: <code>long</code> type.
*
@@ -1089,10 +1090,9 @@ public interface SshEndpointBuilderFactory {
return this;
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option will be converted to a <code>long</code> type.
*
@@ -1108,8 +1108,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. Other values are not
- * supported.
+ * the output up to the shellPrompt text. The endpoint fails to start
+ * with another value.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -1275,11 +1275,13 @@ public interface SshEndpointBuilderFactory {
}
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option is a: <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set
@@ -1291,11 +1293,13 @@ public interface SshEndpointBuilderFactory {
}
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option will be converted to a <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set
@@ -1370,7 +1374,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option is a: <code>long</code> type.
*
@@ -1387,7 +1392,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option will be converted to a <code>long</code> type.
*
@@ -1782,10 +1788,9 @@ public interface SshEndpointBuilderFactory {
return this;
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option is a: <code>long</code> type.
*
@@ -1799,10 +1804,9 @@ public interface SshEndpointBuilderFactory {
return this;
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option will be converted to a <code>long</code> type.
*
@@ -1818,8 +1822,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. Other values are not
- * supported.
+ * the output up to the shellPrompt text. The endpoint fails to start
+ * with another value.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -1985,11 +1989,13 @@ public interface SshEndpointBuilderFactory {
}
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option is a: <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set
@@ -2001,11 +2007,13 @@ public interface SshEndpointBuilderFactory {
}
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option will be converted to a <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set
@@ -2081,7 +2089,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option is a: <code>long</code> type.
*
@@ -2098,7 +2107,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. It does not limit how long the command runs.
+ * opening of the channel, unless channelOpenTimeout is set. It does
not
+ * limit how long the command runs.
*
* The option will be converted to a <code>long</code> type.
*
@@ -2408,10 +2418,9 @@ public interface SshEndpointBuilderFactory {
return this;
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option is a: <code>long</code> type.
*
@@ -2425,10 +2434,9 @@ public interface SshEndpointBuilderFactory {
return this;
}
/**
- * Sets a channel open timeout of Apache MINA SSHD that applies only to
- * SSH agent forwarding, which this component does not use. The timeout
- * option limits how long the component waits for the channel that runs
- * the command.
+ * 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.
*
* The option will be converted to a <code>long</code> type.
*
@@ -2444,8 +2452,8 @@ public interface SshEndpointBuilderFactory {
/**
* 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. Other values are not
- * supported.
+ * the output up to the shellPrompt text. The endpoint fails to start
+ * with another value.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -2611,11 +2619,13 @@ public interface SshEndpointBuilderFactory {
}
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option is a: <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set
@@ -2627,11 +2637,13 @@ public interface SshEndpointBuilderFactory {
}
/**
* The time in milliseconds after which Apache MINA SSHD closes a
- * session without traffic. The session is open while a command runs.
If
- * 0 or less, the default of Apache MINA SSHD, 10 minutes, applies.
+ * 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.
*
* The option will be converted to a <code>long</code> type.
*
+ * Default: 600000
* Group: advanced
*
* @param idleTimeout the value to set