This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-28009-server-tls-warn in repository https://gitbox.apache.org/repos/asf/camel.git
commit 45fadb1024e2ac858ca758913158a0b624b9160f Author: Claus Ibsen <[email protected]> AuthorDate: Tue Dec 1 22:46:11 2026 +0100 CAMEL-28009: camel-platform-http-vertx - log a WARN when useGlobalSslContextParameters is enabled without a global SSL configuration The server started without TLS and nothing said so. It now logs a WARN with the port. This covers the platform-http-vertx server and the Camel Main HTTP and management servers, which use the same SSL setup. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .../http/vertx/VertxPlatformHttpServerSupport.java | 14 +++++ .../VertxPlatformHttpServerGlobalSslTest.java | 66 ++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerSupport.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerSupport.java index ab5224550110..a113514fca76 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerSupport.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerSupport.java @@ -183,8 +183,22 @@ public final class VertxPlatformHttpServerSupport { if (sslParameters != null) { VertxHelper.setupSSLOptions(camelContext, sslParameters, options); + } else if (isGlobalSslMissing(configuration, camelContext)) { + LOG.warn("useGlobalSslContextParameters is enabled, but there is no global SSL configuration (such as" + + " camel.ssl.enabled=true with a key store): the HTTP server on port {} does not use TLS.", + configuration.getBindPort()); } return options; } + + /** + * Whether TLS is asked for with useGlobalSslContextParameters, but the CamelContext has no global SSL configuration + * and the server has none of its own, so the server does not use TLS. + */ + static boolean isGlobalSslMissing(VertxPlatformHttpServerConfiguration configuration, CamelContext camelContext) { + return configuration.isUseGlobalSslContextParameters() + && configuration.getSslContextParameters() == null + && camelContext.getSSLContextParameters() == null; + } } diff --git a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerGlobalSslTest.java b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerGlobalSslTest.java new file mode 100644 index 000000000000..1cdd009be6f9 --- /dev/null +++ b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpServerGlobalSslTest.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.platform.http.vertx; + +import io.vertx.core.http.HttpServerOptions; +import org.apache.camel.CamelContext; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.support.jsse.SSLContextParameters; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * useGlobalSslContextParameters without a global SSL configuration leaves the server without TLS, which is told with a + * WARN. + */ +public class VertxPlatformHttpServerGlobalSslTest { + + @Test + public void testGlobalSslAskedForButMissing() throws Exception { + try (CamelContext context = new DefaultCamelContext()) { + VertxPlatformHttpServerConfiguration configuration = new VertxPlatformHttpServerConfiguration(); + configuration.setUseGlobalSslContextParameters(true); + + assertTrue(VertxPlatformHttpServerSupport.isGlobalSslMissing(configuration, context)); + HttpServerOptions options + = VertxPlatformHttpServerSupport.configureSSL(new HttpServerOptions(), configuration, context); + assertFalse(options.isSsl()); + } + } + + @Test + public void testGlobalSslConfigured() throws Exception { + try (CamelContext context = new DefaultCamelContext()) { + context.setSSLContextParameters(new SSLContextParameters()); + VertxPlatformHttpServerConfiguration configuration = new VertxPlatformHttpServerConfiguration(); + configuration.setUseGlobalSslContextParameters(true); + + assertFalse(VertxPlatformHttpServerSupport.isGlobalSslMissing(configuration, context)); + } + } + + @Test + public void testGlobalSslNotAskedFor() throws Exception { + try (CamelContext context = new DefaultCamelContext()) { + VertxPlatformHttpServerConfiguration configuration = new VertxPlatformHttpServerConfiguration(); + + assertFalse(VertxPlatformHttpServerSupport.isGlobalSslMissing(configuration, context)); + } + } +}
