Ayush0612005 opened a new pull request, #31040: URL: https://github.com/apache/camel/pull/31040
# Description [CAMEL-27702](https://issues.apache.org/jira/browse/CAMEL-27702): the camel-ssh problems @davsclaus found while improving the option descriptions (CAMEL-23832). Numbers follow the ticket. 1. **channelOpenTimeout**: when set, it now limits the wait for the exec or shell channel (`openFuture.await(...)` in `SshHelper.sendExecCommand()`), instead of `timeout`. Before, it only set an Apache MINA SSHD property that agent forwarding reads. 2. **idleTimeout**: the option now has the default value 600000, the 10 minutes Apache MINA SSHD applied before, and the value is always passed on, so 0 or less turns the idle timeout off. SSHD 2.20 applies an idle timeout only when it is positive (`SessionHelper.checkIdleTimeout`). Before, 0 or less also meant 10 minutes, and the idle timeout could not be turned off. 3. **A channel that does not open in time**: `sendExecCommand()` now throws `Failed to open the exec channel to host:port within timeout Nms`, with the cause from the open future, instead of returning null and failing with a `NullPointerException` in `SshProducer` and `SshConsumer`. 4. **No key pair**: when `certResource` cannot be read, or `keyType` matches no key pair, it throws `No key pair found in certResource ...` or `No key pair of type ... found in ...`, instead of `NullPointerException: No key-pair to add`. 5. **channelType**: `SshEndpoint.doStart()` rejects a value other than `exec` or `shell`, and the option has `enums = "exec,shell"`. `sendExecCommand()` also throws for it, instead of a `NullPointerException` on `channel.setIn(in)`. 6. **pollCommand**: `SshConsumer.doStart()` fails when it is not set, instead of every poll connecting, authenticating and failing. 7. **Authentication failure message**: not changed here. CAMEL-27707 (#31036) changes that line to use `userName`. 8. **kex**: `configureKexAlgorithms()` now matches the registered DH extensions too, as the other `configure...` methods do, and `filter()` lists the available key exchanges at TRACE instead of INFO. 9. **Header labels**: `CamelSshStderr` and `CamelSshExitValue` are labelled `common` (the build plugin requires `common` instead of `consumer,producer` for headers both sides use). The labels of `CamelSshUsername` and `CamelSshPassword` are left to #31036, which changes those two headers. The upgrade guide for 4.24 has an entry for the `idleTimeout` default and the endpoints that now fail to start. The catalog copy of `ssh.json` and the javadoc of the endpoint and component DSL builders are updated for the changed option descriptions and the `idleTimeout` default. # Tests New `SshConfigurationErrorsTest`, against the embedded SSHD server of `SshComponentTestSupport`: - a server that only offers forwarding channels refuses the session channel: the exchange fails with the "Failed to open the exec channel" message, which names `channelOpenTimeout=4321`, not `timeout`; - `keyType=ssh-ed25519` with an RSA `certResource`, and a `certResource` that does not exist, fail with the messages that name them; - `channelType=subsystem` fails when the endpoint starts; - a consumer without `pollCommand` fails to start; - the client gets an idle timeout of 10 minutes by default and of zero with `idleTimeout=0` and `-1`; - a DH factory registered as an extension is accepted by `configureKexAlgorithms()`. Without the change, all 7 tests fail. Existing tests that started a consumer without `pollCommand` only to read the client configuration now set one, and `SshIdleTimeoutTest` now expects the 10-minute default on the client. The camel-ssh tests pass (85). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I built camel-ssh with `install` (including code generation, `formatter:format` and `impsort:sort`). _Claude Code on behalf of Ayush0612005_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
