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 2efa6b8e227f CAMEL-27619: camel-jsch - missing known_hosts,
keyboard-interactive password, per-instance JSch logger (#31005)
2efa6b8e227f is described below
commit 2efa6b8e227fd71d49ae86ec335a9ff95cf4286f
Author: allthingssecurity <[email protected]>
AuthorDate: Sat Nov 28 03:22:17 2026 +0530
CAMEL-27619: camel-jsch - missing known_hosts, keyboard-interactive
password, per-instance JSch logger (#31005)
1. With the default useUserKnownHostsFile=true and no knownHostsFile, a
~/.ssh/known_hosts that does not exist failed the connection with
"Cannot load known host file". It now means that no host is known, as
with useUserKnownHostsFile=false and as JSch itself does for a known
hosts file that does not exist (camel-ftp sftp passes the path to
JSch). strictHostKeyChecking then decides. A knownHostsFile that is set
and cannot be read still fails.
2. The password was only given through UserInfo.getPassword(), and
promptKeyboardInteractive() returns null, so keyboard-interactive login
never succeeded. The password is now also set on the session, which
JSch uses to answer a single, not echoed keyboard-interactive question
that contains "password:". Any other question is still cancelled.
3. ScpComponent set the static JSch logger when it started, for every JSch
user in the JVM. The logger is now set on the JSch instance of each
session (JSch.setInstanceLogger), and the static logger is left alone.
The logger only reads the component's verboseLogging and logs with its
SLF4J logger, so one instance is shared by the sessions.
4. An invalid chmod value is still replaced by 664 (failing would break
endpoints that work today), and is now logged at WARN.
5. certFile and certUri load the certificate in the same way, and certFile
takes precedence. certUri is deprecated, and its description no longer
says that it loads from the classpath by default.
6. knownHostsFile, certFile, certUri, certBytes and
preferredAuthentications hold no secret and are no longer marked
secret.
7. verboseLogging of the component has the label advanced, and chmod the
label producer.
Not changed: 8. The descriptions of host, port, timeout and soTimeout
come from RemoteFileConfiguration of camel-ftp. Excluding soTimeout would
make an scp URI that sets it fail as an unknown option; the texts are for
the descriptions work of CAMEL-23832.
Upgrade guide entry for 4.24 for points 1 to 6. Regenerated: the
component JSON and its catalog copy, the doc page and its catalog copy,
ScpEndpointUriFactory, and the endpoint and component DSL.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../org/apache/camel/catalog/components/scp.json | 22 ++---
.../apache/camel/catalog/docs/scp-component.adoc | 9 +-
.../camel/component/scp/ScpEndpointUriFactory.java | 7 +-
.../org/apache/camel/component/scp/scp.json | 22 ++---
.../camel-jsch/src/main/docs/scp-component.adoc | 9 +-
.../apache/camel/component/scp/ScpComponent.java | 19 ++++-
.../camel/component/scp/ScpConfiguration.java | 47 ++++++----
.../apache/camel/component/scp/ScpOperations.java | 33 ++++++--
.../apache/camel/component/scp/ScpCiphersTest.java | 71 ++++++++++++++++
.../camel/component/scp/ScpJschLoggerTest.java | 80 +++++++++++++++++
.../component/scp/ScpKeyboardInteractiveTest.java | 66 +++++++++++++++
.../scp/ScpUserKnownHostsFileMissingTest.java | 99 ++++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 21 +++++
.../component/dsl/ScpComponentBuilderFactory.java | 40 ++++-----
.../endpoint/dsl/ScpEndpointBuilderFactory.java | 54 ++++++------
15 files changed, 490 insertions(+), 109 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/scp.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/scp.json
index fd9a98be1f82..1e4034e7c427 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/scp.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/scp.json
@@ -25,8 +25,8 @@
},
"componentProperties": {
"lazyStartProducer": { "index": 0, "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 [...]
- "verboseLogging": { "index": 1, "kind": "property", "displayName":
"Verbose Logging", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether to log the INFO
messages of JSch at INFO level. JSch logs much at INFO level, so by default the
component logs these messages at DEBUG level. The component passes the JSch log
messages, with the [JSCH] [...]
- "autowiredEnabled": { "index": 2, "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 [...]
+ "autowiredEnabled": { "index": 1, "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 [...]
+ "verboseLogging": { "index": 2, "kind": "property", "displayName":
"Verbose Logging", "group": "advanced", "label": "advanced", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether to log
the INFO messages of JSch at INFO level. JSch logs much at INFO level, so by
default the component logs these messages at DEBUG level. The component passes
the JSch log messages, with the [...]
"healthCheckConsumerEnabled": { "index": 3, "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" },
"healthCheckProducerEnabled": { "index": 4, "kind": "property",
"displayName": "Health Check Producer 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 producer based health checks
from this component. Notice: Camel has by default disabled all producer based
health-checks. You can turn on producer [...]
},
@@ -38,9 +38,9 @@
"host": { "index": 0, "kind": "path", "displayName": "Host", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Hostname of the FTP
server" },
"port": { "index": 1, "kind": "path", "displayName": "Port", "group":
"producer", "label": "", "required": false, "type": "integer", "javaType":
"int", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Port of the FTP server"
},
"directoryName": { "index": 2, "kind": "path", "displayName": "Directory
Name", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The starting directory" },
- "chmod": { "index": 3, "kind": "parameter", "displayName": "Chmod",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "664", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The permissions of the file that the producer
writes, as three octal digits, for example 644. Any other valu [...]
- "disconnect": { "index": 4, "kind": "parameter", "displayName":
"Disconnect", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether or not to
disconnect from remote FTP server right after use. Disconnect will only
disconnect the current connection to the FTP server. If you have a consumer
which you want to stop, then you need to stop th [...]
- "checksumFileAlgorithm": { "index": 5, "kind": "parameter", "displayName":
"Checksum File Algorithm", "group": "producer", "label": "producer",
"required": false, "type": "enum", "javaType": "java.lang.String", "enum": [
"MD2", "MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512",
"SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256", "SHA3_384", "SHA3_512" ],
"deprecated": false, "autowired": false, "secret": false, "description": "If
provided, then Camel will calculate a check [...]
+ "disconnect": { "index": 3, "kind": "parameter", "displayName":
"Disconnect", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether or not to
disconnect from remote FTP server right after use. Disconnect will only
disconnect the current connection to the FTP server. If you have a consumer
which you want to stop, then you need to stop th [...]
+ "checksumFileAlgorithm": { "index": 4, "kind": "parameter", "displayName":
"Checksum File Algorithm", "group": "producer", "label": "producer",
"required": false, "type": "enum", "javaType": "java.lang.String", "enum": [
"MD2", "MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512",
"SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256", "SHA3_384", "SHA3_512" ],
"deprecated": false, "autowired": false, "secret": false, "description": "If
provided, then Camel will calculate a check [...]
+ "chmod": { "index": 5, "kind": "parameter", "displayName": "Chmod",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "664", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The permissions of the file that the producer
writes, as three octal digits, for example 644. Any ot [...]
"fileName": { "index": 6, "kind": "parameter", "displayName": "File Name",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "supportSimpleExpression": true, "description": "Use
Expression such as File Language to dynamically set the filename. For
consumers, it's used as a filename filter: only a file with exactly this name
is consumed, as the name is not a pattern (use antI [...]
"jailStartingDirectory": { "index": 7, "kind": "parameter", "displayName":
"Jail Starting Directory", "group": "common", "label": "common", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description": "Used
for jailing (restricting) writing files to the starting directory (and sub)
only. This is enabled by default to not allow Camel to write files to outside
directories (to be more secured [...]
"checksumWriteFile": { "index": 8, "kind": "parameter", "displayName":
"Checksum Write File", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description": "If
checksumFileAlgorithm has been configured then this option controls whether to
write a checksum file as well or not. The checksum file will always be written
in the same folder as the original [...]
@@ -54,18 +54,18 @@
"soTimeout": { "index": 16, "kind": "parameter", "displayName": "So
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "300000", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Sets the so timeout FTP and FTPS Is the
SocketOptions.SO_TIMEOUT value in millis. Recommended opti [...]
"timeout": { "index": 17, "kind": "parameter", "displayName": "Timeout",
"group": "advanced", "label": "advanced", "required": false, "type":
"duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "30000", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Sets the data timeout for waiting for reply
Used only by FTPClient" },
"caSignatureAlgorithms": { "index": 18, "kind": "parameter",
"displayName": "Ca Signature Algorithms", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "A comma-separated list
of the signature algorithms that are accepted for the CA signatur [...]
- "certBytes": { "index": 19, "kind": "parameter", "displayName": "Cert
Bytes", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "byte[]", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate as a byte array,
for certificate-based authentication. Only used together [...]
- "certFile": { "index": 20, "kind": "parameter", "displayName": "Cert
File", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate file for
certificate-based authentication, for example id_ed25519 [...]
- "certUri": { "index": 21, "kind": "parameter", "displayName": "Cert Uri",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "supportFileReference": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "The OpenSSH user
certificate for certificate-based authentication, [...]
- "knownHostsFile": { "index": 22, "kind": "parameter", "displayName":
"Known Hosts File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret",
"supportFileReference": true, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The known hosts file that JSch checks the key
of th [...]
+ "certBytes": { "index": 19, "kind": "parameter", "displayName": "Cert
Bytes", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "byte[]", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate as a byte array,
for certificate-based authentication. Only used together with privateKeyFile
[...]
+ "certFile": { "index": 20, "kind": "parameter", "displayName": "Cert
File", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate file for
certificate-based authentication, for example id_ed25519-cert.pub. A path on
[...]
+ "certUri": { "index": 21, "kind": "parameter", "displayName": "Cert Uri",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": true, "deprecationNote": "Use
certFile, which loads the certificate in the same way and takes precedence.",
"autowired": false, "secret": false, "supportFileReference": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "d [...]
+ "knownHostsFile": { "index": 22, "kind": "parameter", "displayName":
"Known Hosts File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "supportFileReference": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "The known hosts file
that JSch checks the key of the remote host against [...]
"password": { "index": 23, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Password to use for login" },
- "preferredAuthentications": { "index": 24, "kind": "parameter",
"displayName": "Preferred Authentications", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": true,
"security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the SSH
authentication methods to tr [...]
+ "preferredAuthentications": { "index": 24, "kind": "parameter",
"displayName": "Preferred Authentications", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "A comma-separated list
of the SSH authentication methods to try, in order of prefer [...]
"privateKeyBytes": { "index": 25, "kind": "parameter", "displayName":
"Private Key Bytes", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "byte[]", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The private key as a byte array, for public
key authentication. Only used when privateKey [...]
"privateKeyFile": { "index": 26, "kind": "parameter", "displayName":
"Private Key File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The private key file for public key
authentication. A path on the file system, or [...]
"privateKeyFilePassphrase": { "index": 27, "kind": "parameter",
"displayName": "Private Key File Passphrase", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": true,
"security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The passphrase of an encrypted private key of
privateKeyFile [...]
"strictHostKeyChecking": { "index": 28, "kind": "parameter",
"displayName": "Strict Host Key Checking", "group": "security", "label":
"security", "required": false, "type": "enum", "javaType": "java.lang.String",
"enum": [ "no", "yes" ], "deprecated": false, "autowired": false, "secret":
false, "security": "insecure:ssl", "defaultValue": "no", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Sets whether t [...]
"username": { "index": 29, "kind": "parameter", "displayName": "Username",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Username to use for login" },
- "useUserKnownHostsFile": { "index": 30, "kind": "parameter",
"displayName": "Use User Known Hosts File", "group": "security", "label":
"security", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Whether to use the known
hosts file of the user, the .ssh\/known_hosts f [...]
+ "useUserKnownHostsFile": { "index": 30, "kind": "parameter",
"displayName": "Use User Known Hosts File", "group": "security", "label":
"security", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Whether to use the known
hosts file of the user, the .ssh\/known_hosts f [...]
"ciphers": { "index": 31, "kind": "parameter", "displayName": "Ciphers",
"group": "security (advanced)", "label": "security,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the ciphers for the
SSH connection, in order of preference, for example [...]
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/scp-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/scp-component.adoc
index 395bc1052914..6e69adee98ef 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/scp-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/scp-component.adoc
@@ -78,14 +78,19 @@ scp sends the name of each sub directory and of the file on
a protocol line that
name with a line feed or a NUL character is refused with a
`GenericFileOperationFailedException` before anything is
sent to the remote host. Any other character, such as a carriage return or a
tab, is sent as is.
-Without a known hosts file (`useUserKnownHostsFile=false` and no
`knownHostsFile`), no host is known,
+Without a known hosts file (`useUserKnownHostsFile=false` and no
`knownHostsFile`, or the default
+`useUserKnownHostsFile=true` when `.ssh/known_hosts` does not exist in the
home directory), no host is known,
so the option `strictHostKeyChecking` decides: with `yes` the connection
fails, with `no` (the default)
the host key is not checked.
+With the `password` option the producer can log in with the `password` and the
`keyboard-interactive`
+authentication methods. With `keyboard-interactive`, it answers with the
password when the server asks one question
+that is not echoed and contains `password:` (in any case), as a PAM setup
does, and cancels any other question.
+
== OpenSSH Certificate Authentication
-Camel supports OpenSSH certificate-based authentication for SCP connections,
where a user's public key is signed by a Certificate Authority (CA). This is
configured using the `certFile`, `certUri`, or `certBytes` parameters alongside
the private key:
+Camel supports OpenSSH certificate-based authentication for SCP connections,
where a user's public key is signed by a Certificate Authority (CA). This is
configured using the `certFile` or `certBytes` parameters (or the deprecated
`certUri`) alongside the private key:
[tabs]
====
diff --git
a/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
b/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
index 62434d187c59..d3e7a0e6fc3f 100644
---
a/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
+++
b/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
@@ -58,13 +58,8 @@ public class ScpEndpointUriFactory extends
org.apache.camel.support.component.En
props.add("useUserKnownHostsFile");
props.add("username");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
- Set<String> secretProps = new HashSet<>(10);
- secretProps.add("certBytes");
- secretProps.add("certFile");
- secretProps.add("certUri");
- secretProps.add("knownHostsFile");
+ Set<String> secretProps = new HashSet<>(5);
secretProps.add("password");
- secretProps.add("preferredAuthentications");
secretProps.add("privateKeyBytes");
secretProps.add("privateKeyFile");
secretProps.add("privateKeyFilePassphrase");
diff --git
a/components/camel-jsch/src/generated/resources/META-INF/org/apache/camel/component/scp/scp.json
b/components/camel-jsch/src/generated/resources/META-INF/org/apache/camel/component/scp/scp.json
index fd9a98be1f82..1e4034e7c427 100644
---
a/components/camel-jsch/src/generated/resources/META-INF/org/apache/camel/component/scp/scp.json
+++
b/components/camel-jsch/src/generated/resources/META-INF/org/apache/camel/component/scp/scp.json
@@ -25,8 +25,8 @@
},
"componentProperties": {
"lazyStartProducer": { "index": 0, "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 [...]
- "verboseLogging": { "index": 1, "kind": "property", "displayName":
"Verbose Logging", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether to log the INFO
messages of JSch at INFO level. JSch logs much at INFO level, so by default the
component logs these messages at DEBUG level. The component passes the JSch log
messages, with the [JSCH] [...]
- "autowiredEnabled": { "index": 2, "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 [...]
+ "autowiredEnabled": { "index": 1, "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 [...]
+ "verboseLogging": { "index": 2, "kind": "property", "displayName":
"Verbose Logging", "group": "advanced", "label": "advanced", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether to log
the INFO messages of JSch at INFO level. JSch logs much at INFO level, so by
default the component logs these messages at DEBUG level. The component passes
the JSch log messages, with the [...]
"healthCheckConsumerEnabled": { "index": 3, "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" },
"healthCheckProducerEnabled": { "index": 4, "kind": "property",
"displayName": "Health Check Producer 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 producer based health checks
from this component. Notice: Camel has by default disabled all producer based
health-checks. You can turn on producer [...]
},
@@ -38,9 +38,9 @@
"host": { "index": 0, "kind": "path", "displayName": "Host", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Hostname of the FTP
server" },
"port": { "index": 1, "kind": "path", "displayName": "Port", "group":
"producer", "label": "", "required": false, "type": "integer", "javaType":
"int", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Port of the FTP server"
},
"directoryName": { "index": 2, "kind": "path", "displayName": "Directory
Name", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The starting directory" },
- "chmod": { "index": 3, "kind": "parameter", "displayName": "Chmod",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "664", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The permissions of the file that the producer
writes, as three octal digits, for example 644. Any other valu [...]
- "disconnect": { "index": 4, "kind": "parameter", "displayName":
"Disconnect", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether or not to
disconnect from remote FTP server right after use. Disconnect will only
disconnect the current connection to the FTP server. If you have a consumer
which you want to stop, then you need to stop th [...]
- "checksumFileAlgorithm": { "index": 5, "kind": "parameter", "displayName":
"Checksum File Algorithm", "group": "producer", "label": "producer",
"required": false, "type": "enum", "javaType": "java.lang.String", "enum": [
"MD2", "MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512",
"SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256", "SHA3_384", "SHA3_512" ],
"deprecated": false, "autowired": false, "secret": false, "description": "If
provided, then Camel will calculate a check [...]
+ "disconnect": { "index": 3, "kind": "parameter", "displayName":
"Disconnect", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether or not to
disconnect from remote FTP server right after use. Disconnect will only
disconnect the current connection to the FTP server. If you have a consumer
which you want to stop, then you need to stop th [...]
+ "checksumFileAlgorithm": { "index": 4, "kind": "parameter", "displayName":
"Checksum File Algorithm", "group": "producer", "label": "producer",
"required": false, "type": "enum", "javaType": "java.lang.String", "enum": [
"MD2", "MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512",
"SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256", "SHA3_384", "SHA3_512" ],
"deprecated": false, "autowired": false, "secret": false, "description": "If
provided, then Camel will calculate a check [...]
+ "chmod": { "index": 5, "kind": "parameter", "displayName": "Chmod",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "664", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The permissions of the file that the producer
writes, as three octal digits, for example 644. Any ot [...]
"fileName": { "index": 6, "kind": "parameter", "displayName": "File Name",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "supportSimpleExpression": true, "description": "Use
Expression such as File Language to dynamically set the filename. For
consumers, it's used as a filename filter: only a file with exactly this name
is consumed, as the name is not a pattern (use antI [...]
"jailStartingDirectory": { "index": 7, "kind": "parameter", "displayName":
"Jail Starting Directory", "group": "common", "label": "common", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description": "Used
for jailing (restricting) writing files to the starting directory (and sub)
only. This is enabled by default to not allow Camel to write files to outside
directories (to be more secured [...]
"checksumWriteFile": { "index": 8, "kind": "parameter", "displayName":
"Checksum Write File", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description": "If
checksumFileAlgorithm has been configured then this option controls whether to
write a checksum file as well or not. The checksum file will always be written
in the same folder as the original [...]
@@ -54,18 +54,18 @@
"soTimeout": { "index": 16, "kind": "parameter", "displayName": "So
Timeout", "group": "advanced", "label": "advanced", "required": false, "type":
"duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "300000", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Sets the so timeout FTP and FTPS Is the
SocketOptions.SO_TIMEOUT value in millis. Recommended opti [...]
"timeout": { "index": 17, "kind": "parameter", "displayName": "Timeout",
"group": "advanced", "label": "advanced", "required": false, "type":
"duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "30000", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Sets the data timeout for waiting for reply
Used only by FTPClient" },
"caSignatureAlgorithms": { "index": 18, "kind": "parameter",
"displayName": "Ca Signature Algorithms", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "A comma-separated list
of the signature algorithms that are accepted for the CA signatur [...]
- "certBytes": { "index": 19, "kind": "parameter", "displayName": "Cert
Bytes", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "byte[]", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate as a byte array,
for certificate-based authentication. Only used together [...]
- "certFile": { "index": 20, "kind": "parameter", "displayName": "Cert
File", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate file for
certificate-based authentication, for example id_ed25519 [...]
- "certUri": { "index": 21, "kind": "parameter", "displayName": "Cert Uri",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "supportFileReference": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "The OpenSSH user
certificate for certificate-based authentication, [...]
- "knownHostsFile": { "index": 22, "kind": "parameter", "displayName":
"Known Hosts File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret",
"supportFileReference": true, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The known hosts file that JSch checks the key
of th [...]
+ "certBytes": { "index": 19, "kind": "parameter", "displayName": "Cert
Bytes", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "byte[]", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate as a byte array,
for certificate-based authentication. Only used together with privateKeyFile
[...]
+ "certFile": { "index": 20, "kind": "parameter", "displayName": "Cert
File", "group": "security", "label": "security", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The OpenSSH user certificate file for
certificate-based authentication, for example id_ed25519-cert.pub. A path on
[...]
+ "certUri": { "index": 21, "kind": "parameter", "displayName": "Cert Uri",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": true, "deprecationNote": "Use
certFile, which loads the certificate in the same way and takes precedence.",
"autowired": false, "secret": false, "supportFileReference": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "d [...]
+ "knownHostsFile": { "index": 22, "kind": "parameter", "displayName":
"Known Hosts File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "supportFileReference": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "The known hosts file
that JSch checks the key of the remote host against [...]
"password": { "index": 23, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Password to use for login" },
- "preferredAuthentications": { "index": 24, "kind": "parameter",
"displayName": "Preferred Authentications", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": true,
"security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the SSH
authentication methods to tr [...]
+ "preferredAuthentications": { "index": 24, "kind": "parameter",
"displayName": "Preferred Authentications", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "A comma-separated list
of the SSH authentication methods to try, in order of prefer [...]
"privateKeyBytes": { "index": 25, "kind": "parameter", "displayName":
"Private Key Bytes", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "byte[]", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The private key as a byte array, for public
key authentication. Only used when privateKey [...]
"privateKeyFile": { "index": 26, "kind": "parameter", "displayName":
"Private Key File", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The private key file for public key
authentication. A path on the file system, or [...]
"privateKeyFilePassphrase": { "index": 27, "kind": "parameter",
"displayName": "Private Key File Passphrase", "group": "security", "label":
"security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": true,
"security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "The passphrase of an encrypted private key of
privateKeyFile [...]
"strictHostKeyChecking": { "index": 28, "kind": "parameter",
"displayName": "Strict Host Key Checking", "group": "security", "label":
"security", "required": false, "type": "enum", "javaType": "java.lang.String",
"enum": [ "no", "yes" ], "deprecated": false, "autowired": false, "secret":
false, "security": "insecure:ssl", "defaultValue": "no", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Sets whether t [...]
"username": { "index": 29, "kind": "parameter", "displayName": "Username",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "security": "secret", "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "Username to use for login" },
- "useUserKnownHostsFile": { "index": 30, "kind": "parameter",
"displayName": "Use User Known Hosts File", "group": "security", "label":
"security", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Whether to use the known
hosts file of the user, the .ssh\/known_hosts f [...]
+ "useUserKnownHostsFile": { "index": 30, "kind": "parameter",
"displayName": "Use User Known Hosts File", "group": "security", "label":
"security", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"configurationClass": "org.apache.camel.component.scp.ScpConfiguration",
"configurationField": "configuration", "description": "Whether to use the known
hosts file of the user, the .ssh\/known_hosts f [...]
"ciphers": { "index": 31, "kind": "parameter", "displayName": "Ciphers",
"group": "security (advanced)", "label": "security,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.scp.ScpConfiguration", "configurationField":
"configuration", "description": "A comma-separated list of the ciphers for the
SSH connection, in order of preference, for example [...]
}
}
diff --git a/components/camel-jsch/src/main/docs/scp-component.adoc
b/components/camel-jsch/src/main/docs/scp-component.adoc
index 395bc1052914..6e69adee98ef 100644
--- a/components/camel-jsch/src/main/docs/scp-component.adoc
+++ b/components/camel-jsch/src/main/docs/scp-component.adoc
@@ -78,14 +78,19 @@ scp sends the name of each sub directory and of the file on
a protocol line that
name with a line feed or a NUL character is refused with a
`GenericFileOperationFailedException` before anything is
sent to the remote host. Any other character, such as a carriage return or a
tab, is sent as is.
-Without a known hosts file (`useUserKnownHostsFile=false` and no
`knownHostsFile`), no host is known,
+Without a known hosts file (`useUserKnownHostsFile=false` and no
`knownHostsFile`, or the default
+`useUserKnownHostsFile=true` when `.ssh/known_hosts` does not exist in the
home directory), no host is known,
so the option `strictHostKeyChecking` decides: with `yes` the connection
fails, with `no` (the default)
the host key is not checked.
+With the `password` option the producer can log in with the `password` and the
`keyboard-interactive`
+authentication methods. With `keyboard-interactive`, it answers with the
password when the server asks one question
+that is not echoed and contains `password:` (in any case), as a PAM setup
does, and cancels any other question.
+
== OpenSSH Certificate Authentication
-Camel supports OpenSSH certificate-based authentication for SCP connections,
where a user's public key is signed by a Certificate Authority (CA). This is
configured using the `certFile`, `certUri`, or `certBytes` parameters alongside
the private key:
+Camel supports OpenSSH certificate-based authentication for SCP connections,
where a user's public key is signed by a Certificate Authority (CA). This is
configured using the `certFile` or `certBytes` parameters (or the deprecated
`certUri`) alongside the private key:
[tabs]
====
diff --git
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpComponent.java
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpComponent.java
index 2462af0ae046..c62b02fdfb44 100644
---
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpComponent.java
+++
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpComponent.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.scp;
import java.net.URI;
import java.util.Map;
-import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Logger;
import org.apache.camel.CamelContext;
import org.apache.camel.component.file.GenericFileEndpoint;
@@ -34,10 +33,12 @@ import org.apache.camel.util.StringHelper;
@Component("scp")
public class ScpComponent extends RemoteFileComponent<ScpFile> {
- @Metadata(description = "Whether to log the INFO messages of JSch at INFO
level. JSch logs much at INFO level, so by"
+ @Metadata(label = "advanced",
+ description = "Whether to log the INFO messages of JSch at INFO
level. JSch logs much at INFO level, so by"
+ " default the component logs these messages at
DEBUG level. The component passes the JSch log"
+ " messages, with the [JSCH] prefix, to its own
logger.")
private boolean verboseLogging;
+ private Logger jschLogger;
public ScpComponent() {
}
@@ -72,11 +73,21 @@ public class ScpComponent extends
RemoteFileComponent<ScpFile> {
this.verboseLogging = verboseLogging;
}
+ /**
+ * Returns the logger set on the JSch instance of each session created by
this component's endpoints, or null when
+ * {@link #initJsch()} has not created one (the sessions then log with the
static JSch logger).
+ */
+ Logger getJschLogger() {
+ return jschLogger;
+ }
+
protected void initJsch() {
// StrictHostKeyChecking is applied per session from ScpConfiguration
in ScpOperations.createSession();
// a global JSch.setConfig("StrictHostKeyChecking", ...) here would
always be overridden by that per-session
// value, so it is intentionally not set to avoid a misleading (and
contradictory) global default.
- JSch.setLogger(new Logger() {
+ // The logger is set on the JSch instance of each session
(JSch.setInstanceLogger), not with the static
+ // JSch.setLogger, which would apply to every user of JSch in the JVM.
+ jschLogger = new Logger() {
@Override
public boolean isEnabled(int level) {
return level == FATAL || level == ERROR ?
ScpComponent.this.log.isErrorEnabled()
@@ -101,7 +112,7 @@ public class ScpComponent extends
RemoteFileComponent<ScpFile> {
ScpComponent.this.log.debug("[JSCH] {}", message);
}
}
- });
+ };
}
}
diff --git
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
index 8430e443a32c..d29e6e183006 100644
---
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
+++
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
@@ -22,22 +22,25 @@ import
org.apache.camel.component.file.remote.RemoteFileConfiguration;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriParams;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* SCP configuration
*/
@UriParams
public class ScpConfiguration extends RemoteFileConfiguration {
+ private static final Logger LOG =
LoggerFactory.getLogger(ScpConfiguration.class);
public static final int DEFAULT_SFTP_PORT = 22;
public static final String DEFAULT_MOD = "664";
@UriParam(label = "security", defaultValue = "true",
description = "Whether to use the known hosts file of the user,
the .ssh/known_hosts file in the home directory"
+ " (the user.home system property, or the HOME
environment variable), when knownHostsFile is not"
- + " set. If that file cannot be read, the producer
fails to connect. If false and knownHostsFile is"
- + " not set, no host is known, and
strictHostKeyChecking decides whether the producer connects.")
+ + " set. If that file does not exist, or if false
and knownHostsFile is not set, no host is known,"
+ + " and strictHostKeyChecking decides whether the
producer connects.")
private boolean useUserKnownHostsFile = true;
- @UriParam(label = "security", security = "secret",
+ @UriParam(label = "security",
description = "The known hosts file that JSch checks the key of
the remote host against when the producer"
+ " connects, in the OpenSSH known_hosts format. A
path on the file system, or with the classpath:"
+ " prefix a resource on the classpath. An
@cert-authority entry lets the producer accept an"
@@ -59,20 +62,22 @@ public class ScpConfiguration extends
RemoteFileConfiguration {
description = "The passphrase of an encrypted private key of
privateKeyFile or privateKeyBytes. Not needed for a"
+ " key that is not encrypted.")
private String privateKeyFilePassphrase;
- @UriParam(label = "security", security = "secret",
+ @UriParam(label = "security",
description = "The OpenSSH user certificate file for
certificate-based authentication, for example"
+ " id_ed25519-cert.pub. A path on the file
system, or with the classpath: prefix a resource on the"
+ " classpath. Only used together with
privateKeyFile or privateKeyBytes, the private key of the"
+ " certificate. Takes precedence over certUri and
certBytes.")
private String certFile;
- @UriParam(label = "security", security = "secret",
+ @UriParam(label = "security",
description = "The OpenSSH user certificate for
certificate-based authentication, loaded the same way as"
+ " certFile: a path on the file system, or with
the classpath: prefix a resource on the classpath."
+ " Only used together with privateKeyFile or
privateKeyBytes, and when certFile is not set. Takes"
+ " precedence over certBytes.")
- @Metadata(supportFileReference = true)
+ @Metadata(supportFileReference = true,
+ deprecationNote = "Use certFile, which loads the certificate in
the same way and takes precedence.")
+ @Deprecated
private String certUri;
- @UriParam(label = "security", security = "secret",
+ @UriParam(label = "security",
description = "The OpenSSH user certificate as a byte array, for
certificate-based authentication. Only used"
+ " together with privateKeyFile or
privateKeyBytes, and when neither certFile nor certUri is set.")
private byte[] certBytes;
@@ -87,7 +92,7 @@ public class ScpConfiguration extends RemoteFileConfiguration
{
+ " host key verification and makes the connection
vulnerable to man-in-the-middle attacks."
+ " Use 'yes' in production environments.")
private String strictHostKeyChecking = "no";
- @UriParam(defaultValue = DEFAULT_MOD,
+ @UriParam(label = "producer", defaultValue = DEFAULT_MOD,
description = "The permissions of the file that the producer
writes, as three octal digits, for example 644."
+ " Any other value is replaced by 664. The
producer sends it in the scp protocol line of the file,"
+ " and the remote scp uses it when it creates the
file. The directories that the producer creates"
@@ -98,7 +103,7 @@ public class ScpConfiguration extends
RemoteFileConfiguration {
+ " aes128-ctr,aes256-ctr. The cipher names are
those of JSch. If not set, the JSch default list is"
+ " used.")
private String ciphers;
- @UriParam(label = "security", security = "secret",
+ @UriParam(label = "security",
description = "A comma-separated list of the SSH authentication
methods to try, in order of preference, for"
+ " example publickey,password. JSch supports
gssapi-with-mic, publickey, keyboard-interactive and"
+ " password. If not set, the JSch default
gssapi-with-mic,publickey,keyboard-interactive,password"
@@ -166,10 +171,18 @@ public class ScpConfiguration extends
RemoteFileConfiguration {
this.certFile = certFile;
}
+ /**
+ * @deprecated Use certFile, which loads the certificate in the same way
and takes precedence.
+ */
+ @Deprecated
public String getCertUri() {
return certUri;
}
+ /**
+ * @deprecated Use certFile, which loads the certificate in the same way
and takes precedence.
+ */
+ @Deprecated
public void setCertUri(String certUri) {
this.certUri = certUri;
}
@@ -202,17 +215,15 @@ public class ScpConfiguration extends
RemoteFileConfiguration {
}
public void setChmod(String chmod) {
- if (chmod.length() == 3) {
- for (byte c : chmod.getBytes()) {
- if (c < '0' || c > '7') {
- chmod = DEFAULT_MOD;
- break;
- }
- }
- } else {
+ boolean valid = chmod.length() == 3;
+ for (int i = 0; valid && i < chmod.length(); i++) {
+ char c = chmod.charAt(i);
+ valid = c >= '0' && c <= '7';
+ }
+ if (!valid) {
+ LOG.warn("The chmod value {} is not three octal digits, such as
644: the files get {}", chmod, DEFAULT_MOD);
chmod = DEFAULT_MOD;
}
- // May be interesting to log the fallback to DEFAULT_MOD for invalid
configuration
this.chmod = chmod;
}
diff --git
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
index ff4d8aedc552..6a3efc5cd4ca 100644
---
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
+++
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
@@ -19,11 +19,11 @@ package org.apache.camel.component.scp;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
-import java.util.Hashtable;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
@@ -325,13 +325,8 @@ public class ScpOperations implements
RemoteFileOperations<ScpFile> {
ObjectHelper.notNull(config, "ScpConfiguration");
try {
final JSch jsch = new JSch();
- // get from configuration
- if (ObjectHelper.isNotEmpty(config.getCiphers())) {
- LOG.trace("Using ciphers: {}", config.getCiphers());
- Hashtable<String, String> ciphers = new Hashtable<>();
- ciphers.put("cipher.s2c", config.getCiphers());
- ciphers.put("cipher.c2s", config.getCiphers());
- JSch.setConfig(ciphers);
+ if (endpoint.getComponent() instanceof ScpComponent scp &&
scp.getJschLogger() != null) {
+ jsch.setInstanceLogger(scp.getJschLogger());
}
// Resolve certificate bytes once — used for both identity loading
and key type detection
byte[] certData = resolveCertificateBytes(config);
@@ -373,7 +368,12 @@ public class ScpOperations implements
RemoteFileOperations<ScpFile> {
userKnownHostFile = HomeHelper.resolveHomeDir() +
"/.ssh/known_hosts";
LOG.info("Known host file not configured, using user known
host file: {}", userKnownHostFile);
}
- knownHostsFile = userKnownHostFile;
+ if (new File(userKnownHostFile).exists()) {
+ knownHostsFile = userKnownHostFile;
+ } else {
+ // as JSch does for a known hosts file that does not
exist: no host is known
+ LOG.debug("The user known host file {} does not exist, so
no host is known", userKnownHostFile);
+ }
}
// load file as input stream which can then load from classpath etc
if (ObjectHelper.isNotEmpty(knownHostsFile)) {
@@ -393,6 +393,19 @@ public class ScpOperations implements
RemoteFileOperations<ScpFile> {
session = jsch.getSession(config.getUsername(), config.getHost(),
config.getPort());
session.setTimeout(config.getTimeout());
session.setUserInfo(new SessionUserInfo(config));
+ if (ObjectHelper.isNotEmpty(config.getCiphers())) {
+ // on the session: JSch.setConfig would change the ciphers of
every JSch session in the JVM
+ LOG.trace("Using ciphers: {}", config.getCiphers());
+ session.setConfig("cipher.s2c", config.getCiphers());
+ session.setConfig("cipher.c2s", config.getCiphers());
+ }
+ if (config.getPassword() != null) {
+ // JSch answers a keyboard-interactive password prompt only
with the password of the session:
+ // a request of one question that is not echoed and contains
"password:" is answered with it, without
+ // calling SessionUserInfo.promptKeyboardInteractive(). Any
other request goes to that method, which
+ // returns null to cancel it, so the password is never sent as
the answer to another question.
+ session.setPassword(config.getPassword());
+ }
if (ObjectHelper.isNotEmpty(config.getStrictHostKeyChecking())) {
LOG.trace("Using StrickHostKeyChecking: {}",
config.getStrictHostKeyChecking());
@@ -657,6 +670,8 @@ public class ScpOperations implements
RemoteFileOperations<ScpFile> {
LOG.debug(instruction);
// Called for either SSH_MSG_USERAUTH_INFO_REQUEST or
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ
// The most secure choice (especially for the second case) is to
return null
+ // A keyboard-interactive password prompt does not come here: JSch
answers it with the password set on the
+ // session in createSession(), so returning null only cancels the
other questions (do not return the password)
return null;
}
}
diff --git
a/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpCiphersTest.java
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpCiphersTest.java
new file mode 100644
index 000000000000..91e2bf21def6
--- /dev/null
+++
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpCiphersTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.scp;
+
+import com.jcraft.jsch.JSch;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * The ciphers option applies to the session of the endpoint, and leaves the
static configuration of JSch, which applies
+ * to every JSch session in the JVM (such as the sftp sessions of camel-ftp),
as it is.
+ */
+public class ScpCiphersTest extends ScpServerTestSupport {
+
+ public ScpCiphersTest() {
+ super(false);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("file:" + getScpPath() + "?recursive=true&delete=true")
+ .convertBodyTo(String.class)
+ .to("mock:result");
+ }
+ };
+ }
+
+ @Test
+ public void testCiphersAreSetOnTheSessionOnly() throws Exception {
+ assumeTrue(this.isSetupComplete());
+
+ String s2c = JSch.getConfig("cipher.s2c");
+ String c2s = JSch.getConfig("cipher.c2s");
+ try {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello
World");
+
+ String uri = getScpUri() +
"?username=admin&password=admin&useUserKnownHostsFile=false&ciphers=aes128-ctr";
+ template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME,
"hello.txt");
+
+ MockEndpoint.assertIsSatisfied(context);
+ // was set to aes128-ctr for every JSch session in the JVM
+ assertEquals(s2c, JSch.getConfig("cipher.s2c"));
+ assertEquals(c2s, JSch.getConfig("cipher.c2s"));
+ } finally {
+ JSch.setConfig("cipher.s2c", s2c);
+ JSch.setConfig("cipher.c2s", c2s);
+ }
+ }
+}
diff --git
a/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpJschLoggerTest.java
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpJschLoggerTest.java
new file mode 100644
index 000000000000..18cce83da2ed
--- /dev/null
+++
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpJschLoggerTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.scp;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.Logger;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * The component logs the JSch messages of its sessions with a logger of each
JSch instance, and leaves the static
+ * logger of JSch, which applies to every user of JSch in the JVM, as it is.
+ */
+public class ScpJschLoggerTest extends ScpServerTestSupport {
+
+ public ScpJschLoggerTest() {
+ super(false);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("file:" + getScpPath() + "?recursive=true&delete=true")
+ .convertBodyTo(String.class)
+ .to("mock:result");
+ }
+ };
+ }
+
+ @Test
+ public void testStaticJschLoggerIsKept() throws Exception {
+ assumeTrue(this.isSetupComplete());
+
+ Logger before = JSch.getLogger();
+ Logger application = new Logger() {
+ @Override
+ public boolean isEnabled(int level) {
+ return false;
+ }
+
+ @Override
+ public void log(int level, String message) {
+ // noop
+ }
+ };
+ JSch.setLogger(application);
+ try {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello
World");
+
+ String uri = getScpUri() +
"?username=admin&password=admin&useUserKnownHostsFile=false";
+ template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME,
"hello.txt");
+
+ MockEndpoint.assertIsSatisfied(context);
+ assertSame(application, JSch.getLogger());
+ } finally {
+ JSch.setLogger(before);
+ }
+ }
+}
diff --git
a/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpKeyboardInteractiveTest.java
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpKeyboardInteractiveTest.java
new file mode 100644
index 000000000000..c8c90eb8a27a
--- /dev/null
+++
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpKeyboardInteractiveTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.scp;
+
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import
org.apache.sshd.server.auth.keyboard.DefaultKeyboardInteractiveAuthenticator;
+import org.apache.sshd.server.auth.keyboard.UserAuthKeyboardInteractiveFactory;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * A server that offers only keyboard-interactive authentication, which asks
for the password (as a PAM setup does).
+ */
+public class ScpKeyboardInteractiveTest extends ScpServerTestSupport {
+
+ public ScpKeyboardInteractiveTest() {
+ super(false);
+ serverConfigurer = sshd -> {
+
sshd.setUserAuthFactories(List.of(UserAuthKeyboardInteractiveFactory.INSTANCE));
+
sshd.setKeyboardInteractiveAuthenticator(DefaultKeyboardInteractiveAuthenticator.INSTANCE);
+ };
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("file:" + getScpPath() + "?recursive=true&delete=true")
+ .convertBodyTo(String.class)
+ .to("mock:result");
+ }
+ };
+ }
+
+ @Test
+ public void testPasswordWithKeyboardInteractive() throws Exception {
+ assumeTrue(this.isSetupComplete());
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+ String uri = getScpUri() +
"?username=admin&password=admin&useUserKnownHostsFile=false";
+ template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME,
"hello.txt");
+
+ MockEndpoint.assertIsSatisfied(context);
+ }
+}
diff --git
a/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpUserKnownHostsFileMissingTest.java
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpUserKnownHostsFileMissingTest.java
new file mode 100644
index 000000000000..01c3774ba7fb
--- /dev/null
+++
b/components/camel-jsch/src/test/java/org/apache/camel/component/scp/ScpUserKnownHostsFileMissingTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.scp;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * With the default useUserKnownHostsFile=true and no knownHostsFile, a home
directory without .ssh/known_hosts means
+ * that no host is known (as with useUserKnownHostsFile=false), and
strictHostKeyChecking decides.
+ */
+public class ScpUserKnownHostsFileMissingTest extends ScpServerTestSupport {
+
+ @TempDir
+ Path home;
+ private String userHome;
+
+ public ScpUserKnownHostsFileMissingTest() {
+ super(false);
+ }
+
+ @BeforeEach
+ public void setHome() {
+ assertFalse(Files.exists(home.resolve(".ssh/known_hosts")));
+ userHome = System.getProperty("user.home");
+ System.setProperty("user.home", home.toString());
+ }
+
+ @AfterEach
+ public void restoreHome() {
+ System.setProperty("user.home", userHome);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("file:" + getScpPath() + "?recursive=true&delete=true")
+ .convertBodyTo(String.class)
+ .to("mock:result");
+ }
+ };
+ }
+
+ @Test
+ public void testMissingUserKnownHostsFileWithoutStrictHostKeyChecking()
throws Exception {
+ assumeTrue(this.isSetupComplete());
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+ String uri = getScpUri() + "?username=admin&password=admin";
+ template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME,
"hello.txt");
+
+ MockEndpoint.assertIsSatisfied(context);
+ }
+
+ @Test
+ public void testMissingUserKnownHostsFileWithStrictHostKeyChecking() {
+ assumeTrue(this.isSetupComplete());
+
+ String uri = getScpUri() +
"?username=admin&password=admin&strictHostKeyChecking=yes";
+ CamelExecutionException e = assertThrows(CamelExecutionException.class,
+ () -> template.sendBodyAndHeader(uri, "Hello World",
Exchange.FILE_NAME, "hello.txt"));
+ // the host key is rejected as the host is not known, so the producer
cannot connect
+ GenericFileOperationFailedException cause =
assertInstanceOf(GenericFileOperationFailedException.class, e.getCause());
+ assertTrue(cause.getMessage().startsWith("Failed to connect to"),
cause.getMessage());
+ }
+}
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 66a6c2da1269..0cb9a2fa143a 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
@@ -4358,6 +4358,27 @@ left a directory named after the part before it. A NUL
character failed the exch
OpenSSH server before 10.6, cut the name short there. Remove or replace these
characters in the `CamelFileName` header
or in the `fileName` option before the message reaches the producer.
+=== camel-jsch - a missing user known hosts file, keyboard-interactive login,
the JSch logger and ciphers
+
+The `scp` producer has these changes:
+
+* With the default `useUserKnownHostsFile=true` and no `knownHostsFile`, a
`.ssh/known_hosts` file that does not
+ exist in the home directory now means that no host is known, as with
`useUserKnownHostsFile=false`, and
+ `strictHostKeyChecking` decides whether the producer connects. Before, the
producer failed to connect with
+ "Cannot load known host file". A `knownHostsFile` that cannot be read still
fails the connection.
+* With the `password` option, the producer now also logs in with
`keyboard-interactive` authentication when the server
+ asks one question that is not echoed and contains `password:`, as a PAM
setup does. Before, it cancelled the
+ question, so a server that offers only `keyboard-interactive` for passwords
could not be used.
+* The JSch messages of the sessions of the `scp` component are logged with a
logger of each JSch instance. Before, the
+ component set the static JSch logger when it started, which applies to every
user of JSch in the JVM.
+* The `ciphers` option now applies to the session of the endpoint. Before, it
set the ciphers of JSch for the whole
+ JVM, so an `scp` endpoint with `ciphers` changed the ciphers of every later
JSch session, including the `sftp`
+ sessions of camel-ftp that do not set `ciphers`. Set `ciphers` on each
endpoint that needs them.
+* A `chmod` value that is not three octal digits is still replaced by 664, and
is now logged at WARN.
+* The `certUri` option is deprecated: use `certFile`, which loads the
certificate in the same way and takes
+ precedence. The `knownHostsFile`, `certFile`, `certUri`, `certBytes` and
`preferredAuthentications` options are no
+ longer flagged as secret, so their values are no longer masked.
+
=== camel-file - a done file with a fixed name is kept for the files a poll
left
A done file with a fixed name (such as `doneFileName=ready`) is no longer
deleted while a poll left files of its
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ScpComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ScpComponentBuilderFactory.java
index 923c657f9710..7c46a0a13658 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ScpComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ScpComponentBuilderFactory.java
@@ -77,43 +77,43 @@ public interface ScpComponentBuilderFactory {
/**
- * Whether to log the INFO messages of JSch at INFO level. JSch logs
- * much at INFO level, so by default the component logs these messages
- * at DEBUG level. The component passes the JSch log messages, with the
- * [JSCH] prefix, to its own logger.
+ * 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 type,
+ * which then gets configured on the component. This can be used for
+ * automatic configuring JDBC data sources, JMS connection factories,
+ * AWS Clients, etc.
*
* The option is a: <code>boolean</code> type.
*
- * Default: false
- * Group: producer
+ * Default: true
+ * Group: advanced
*
- * @param verboseLogging the value to set
+ * @param autowiredEnabled the value to set
* @return the dsl builder
*/
- default ScpComponentBuilder verboseLogging(boolean verboseLogging) {
- doSetProperty("verboseLogging", verboseLogging);
+ default ScpComponentBuilder autowiredEnabled(boolean autowiredEnabled)
{
+ doSetProperty("autowiredEnabled", autowiredEnabled);
return this;
}
/**
- * 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 type,
- * which then gets configured on the component. This can be used for
- * automatic configuring JDBC data sources, JMS connection factories,
- * AWS Clients, etc.
+ * Whether to log the INFO messages of JSch at INFO level. JSch logs
+ * much at INFO level, so by default the component logs these messages
+ * at DEBUG level. The component passes the JSch log messages, with the
+ * [JSCH] prefix, to its own logger.
*
* The option is a: <code>boolean</code> type.
*
- * Default: true
+ * Default: false
* Group: advanced
*
- * @param autowiredEnabled the value to set
+ * @param verboseLogging the value to set
* @return the dsl builder
*/
- default ScpComponentBuilder autowiredEnabled(boolean autowiredEnabled)
{
- doSetProperty("autowiredEnabled", autowiredEnabled);
+ default ScpComponentBuilder verboseLogging(boolean verboseLogging) {
+ doSetProperty("verboseLogging", verboseLogging);
return this;
}
@@ -170,8 +170,8 @@ public interface ScpComponentBuilderFactory {
Object value) {
switch (name) {
case "lazyStartProducer": ((ScpComponent)
component).setLazyStartProducer((boolean) value); return true;
- case "verboseLogging": ((ScpComponent)
component).setVerboseLogging((boolean) value); return true;
case "autowiredEnabled": ((ScpComponent)
component).setAutowiredEnabled((boolean) value); return true;
+ case "verboseLogging": ((ScpComponent)
component).setVerboseLogging((boolean) value); return true;
case "healthCheckConsumerEnabled": ((ScpComponent)
component).setHealthCheckConsumerEnabled((boolean) value); return true;
case "healthCheckProducerEnabled": ((ScpComponent)
component).setHealthCheckProducerEnabled((boolean) value); return true;
default: return false;
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ScpEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ScpEndpointBuilderFactory.java
index 0fc660083be3..47744e873e88 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ScpEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ScpEndpointBuilderFactory.java
@@ -44,25 +44,6 @@ public interface ScpEndpointBuilderFactory {
return (AdvancedScpEndpointBuilder) this;
}
- /**
- * The permissions of the file that the producer writes, as three octal
- * digits, for example 644. Any other value is replaced by 664. The
- * producer sends it in the scp protocol line of the file, and the
- * remote scp uses it when it creates the file. The directories that
the
- * producer creates for a file name with a path get 775.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Default: 664
- * Group: producer
- *
- * @param chmod the value to set
- * @return the dsl builder
- */
- default ScpEndpointBuilder chmod(String chmod) {
- doSetProperty("chmod", chmod);
- return this;
- }
/**
* Whether or not to disconnect from remote FTP server right after use.
* Disconnect will only disconnect the current connection to the FTP
@@ -115,6 +96,25 @@ public interface ScpEndpointBuilderFactory {
doSetProperty("checksumFileAlgorithm", checksumFileAlgorithm);
return this;
}
+ /**
+ * The permissions of the file that the producer writes, as three octal
+ * digits, for example 644. Any other value is replaced by 664. The
+ * producer sends it in the scp protocol line of the file, and the
+ * remote scp uses it when it creates the file. The directories that
the
+ * producer creates for a file name with a path get 775.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Default: 664
+ * Group: producer
+ *
+ * @param chmod the value to set
+ * @return the dsl builder
+ */
+ default ScpEndpointBuilder chmod(String chmod) {
+ doSetProperty("chmod", chmod);
+ return this;
+ }
/**
* Use Expression such as File Language to dynamically set the
filename.
* For consumers, it's used as a filename filter: only a file with
@@ -340,7 +340,8 @@ public interface ScpEndpointBuilderFactory {
* loaded the same way as certFile: a path on the file system, or with
* the classpath: prefix a resource on the classpath. Only used
together
* with privateKeyFile or privateKeyBytes, and when certFile is not
set.
- * Takes precedence over certBytes.
+ * Takes precedence over certBytes. Deprecation note: Use certFile,
+ * which loads the certificate in the same way and takes precedence.
*
* This option can also be loaded from an existing file, by prefixing
* with file: or classpath: followed by the location of the file.
@@ -352,6 +353,7 @@ public interface ScpEndpointBuilderFactory {
* @param certUri the value to set
* @return the dsl builder
*/
+ @Deprecated
default ScpEndpointBuilder certUri(String certUri) {
doSetProperty("certUri", certUri);
return this;
@@ -512,9 +514,9 @@ public interface ScpEndpointBuilderFactory {
* Whether to use the known hosts file of the user, the
.ssh/known_hosts
* file in the home directory (the user.home system property, or the
* HOME environment variable), when knownHostsFile is not set. If that
- * file cannot be read, the producer fails to connect. If false and
- * knownHostsFile is not set, no host is known, and
- * strictHostKeyChecking decides whether the producer connects.
+ * file does not exist, or if false and knownHostsFile is not set, no
+ * host is known, and strictHostKeyChecking decides whether the
producer
+ * connects.
*
* The option is a: <code>boolean</code> type.
*
@@ -532,9 +534,9 @@ public interface ScpEndpointBuilderFactory {
* Whether to use the known hosts file of the user, the
.ssh/known_hosts
* file in the home directory (the user.home system property, or the
* HOME environment variable), when knownHostsFile is not set. If that
- * file cannot be read, the producer fails to connect. If false and
- * knownHostsFile is not set, no host is known, and
- * strictHostKeyChecking decides whether the producer connects.
+ * file does not exist, or if false and knownHostsFile is not set, no
+ * host is known, and strictHostKeyChecking decides whether the
producer
+ * connects.
*
* The option will be converted to a <code>boolean</code> type.
*