This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-27735-tahu-ssl-fail-fast in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2d9333688e0321eccd916d0a51492aa9d6c5c8be Author: Claus Ibsen <[email protected]> AuthorDate: Fri Nov 27 20:17:02 2026 +0100 CAMEL-27735: camel-tahu - sslContextParameters fails the endpoint, as Tahu cannot apply it Tahu's MqttServerDefinition has no TLS settings and Tahu creates its MQTT clients itself, so sslContextParameters and useGlobalSslContextParameters never had an effect: an ssl:// server was checked with the default trust store of the JVM, and a configured trust store or client certificate was ignored without a message. tahu-edge and tahu-host endpoints now fail to start when sslContextParameters is set, on the endpoint or from the global one with useGlobalSslContextParameters=true, with a message that points to the javax.net.ssl.* system properties. Option descriptions, the doc page and the upgrade guide are updated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../apache/camel/catalog/components/tahu-edge.json | 6 +- .../apache/camel/catalog/components/tahu-host.json | 6 +- .../apache/camel/catalog/docs/tahu-summary.adoc | 10 ++- .../org/apache/camel/component/tahu/tahu-edge.json | 6 +- .../org/apache/camel/component/tahu/tahu-host.json | 6 +- .../camel-tahu/src/main/docs/tahu-summary.adoc | 10 ++- .../camel/component/tahu/TahuConfiguration.java | 5 +- .../camel/component/tahu/TahuDefaultComponent.java | 6 +- .../camel/component/tahu/TahuDefaultEndpoint.java | 13 +++ .../tahu/TahuSslContextParametersTest.java | 96 ++++++++++++++++++++++ .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 9 ++ .../dsl/TahuEdgeComponentBuilderFactory.java | 11 ++- .../dsl/TahuHostComponentBuilderFactory.java | 11 ++- .../dsl/TahuEdgeEndpointBuilderFactory.java | 10 ++- .../dsl/TahuHostEndpointBuilderFactory.java | 10 ++- 15 files changed, 187 insertions(+), 28 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-edge.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-edge.json index 8961e77a8ae2..c5a82e03fc9f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-edge.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-edge.json @@ -34,8 +34,8 @@ "autowiredEnabled": { "index": 6, "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 [...] "configuration": { "index": 7, "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.tahu.TahuConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The shared configuration of the endpoints. Each endpoint gets a copy of it, which the options of the endpoint then change." }, "password": { "index": 8, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, - "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable\/disable global SSL context parameters use" }, + "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients wit [...] + "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Not supported: when true and a global SSLContextParameters is configured, the endpoints fail to start, as Eclipse Tahu creates its MQTT clients without these TLS settin [...] "username": { "index": 11, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } }, "headers": { @@ -67,7 +67,7 @@ "lazyStartProducer": { "index": 14, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...] "useAliases": { "index": 15, "kind": "parameter", "displayName": "Use Aliases", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use metric aliases: Tahu gives each metric a generated alias in the birth messages, and the data messages carry the alias instead of the name. Used by an Edge Node endpoint only." }, "password": { "index": 16, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 17, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, + "sslContextParameters": { "index": 17, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients w [...] "username": { "index": 18, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-host.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-host.json index f6b938d31291..5d444d9e923e 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-host.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/tahu-host.json @@ -33,8 +33,8 @@ "autowiredEnabled": { "index": 6, "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 [...] "configuration": { "index": 7, "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.tahu.TahuConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The shared configuration of the endpoints. Each endpoint gets a copy of it, which the options of the endpoint then change." }, "password": { "index": 8, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, - "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable\/disable global SSL context parameters use" }, + "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients wit [...] + "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Not supported: when true and a global SSLContextParameters is configured, the endpoints fail to start, as Eclipse Tahu creates its MQTT clients without these TLS settin [...] "username": { "index": 11, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } }, "headers": { @@ -58,7 +58,7 @@ "exceptionHandler": { "index": 7, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] "exchangePattern": { "index": 8, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "password": { "index": 9, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 10, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, + "sslContextParameters": { "index": 10, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients w [...] "username": { "index": 11, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/tahu-summary.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/tahu-summary.adoc index 65c2d9174e26..6f81798320b8 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/tahu-summary.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/tahu-summary.adoc @@ -129,9 +129,13 @@ check to ensure proper Client ID lengths. This is a configuration-time check and is not required to connect to MQTT v3.1 Servers. MQTT Server authentication can be configured using the `username` and `password` -properties. TLS configuration can also be configured by providing an -`SSLContextParameters` instance or through the `useGlobalSslContextParameters` -flag. +properties. An `ssl://` server in the `servers` list is checked with the default +trust store of the JVM, which the `javax.net.ssl.*` system properties configure +(for example `javax.net.ssl.trustStore`, and `javax.net.ssl.keyStore` for a client +certificate). The `sslContextParameters` and `useGlobalSslContextParameters` options +are not supported: Eclipse Tahu creates its MQTT clients without these TLS settings, +so an endpoint with `sslContextParameters`, or with `useGlobalSslContextParameters=true` +and a global `SSLContextParameters`, fails to start. An MQTT connection keep alive timeout can be configured using `keepAliveTimeout`. diff --git a/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-edge.json b/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-edge.json index 8961e77a8ae2..c5a82e03fc9f 100644 --- a/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-edge.json +++ b/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-edge.json @@ -34,8 +34,8 @@ "autowiredEnabled": { "index": 6, "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 [...] "configuration": { "index": 7, "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.tahu.TahuConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The shared configuration of the endpoints. Each endpoint gets a copy of it, which the options of the endpoint then change." }, "password": { "index": 8, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, - "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable\/disable global SSL context parameters use" }, + "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients wit [...] + "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Not supported: when true and a global SSLContextParameters is configured, the endpoints fail to start, as Eclipse Tahu creates its MQTT clients without these TLS settin [...] "username": { "index": 11, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } }, "headers": { @@ -67,7 +67,7 @@ "lazyStartProducer": { "index": 14, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...] "useAliases": { "index": 15, "kind": "parameter", "displayName": "Use Aliases", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use metric aliases: Tahu gives each metric a generated alias in the birth messages, and the data messages carry the alias instead of the name. Used by an Edge Node endpoint only." }, "password": { "index": 16, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 17, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, + "sslContextParameters": { "index": 17, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients w [...] "username": { "index": 18, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } } } diff --git a/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-host.json b/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-host.json index f6b938d31291..5d444d9e923e 100644 --- a/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-host.json +++ b/components/camel-tahu/src/generated/resources/META-INF/org/apache/camel/component/tahu/tahu-host.json @@ -33,8 +33,8 @@ "autowiredEnabled": { "index": 6, "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 [...] "configuration": { "index": 7, "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.tahu.TahuConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The shared configuration of the endpoints. Each endpoint gets a copy of it, which the options of the endpoint then change." }, "password": { "index": 8, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, - "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable\/disable global SSL context parameters use" }, + "sslContextParameters": { "index": 9, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients wit [...] + "useGlobalSslContextParameters": { "index": 10, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Not supported: when true and a global SSLContextParameters is configured, the endpoints fail to start, as Eclipse Tahu creates its MQTT clients without these TLS settin [...] "username": { "index": 11, "kind": "property", "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } }, "headers": { @@ -58,7 +58,7 @@ "exceptionHandler": { "index": 7, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] "exchangePattern": { "index": 8, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "password": { "index": 9, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Password for MQTT server authentication" }, - "sslContextParameters": { "index": 10, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "SSL configuration for MQTT server connections" }, + "sslContextParameters": { "index": 10, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Not supported: Eclipse Tahu creates its MQTT clients w [...] "username": { "index": 11, "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.tahu.TahuConfiguration", "configurationField": "configuration", "description": "Username for MQTT server authentication" } } } diff --git a/components/camel-tahu/src/main/docs/tahu-summary.adoc b/components/camel-tahu/src/main/docs/tahu-summary.adoc index 65c2d9174e26..6f81798320b8 100644 --- a/components/camel-tahu/src/main/docs/tahu-summary.adoc +++ b/components/camel-tahu/src/main/docs/tahu-summary.adoc @@ -129,9 +129,13 @@ check to ensure proper Client ID lengths. This is a configuration-time check and is not required to connect to MQTT v3.1 Servers. MQTT Server authentication can be configured using the `username` and `password` -properties. TLS configuration can also be configured by providing an -`SSLContextParameters` instance or through the `useGlobalSslContextParameters` -flag. +properties. An `ssl://` server in the `servers` list is checked with the default +trust store of the JVM, which the `javax.net.ssl.*` system properties configure +(for example `javax.net.ssl.trustStore`, and `javax.net.ssl.keyStore` for a client +certificate). The `sslContextParameters` and `useGlobalSslContextParameters` options +are not supported: Eclipse Tahu creates its MQTT clients without these TLS settings, +so an endpoint with `sslContextParameters`, or with `useGlobalSslContextParameters=true` +and a global `SSLContextParameters`, fails to start. An MQTT connection keep alive timeout can be configured using `keepAliveTimeout`. diff --git a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuConfiguration.java b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuConfiguration.java index f5203f59379b..26ae7365d42a 100644 --- a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuConfiguration.java +++ b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuConfiguration.java @@ -76,7 +76,10 @@ public class TahuConfiguration implements Cloneable { @Metadata(applicableFor = { TahuConstants.EDGE_NODE_SCHEME, TahuConstants.HOST_APP_SCHEME }) private int keepAliveTimeout = 30; - @UriParam(label = "security") + @UriParam(label = "security", + description = "Not supported: Eclipse Tahu creates its MQTT clients without these TLS settings, so the endpoint" + + " fails to start when this option is set. An ssl:// server is checked with the default trust store" + + " of the JVM, which the javax.net.ssl.* system properties configure.") @Metadata(applicableFor = { TahuConstants.EDGE_NODE_SCHEME, TahuConstants.HOST_APP_SCHEME }) private SSLContextParameters sslContextParameters; diff --git a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java index 4ebdf759a2b4..d736e5b4b69a 100644 --- a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java +++ b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java @@ -38,7 +38,11 @@ public abstract class TahuDefaultComponent extends DefaultComponent implements S + " of the endpoint then change.") TahuConfiguration configuration; - @Metadata(label = "security", defaultValue = "false") + @Metadata(label = "security", defaultValue = "false", + description = "Not supported: when true and a global SSLContextParameters is configured, the endpoints fail to" + + " start, as Eclipse Tahu creates its MQTT clients without these TLS settings. An ssl:// server is" + + " checked with the default trust store of the JVM, which the javax.net.ssl.* system properties" + + " configure.") boolean useGlobalSslContextParameters; protected TahuDefaultComponent() { diff --git a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultEndpoint.java b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultEndpoint.java index c001a6ca2563..62ad037f13c2 100644 --- a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultEndpoint.java +++ b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultEndpoint.java @@ -34,4 +34,17 @@ public abstract class TahuDefaultEndpoint extends DefaultEndpoint { return configuration; } + @Override + protected void doStart() throws Exception { + super.doStart(); + + if (configuration.getSslContextParameters() != null) { + throw new IllegalArgumentException( + "The sslContextParameters option, or the global SSLContextParameters with useGlobalSslContextParameters=true," + + " cannot be applied: Eclipse Tahu creates its MQTT clients without these TLS settings." + + " Remove the option. An ssl:// server is checked with the default trust store of the JVM," + + " which the javax.net.ssl.* system properties configure."); + } + } + } diff --git a/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuSslContextParametersTest.java b/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuSslContextParametersTest.java new file mode 100644 index 000000000000..15085d939d03 --- /dev/null +++ b/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuSslContextParametersTest.java @@ -0,0 +1,96 @@ +/* + * 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.tahu; + +import java.util.UUID; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.support.jsse.SSLContextParameters; +import org.apache.camel.test.junit6.CamelTestSupport; +import org.apache.camel.util.ObjectHelper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Eclipse Tahu creates its MQTT clients without TLS settings, so sslContextParameters fails the endpoint at start. + */ +public class TahuSslContextParametersTest extends CamelTestSupport { + + @Test + public void edgeEndpointWithSslContextParametersFailsToStart() { + context.getRegistry().bind("ssl", new SSLContextParameters()); + + assertRouteFailsToStart(TahuConstants.EDGE_NODE_SCHEME + "://Ssl/EdgeNode?sslContextParameters=#ssl"); + } + + @Test + public void hostEndpointWithSslContextParametersFailsToStart() { + context.getRegistry().bind("ssl", new SSLContextParameters()); + + assertRouteFailsToStart(TahuConstants.HOST_APP_SCHEME + ":SslHost?sslContextParameters=#ssl"); + } + + @Test + public void globalSslContextParametersFailsToStart() { + context.setSSLContextParameters(new SSLContextParameters()); + context.getComponent(TahuConstants.EDGE_NODE_SCHEME, TahuDefaultComponent.class) + .setUseGlobalSslContextParameters(true); + context.getComponent(TahuConstants.HOST_APP_SCHEME, TahuDefaultComponent.class) + .setUseGlobalSslContextParameters(true); + + assertRouteFailsToStart(TahuConstants.EDGE_NODE_SCHEME + "://GlobalSsl/EdgeNode"); + assertRouteFailsToStart(TahuConstants.HOST_APP_SCHEME + ":GlobalSslHost"); + } + + @Test + public void globalSslContextParametersNotUsedByDefault() { + context.setSSLContextParameters(new SSLContextParameters()); + + assertStarts(context.getEndpoint( + TahuConstants.EDGE_NODE_SCHEME + "://NoGlobalSsl/EdgeNode", TahuDefaultEndpoint.class)); + assertStarts(context.getEndpoint( + TahuConstants.HOST_APP_SCHEME + ":NoGlobalSslHost", TahuDefaultEndpoint.class)); + } + + @Test + public void endpointsWithoutSslContextParametersStart() { + assertStarts(context.getEndpoint( + TahuConstants.EDGE_NODE_SCHEME + "://NoSsl/EdgeNode", TahuDefaultEndpoint.class)); + assertStarts(context.getEndpoint( + TahuConstants.HOST_APP_SCHEME + ":NoSslHost", TahuDefaultEndpoint.class)); + } + + private void assertRouteFailsToStart(String uri) { + Exception e = assertThrows(Exception.class, () -> context.addRoutes(new RouteBuilder() { + @Override + public void configure() { + from("direct:" + UUID.randomUUID()).to(uri); + } + })); + IllegalArgumentException cause = ObjectHelper.getException(IllegalArgumentException.class, e); + assertNotNull(cause, "IllegalArgumentException expected as cause of " + e); + assertTrue(cause.getMessage().contains("cannot be applied"), cause.getMessage()); + assertTrue(cause.getMessage().contains("javax.net.ssl"), cause.getMessage()); + } + + private static void assertStarts(TahuDefaultEndpoint endpoint) { + assertTrue(endpoint.isStarted()); + } +} 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 6dbf47081dab..139431269e6b 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 @@ -12474,6 +12474,15 @@ The `CamelWeatherQuery` header that the consumer and the producer set has the va masked as `xxxxxx`, and so do the log and the error messages that show the request URL. The request to OpenWeatherMap still sends the real `appid`. A route that read the API key from this header must use the `appid` option instead. +=== camel-tahu - sslContextParameters fails the endpoint + +The `sslContextParameters` option of `tahu-edge` and `tahu-host`, and `useGlobalSslContextParameters` of their +components, never had an effect: Eclipse Tahu creates its MQTT clients without these TLS settings, so an `ssl://` +server was checked with the default trust store of the JVM, and a configured trust store or client certificate was +ignored without a message. An endpoint with `sslContextParameters`, or with `useGlobalSslContextParameters=true` and a +global `SSLContextParameters`, now fails to start. Remove the option, and configure the trust store (and the key store +for a client certificate) with the `javax.net.ssl.*` system properties of the JVM. + === Kamelets - removed Kamelets The Kamelet catalog (camel-kamelets 4.24) removes Kamelets that could not work on Camel 4.23 or 4.24: diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuEdgeComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuEdgeComponentBuilderFactory.java index fb41d9173e27..62b567d46724 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuEdgeComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuEdgeComponentBuilderFactory.java @@ -222,7 +222,10 @@ public interface TahuEdgeComponentBuilderFactory { } /** - * SSL configuration for MQTT server connections. + * Not supported: Eclipse Tahu creates its MQTT clients without these + * TLS settings, so the endpoint fails to start when this option is set. + * An ssl:// server is checked with the default trust store of the JVM, + * which the javax.net.ssl.* system properties configure. * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. @@ -239,7 +242,11 @@ public interface TahuEdgeComponentBuilderFactory { /** - * Enable/disable global SSL context parameters use. + * Not supported: when true and a global SSLContextParameters is + * configured, the endpoints fail to start, as Eclipse Tahu creates its + * MQTT clients without these TLS settings. An ssl:// server is checked + * with the default trust store of the JVM, which the javax.net.ssl.* + * system properties configure. * * The option is a: <code>boolean</code> type. * diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuHostComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuHostComponentBuilderFactory.java index 565df604ff4b..ca6955991a04 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuHostComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/TahuHostComponentBuilderFactory.java @@ -225,7 +225,10 @@ public interface TahuHostComponentBuilderFactory { } /** - * SSL configuration for MQTT server connections. + * Not supported: Eclipse Tahu creates its MQTT clients without these + * TLS settings, so the endpoint fails to start when this option is set. + * An ssl:// server is checked with the default trust store of the JVM, + * which the javax.net.ssl.* system properties configure. * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. @@ -242,7 +245,11 @@ public interface TahuHostComponentBuilderFactory { /** - * Enable/disable global SSL context parameters use. + * Not supported: when true and a global SSLContextParameters is + * configured, the endpoints fail to start, as Eclipse Tahu creates its + * MQTT clients without these TLS settings. An ssl:// server is checked + * with the default trust store of the JVM, which the javax.net.ssl.* + * system properties configure. * * The option is a: <code>boolean</code> type. * diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuEdgeEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuEdgeEndpointBuilderFactory.java index 4d5fd3e99f99..60870e56f93e 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuEdgeEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuEdgeEndpointBuilderFactory.java @@ -267,7 +267,10 @@ public interface TahuEdgeEndpointBuilderFactory { return this; } /** - * SSL configuration for MQTT server connections. + * Not supported: Eclipse Tahu creates its MQTT clients without these + * TLS settings, so the endpoint fails to start when this option is set. + * An ssl:// server is checked with the default trust store of the JVM, + * which the javax.net.ssl.* system properties configure. * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. @@ -282,7 +285,10 @@ public interface TahuEdgeEndpointBuilderFactory { return this; } /** - * SSL configuration for MQTT server connections. + * Not supported: Eclipse Tahu creates its MQTT clients without these + * TLS settings, so the endpoint fails to start when this option is set. + * An ssl:// server is checked with the default trust store of the JVM, + * which the javax.net.ssl.* system properties configure. * * The option will be converted to a * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuHostEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuHostEndpointBuilderFactory.java index 8dfd87b0126b..56ed6e42298e 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuHostEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/TahuHostEndpointBuilderFactory.java @@ -192,7 +192,10 @@ public interface TahuHostEndpointBuilderFactory { return this; } /** - * SSL configuration for MQTT server connections. + * Not supported: Eclipse Tahu creates its MQTT clients without these + * TLS settings, so the endpoint fails to start when this option is set. + * An ssl:// server is checked with the default trust store of the JVM, + * which the javax.net.ssl.* system properties configure. * * The option is a: * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. @@ -207,7 +210,10 @@ public interface TahuHostEndpointBuilderFactory { return this; } /** - * SSL configuration for MQTT server connections. + * Not supported: Eclipse Tahu creates its MQTT clients without these + * TLS settings, so the endpoint fails to start when this option is set. + * An ssl:// server is checked with the default trust store of the JVM, + * which the javax.net.ssl.* system properties configure. * * The option will be converted to a * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type.
