Claus Ibsen created CAMEL-27707:
-----------------------------------
Summary: camel-ssh - The CamelSshUsername and CamelSshPassword
headers override the configured credentials, also with key authentication
Key: CAMEL-27707
URL: https://issues.apache.org/jira/browse/CAMEL-27707
Project: Camel
Issue Type: Improvement
Components: camel-ssh
Reporter: Claus Ibsen
Fix For: 4.24.0
{{SshHelper.sendExecCommand()}} takes the user name from the
{{CamelSshUsername}} header, when the message has one, for every kind of
authentication. With {{certResource}} or {{keyPairProvider}} set, the
configured private key is then offered as whatever user the header names, not
as the {{username}} of the endpoint. Without a key, the {{CamelSshPassword}}
header also replaces the {{password}} of the endpoint.
The doc page says that the headers take precedence over the configured
credentials, but not that the header user is also used with the configured key.
A message that reaches the producer with these headers set (for example from an
HTTP or JMS consumer earlier in the route, where the headers are copied from
the incoming message) chooses the user the command runs as.
The consumer is not affected: the exchange of a poll has no headers.
h4. Proposed change
* Add an option {{allowUsernameAndPasswordFromHeaders}} (component and
endpoint, default {{false}}), named like
{{allowSystemIdAndPasswordFromHeaders}} of camel-smpp (CAMEL-27227). When it is
disabled, the producer logs in with the {{username}} and {{password}} of the
endpoint and ignores the headers. When it is enabled, the headers are used as
before, also with key authentication.
* Document the option and the headers (including that the header user is used
with the configured key), and add an upgrade guide entry, as routes that set
these headers need the option.
* While there (item 7 of CAMEL-27702): the authentication failure message names
the user that was used, and the two headers get {{label = "producer"}} (item 9,
for these two headers).
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)