diff --git a/integration-test-groups/http/README.adoc b/integration-test-groups/http/README.adoc deleted file mode 100644 index c1154c278e2c..000000000000 --- a/integration-test-groups/http/README.adoc +++ /dev/null @@ -1,7 +0,0 @@ -== Certificate for HTTPS - -Server keystore has to contain server certificate. - -=== How to generate new keystore and truststore - -Delete folder `common/src/main/resources/jsse` and run the script `common/generate-certs.sh` to generate new keystore and truststore. diff --git a/integration-test-groups/http/common/generate-certs.sh b/integration-test-groups/http/common/generate-certs.sh deleted file mode 100755 index c14febd7cf8c..000000000000 --- a/integration-test-groups/http/common/generate-certs.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# -# 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. -# - -set -e -set -x - -invocationDir="$(pwd)" -workDir="target/openssl-work" -destinationDir="src/main/resources/jsse" -keySize=2048 -days=10000 -extFile="$(pwd)/v3.ext" -encryptionAlgo="aes-256-cbc" - -if [[ -n "${JAVA_HOME}" ]] ; then - keytool="$JAVA_HOME/bin/keytool" -elif ! [[ -x "$(command -v keytool)" ]] ; then - echo 'Error: Either add keytool to PATH or set JAVA_HOME' >&2 - exit 1 -else - keytool="keytool" -fi - -if ! [[ -x "$(command -v openssl)" ]] ; then - echo 'Error: openssl is not installed.' >&2 - exit 1 -fi - -mkdir -p "$workDir" -mkdir -p "$destinationDir" - -# Certificate authority -openssl genrsa -out "$workDir/ca.key" $keySize -openssl req -x509 -new -subj '/O=apache.org/OU=eng (NOT FOR PRODUCTION)/CN=ca' -key "$workDir/ca.key" -nodes -out "$workDir/ca.pem" -days $days -extensions v3_req -openssl req -new -subj '/O=apache.org/OU=eng (NOT FOR PRODUCTION)/CN=ca' -x509 -key "$workDir/ca.key" -days $days -out "$workDir/ca.crt" - -for actor in localhost; do - # Generate keys - openssl genrsa -out "$workDir/$actor.key" $keySize - - # Generate certificates - openssl req -new -subj "/O=apache.org/OU=eng (NOT FOR PRODUCTION)/CN=$actor" -key "$workDir/$actor.key" -out "$workDir/$actor.csr" - openssl x509 -req -in "$workDir/$actor.csr" -extfile "$extFile" -CA "$workDir/ca.pem" -CAkey "$workDir/ca.key" -CAcreateserial -days $days -out "$workDir/$actor.crt" - - # Export keystores - openssl pkcs12 -export -in "$workDir/$actor.crt" -inkey "$workDir/$actor.key" -certfile "$workDir/ca.crt" -name "$actor" -out "$destinationDir/$actor-keystore.pkcs12" -passout pass:"${actor}-keystore-password" -keypbe "$encryptionAlgo" -certpbe "$encryptionAlgo" -done - - -# Truststore -"$keytool" -import -file "$workDir/localhost.crt" -alias localhost -noprompt -keystore "$destinationDir/client-truststore.pkcs12" -storepass "client-truststore-password" -"$keytool" -import -file "$workDir/ca.crt" -alias ca -noprompt -keystore "$destinationDir/client-truststore.pkcs12" -storepass "client-truststore-password" diff --git a/integration-test-groups/http/common/src/main/java/org/apache/camel/quarkus/component/http/common/CommonProducers.java b/integration-test-groups/http/common/src/main/java/org/apache/camel/quarkus/component/http/common/CommonProducers.java index 5d172a23dea4..479a8c911a56 100644 --- a/integration-test-groups/http/common/src/main/java/org/apache/camel/quarkus/component/http/common/CommonProducers.java +++ b/integration-test-groups/http/common/src/main/java/org/apache/camel/quarkus/component/http/common/CommonProducers.java @@ -27,12 +27,12 @@ public class CommonProducers { @Named public SSLContextParameters sslContextParameters() { KeyStoreParameters keystoreParameters = new KeyStoreParameters(); - keystoreParameters.setResource("/jsse/localhost-keystore.pkcs12"); + keystoreParameters.setResource("/certs/localhost-keystore.p12"); keystoreParameters.setPassword("localhost-keystore-password"); KeyStoreParameters truststoreParameters = new KeyStoreParameters(); - truststoreParameters.setResource("/jsse/client-truststore.pkcs12"); - truststoreParameters.setPassword("client-truststore-password"); + truststoreParameters.setResource("/certs/localhost-truststore.p12"); + truststoreParameters.setPassword("localhost-keystore-password"); TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); trustManagersParameters.setKeyStore(truststoreParameters); diff --git a/integration-test-groups/http/common/src/main/resources/application.properties b/integration-test-groups/http/common/src/main/resources/application.properties index 05e3b20242a5..e99d3e9f9666 100644 --- a/integration-test-groups/http/common/src/main/resources/application.properties +++ b/integration-test-groups/http/common/src/main/resources/application.properties @@ -18,7 +18,7 @@ # # Quarkus # -quarkus.native.resources.includes = jsse/*,restcountries/* +quarkus.native.resources.includes = certs/*,restcountries/* quarkus.native.add-all-charsets = true quarkus.camel.native.reflection.serialization-enabled = true @@ -31,7 +31,7 @@ quarkus.security.users.embedded.roles.admin=admin quarkus.security.users.embedded.roles.noadmin=user quarkus.http.insecure-requests=enabled -quarkus.http.ssl.certificate.key-store-file=jsse/localhost-keystore.pkcs12 +quarkus.http.ssl.certificate.key-store-file=certs/localhost-keystore.p12 quarkus.http.ssl.certificate.key-store-password=localhost-keystore-password quarkus.resteasy.gzip.enabled=true diff --git a/integration-test-groups/http/common/src/main/resources/jsse/client-truststore.pkcs12 b/integration-test-groups/http/common/src/main/resources/jsse/client-truststore.pkcs12 deleted file mode 100644 index f5b3fee8d4b0..000000000000 Binary files a/integration-test-groups/http/common/src/main/resources/jsse/client-truststore.pkcs12 and /dev/null differ diff --git a/integration-test-groups/http/common/src/main/resources/jsse/localhost-keystore.pkcs12 b/integration-test-groups/http/common/src/main/resources/jsse/localhost-keystore.pkcs12 deleted file mode 100644 index ae9c58834584..000000000000 Binary files a/integration-test-groups/http/common/src/main/resources/jsse/localhost-keystore.pkcs12 and /dev/null differ diff --git a/integration-test-groups/http/common/src/test/java/org/apache/camel/quarkus/component/http/common/HttpTestResource.java b/integration-test-groups/http/common/src/test/java/org/apache/camel/quarkus/component/http/common/HttpTestResource.java index 270e4dfdff3f..83d36b63a17e 100644 --- a/integration-test-groups/http/common/src/test/java/org/apache/camel/quarkus/component/http/common/HttpTestResource.java +++ b/integration-test-groups/http/common/src/test/java/org/apache/camel/quarkus/component/http/common/HttpTestResource.java @@ -41,6 +41,10 @@ public class HttpTestResource implements QuarkusTestResourceLifecycleManager { private static final Logger LOG = Logger.getLogger(HttpTestResource.class); + + public static final String KEYSTORE_NAME = "localhost"; + public static final String KEYSTORE_PASSWORD = "localhost-keystore-password"; + private ProxyServer server; @Override diff --git a/integration-test-groups/http/common/v3.ext b/integration-test-groups/http/common/v3.ext deleted file mode 100644 index 632d6d3a6f06..000000000000 --- a/integration-test-groups/http/common/v3.ext +++ /dev/null @@ -1,3 +0,0 @@ -authorityKeyIdentifier = keyid, issuer -basicConstraints = CA:FALSE -keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment \ No newline at end of file diff --git a/integration-test-groups/http/http/pom.xml b/integration-test-groups/http/http/pom.xml index e4f01262f5f1..a347302d5d9b 100644 --- a/integration-test-groups/http/http/pom.xml +++ b/integration-test-groups/http/http/pom.xml @@ -78,6 +78,11 @@ test-jar test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-test-groups/http/http/src/test/java/org/apache/camel/quarkus/component/http/http/it/HttpTest.java b/integration-test-groups/http/http/src/test/java/org/apache/camel/quarkus/component/http/http/it/HttpTest.java index e7aa79d11f60..1f523639b9b0 100644 --- a/integration-test-groups/http/http/src/test/java/org/apache/camel/quarkus/component/http/http/it/HttpTest.java +++ b/integration-test-groups/http/http/src/test/java/org/apache/camel/quarkus/component/http/http/it/HttpTest.java @@ -20,14 +20,20 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; import org.apache.camel.quarkus.component.http.common.AbstractHttpTest; import org.apache.camel.quarkus.component.http.common.HttpTestResource; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; +@TestCertificates(certificates = { + @Certificate(name = HttpTestResource.KEYSTORE_NAME, formats = { + Format.PKCS12 }, password = HttpTestResource.KEYSTORE_PASSWORD) }) @QuarkusTest @QuarkusTestResource(HttpTestResource.class) public class HttpTest extends AbstractHttpTest { diff --git a/integration-test-groups/http/netty-http/pom.xml b/integration-test-groups/http/netty-http/pom.xml index 27e61c19f036..b32bcc151d7e 100644 --- a/integration-test-groups/http/netty-http/pom.xml +++ b/integration-test-groups/http/netty-http/pom.xml @@ -81,6 +81,11 @@ test-jar test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-test-groups/http/netty-http/src/test/java/org/apache/camel/quarkus/component/http/netty/it/NettyHttpJaasTest.java b/integration-test-groups/http/netty-http/src/test/java/org/apache/camel/quarkus/component/http/netty/it/NettyHttpJaasTest.java index e973865eda9c..9da670f0d9ec 100644 --- a/integration-test-groups/http/netty-http/src/test/java/org/apache/camel/quarkus/component/http/netty/it/NettyHttpJaasTest.java +++ b/integration-test-groups/http/netty-http/src/test/java/org/apache/camel/quarkus/component/http/netty/it/NettyHttpJaasTest.java @@ -19,10 +19,17 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.component.http.common.HttpTestResource; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.eclipse.microprofile.config.ConfigProvider; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +@TestCertificates(certificates = { + @Certificate(name = HttpTestResource.KEYSTORE_NAME, formats = { + Format.PKCS12 }, password = HttpTestResource.KEYSTORE_PASSWORD) }) @QuarkusTest @QuarkusTestResource(NettyHttpJaasTestResource.class) public class NettyHttpJaasTest { diff --git a/integration-test-groups/http/vertx-http/pom.xml b/integration-test-groups/http/vertx-http/pom.xml index a4f176294a53..ac788a2d9101 100644 --- a/integration-test-groups/http/vertx-http/pom.xml +++ b/integration-test-groups/http/vertx-http/pom.xml @@ -69,6 +69,11 @@ test test-jar + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-test-groups/http/vertx-http/src/test/java/org/apache/camel/quarkus/component/http/vertx/it/VertxHttpTest.java b/integration-test-groups/http/vertx-http/src/test/java/org/apache/camel/quarkus/component/http/vertx/it/VertxHttpTest.java index 18a6c4368712..e840c7960f5a 100644 --- a/integration-test-groups/http/vertx-http/src/test/java/org/apache/camel/quarkus/component/http/vertx/it/VertxHttpTest.java +++ b/integration-test-groups/http/vertx-http/src/test/java/org/apache/camel/quarkus/component/http/vertx/it/VertxHttpTest.java @@ -19,13 +19,19 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; import org.apache.camel.quarkus.component.http.common.AbstractHttpTest; import org.apache.camel.quarkus.component.http.common.HttpTestResource; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertArrayEquals; +@TestCertificates(certificates = { + @Certificate(name = HttpTestResource.KEYSTORE_NAME, formats = { + Format.PKCS12 }, password = HttpTestResource.KEYSTORE_PASSWORD) }) @QuarkusTest @QuarkusTestResource(HttpTestResource.class) public class VertxHttpTest extends AbstractHttpTest { diff --git a/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/CertificatesUtil.java b/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/CertificatesUtil.java new file mode 100644 index 000000000000..0c0bd03e9bf1 --- /dev/null +++ b/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/CertificatesUtil.java @@ -0,0 +1,28 @@ +/* + * 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.quarkus.test.support.certificate; + +public class CertificatesUtil { + public static final String DEFAULT_CERTS_BASEDIR = "target/classes/certs"; + + private CertificatesUtil() { + } + + public static String keystoreFile(String name, String extension) { + return DEFAULT_CERTS_BASEDIR + "/" + name + "-keystore." + extension; + } +} diff --git a/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificateGenerationExtension.java b/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificateGenerationExtension.java index c695fdcaabb9..d11ad362e3ba 100644 --- a/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificateGenerationExtension.java +++ b/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificateGenerationExtension.java @@ -43,7 +43,7 @@ * based on docker host (required for usage with external docker host) * Therefore I created a new annotation 'TestCertificates' which would use this new extension. */ -public class TestCertificateGenerationExtension implements BeforeAllCallback, ParameterResolver { +public class TestCertificateGenerationExtension implements BeforeAllCallback { private static final Logger LOGGER = Logger.getLogger(TestCertificateGenerationExtension.class); public static TestCertificateGenerationExtension getInstance(ExtensionContext extensionContext) { @@ -65,8 +65,12 @@ public void beforeAll(ExtensionContext extensionContext) throws Exception { var annotation = maybe.get(); //cn and alternativeSubjectName might be different (to reflect docker host) - Optional cn = resolveDockerHost(); - Optional altSubName = cn.stream().map(h -> "IP:%s".formatted(h)).findAny(); + Optional cn = Optional.empty(); + Optional altSubName = Optional.empty(); + if (annotation.docker()) { + cn = resolveDockerHost(); + altSubName = cn.stream().map(h -> "IP:%s".formatted(h)).findAny(); + } for (Certificate certificate : annotation.certificates()) { String baseDir = annotation.baseDir(); @@ -113,15 +117,4 @@ private Optional resolveDockerHost() { return Optional.empty(); } - @Override - public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - throw new IllegalArgumentException("Not supported!"); - } - - @Override - public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - throw new IllegalArgumentException("Not supported!"); - } } diff --git a/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificates.java b/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificates.java index 0d686dbc5826..4c9a9ee4f8ed 100644 --- a/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificates.java +++ b/integration-tests-support/certificate-generator/src/main/java/org/apache/camel/quarkus/test/support/certificate/TestCertificates.java @@ -39,8 +39,9 @@ /** * The base directory in which certificates will be generated. + * Default value is `target/classes/certs` */ - String baseDir(); + String baseDir() default CertificatesUtil.DEFAULT_CERTS_BASEDIR; /** * The certificates to generate. @@ -52,4 +53,10 @@ * Whether to replace the certificates if they already exist. */ boolean replaceIfExists() default false; + + /** + * Whether certificate is used in docker container. If so, the cn and subject alt name has to equal docker host + * (which might differ in case of external docker host) + */ + boolean docker() default false; } diff --git a/integration-tests/ftp/pom.xml b/integration-tests/ftp/pom.xml index 0ef4614d7e9c..103d0ab7ff5e 100644 --- a/integration-tests/ftp/pom.xml +++ b/integration-tests/ftp/pom.xml @@ -85,6 +85,11 @@ sshd-scp test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftp/it/FtpTestResource.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftp/it/FtpTestResource.java index e2713b8a1ad8..f97fa3d65a5c 100644 --- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftp/it/FtpTestResource.java +++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftp/it/FtpTestResource.java @@ -90,15 +90,18 @@ public Map start() { ListenerFactory factory = createListenerFactory(port); - FtpServerFactory serverFactory = new FtpServerFactory(); - serverFactory.setUserManager(userMgr); - serverFactory.setFileSystem(fsf); - serverFactory.setConnectionConfig(new ConnectionConfigFactory().createConnectionConfig()); - serverFactory.addListener("default", factory.createListener()); - - FtpServerFactory ftpServerFactory = serverFactory; - ftpServer = ftpServerFactory.createServer(); - ftpServer.start(); + if (factory != null) { + FtpServerFactory serverFactory = new FtpServerFactory(); + serverFactory.setUserManager(userMgr); + serverFactory.setFileSystem(fsf); + serverFactory.setConnectionConfig(new ConnectionConfigFactory().createConnectionConfig()); + + serverFactory.addListener("default", factory.createListener()); + + FtpServerFactory ftpServerFactory = serverFactory; + ftpServer = ftpServerFactory.createServer(); + ftpServer.start(); + } return CollectionHelper.mapOf( "camel." + componentName + ".test-port", Integer.toString(port), diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTest.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTest.java index 4157893a579b..753990d8fbaa 100644 --- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTest.java +++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTest.java @@ -20,15 +20,24 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.CertificatesUtil; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; +@TestCertificates(certificates = { + @Certificate(name = "ftp", formats = { + Format.PKCS12 }, password = "password") }) @Disabled //https://github.com/apache/camel-quarkus/issues/4089 @QuarkusTest @QuarkusTestResource(FtpsTestResource.class) class FtpsTest { + static final String CERTIFICATE_KEYSTORE_FILE = CertificatesUtil.keystoreFile("ftp", "p12"); + @Test public void testFtpsComponent() { // Create a new file on the FTPS server diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java index 8859cc572bc8..9181cb736dbd 100644 --- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java +++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java @@ -16,12 +16,7 @@ */ package org.apache.camel.quarkus.component.ftps.it; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Path; -import java.util.Map; -import java.util.Objects; import org.apache.camel.quarkus.component.ftp.it.FtpTestResource; import org.apache.ftpserver.listener.ListenerFactory; @@ -29,45 +24,27 @@ public class FtpsTestResource extends FtpTestResource { - private Path keystoreFilePath; - public FtpsTestResource() { super("ftps"); } @Override - public Map start() { - try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("keystore.p12")) { - Objects.requireNonNull(stream, "FTP keystore file keystore.p12 could not be loaded"); - keystoreFilePath = Files.createTempFile("camel-ftps-keystore", "p12"); - Files.write(keystoreFilePath, stream.readAllBytes()); - } catch (IOException e) { - throw new RuntimeException(e); + protected ListenerFactory createListenerFactory(int port) { + //do not create a factory if keystore file does not exists + //because the test is disabled, but the test resource is "activated", this condition prevents the failure + //for the FtpTest + if (!Path.of(FtpsTest.CERTIFICATE_KEYSTORE_FILE).toFile().exists()) { + return null; } - return super.start(); - } - @Override - protected ListenerFactory createListenerFactory(int port) { SslConfigurationFactory sslConfigFactory = new SslConfigurationFactory(); - sslConfigFactory.setKeystoreFile(keystoreFilePath.toFile()); + sslConfigFactory.setKeystoreFile(Path.of(FtpsTest.CERTIFICATE_KEYSTORE_FILE).toFile()); sslConfigFactory.setKeystoreType("PKCS12"); sslConfigFactory.setKeystorePassword("password"); - sslConfigFactory.setKeyPassword("password"); sslConfigFactory.setSslProtocol("TLSv1.3"); ListenerFactory factory = super.createListenerFactory(port); factory.setSslConfiguration(sslConfigFactory.createSslConfiguration()); return factory; } - - @Override - public void stop() { - super.stop(); - try { - Files.deleteIfExists(keystoreFilePath); - } catch (IOException e) { - // Ignored - } - } } diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTest.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTest.java index d3a4af9d1503..875b1325b49e 100644 --- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTest.java +++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTest.java @@ -20,10 +20,18 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; +@TestCertificates(certificates = { + @Certificate(name = "ftp", formats = { + Format.PEM }, password = "password"), + @Certificate(name = "ftp", formats = { + Format.PKCS12 }, password = "password") }) @QuarkusTest @QuarkusTestResource(SftpTestResource.class) class SftpTest { diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java index 7d6d0efb8078..67035d47b887 100644 --- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java +++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java @@ -64,7 +64,7 @@ public Map start() { sshServer = SshServer.setUpDefaultServer(); sshServer.setPort(port); - sshServer.setKeyPairProvider(new ClassLoadableResourceKeyPairProvider("test.key")); + sshServer.setKeyPairProvider(new ClassLoadableResourceKeyPairProvider("certs/ftp.key")); sshServer.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory())); sshServer.setCommandFactory(new ScpCommandFactory()); sshServer.setPasswordAuthenticator((username, password, session) -> true); diff --git a/integration-tests/ftp/src/test/resources/keystore.p12 b/integration-tests/ftp/src/test/resources/keystore.p12 deleted file mode 100644 index ae508effc11d..000000000000 Binary files a/integration-tests/ftp/src/test/resources/keystore.p12 and /dev/null differ diff --git a/integration-tests/ftp/src/test/resources/readme.adoc b/integration-tests/ftp/src/test/resources/readme.adoc deleted file mode 100644 index 1167900dead3..000000000000 --- a/integration-tests/ftp/src/test/resources/readme.adoc +++ /dev/null @@ -1,28 +0,0 @@ -=== How to generate test.key - -1. Generate private certificate for client. -[source] -openssl genrsa -out test.key 2048 - -=== How to generate keystore.p12 - -[start=2] -. Generate certificate signing request -[source] -openssl req -new -subj '/C=CA/L=camel-ftp/O=camel-ftp/CN=localhost' -key test.key -out test.csr -. Generate a key for the cert. authority -[source] -openssl genrsa -out ca.key 2048 -. Generate a self-signed certificate for cert. authority -[source] -openssl req -new -subj '/C=CA/L=camel-ftp/O=camel-ftp/CN=localhost' -x509 -key ca.key -out ca.crt -. Very easy way to sign a certificate -[source] -openssl x509 -req -in test.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out test.crt -days 10000 -. Create a kyestore -[source] -openssl pkcs12 -export -in test.crt -inkey test.key -certfile ca.crt -name "serverftp" -out keystore.p12 -passout pass:password -keypbe aes-256-cbc -certpbe aes-256-cbc - - - - diff --git a/integration-tests/ftp/src/test/resources/test.key b/integration-tests/ftp/src/test/resources/test.key deleted file mode 100644 index 971dd4c518b5..000000000000 --- a/integration-tests/ftp/src/test/resources/test.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCUuR9+HMWaD0tz -N+pF7MfRHdTtt1uCYgfBrghWOFKO82ZCSUWR5uR/eq15pdtNZvqAS0Ck6K7NKtlQ -Hcls5/wMiI4oLyn3RfKNTSnBkK4lNELqrTMGgBC6LxcqThGNOc1oQD0dZLpbWmZU -LuddrBRaPuTOa1d9x/mi/rN5VLL/QOHx8Ej4teR74APn0JmTGwwV5EFDXWU6qSvp -ASR65wrrTcMxie0LFwe3PWOG16T0w58eymjGlr9t9xPO9l6FGe5IfmdW2GWIgeWr -y0mlp0QABjtIonn6UpbyUkUrpYZeiU9M7e0QHQa25mKTJpCtat3/UvY1Qf8Q7A1j -lt2duTgBAgMBAAECggEAAXnm7J8HfRR6yL18103W2+YCZ4ui3mPvtMXv8j8j3qRe -1viYNq8GhJdoomT5jMahZOWaUii3F3U96/QnvCt/TnaKhq6VKY2prypdaDzx5Y+j -vGWUtJNP1zFBdxuIRBEXT1oX4TNPQDng+yPuCvl6yDyIk93v4+E4wpvplyI2lp7/ -3j7AwopNJmJ04YN7mF1APjjDf1nlF2c/M7tLGOmDSzW4oj0nz1NqKl/Lv+lQBbcy -9W6H0l3WEMNUFidQ/Sur9NOkC9t1ogcAiaiTVAH4Z6QGSzXSUr4owfhLnt/aEwIp -XyQzKD4ztZv5dmDiQj0y0ICD5Kzw4r+0wtRId/gAOQKBgQDNOHQQRl+Js/IuNz5k -wvH/h/68uhnWi/vuBk9PFv8waQogCQfEhLB3GnDk6recRpLYgxvyn+CdUeuVkMXn -H1Is1s5Brd24OFqA0yUJALgGIKJDeeAOCRLv6teL0pmAhNjTD9ITVdLrO+05PdeG -Y/n0ztITylH81MVjsh0hEOUDVQKBgQC5heIlsO+Qn4yGZwg5/UgYw88yPYyVDvYz -2884SRnzBIVrry7nmQFteTLEYdswnS5Yj67BW8cVFWV6Hidb2svWf9FBNXjPwNnX -G4Ha4Ww55Lsp5Fvj8qIJwf+CYbc8BH4osDEuXK56yspNNB1mU+MEdjpI3FfhTKTK -JY2wpQs5/QKBgQC4G9xsOWY+mLQ9aAxOw2Ht2Gjdkavaga1bhkeiccQw/xs5UECq -ukvCHnOHu1dMGThmi4EIMwyEtti+TqptRfkoBvH1lHDkc5ImHscMA5wUyzQnivBK -RzO5D5ueciqKVSRcfcX+2LEnnpSdFPEFPS4ixWVMoebaB1yqq0Fcx9ZdHQKBgBRn -jT/n/fFCGwqNOnJmUQ+oOZmk+1lJk/qQKnJeV+RKkwIM+nOueGG5+sNun9Tw9K/4 -3ZeWqIbBG7AasOmBXvnwhOtPHkJ7S3pFJDsWn/ieF5e77f9cKEY6eAe3B5gqRlXj -SwV2XBpVQ3rKSJGAmG9dMXviAChfbaBuEO9kt59hAoGBALdC531VRHjRyozHNgkJ -Auyfv5LhR/0YfPrPZl0MoGkq/T3aOwvLtwXhtYyJBgzGox4KH8dsFLHUwD58uSvs -cIIBhhkbdwD6Myu+k1OsC83qLDfo/mjSBAqOKVdQr7zEFndzPahJzv1MI91WAXvu -krY/Q764PuO8mCHRjSLSllz7 ------END PRIVATE KEY----- diff --git a/integration-tests/http-grouped/pom.xml b/integration-tests/http-grouped/pom.xml index b7febb976588..a849e4b07557 100644 --- a/integration-tests/http-grouped/pom.xml +++ b/integration-tests/http-grouped/pom.xml @@ -116,6 +116,11 @@ camel-quarkus-integration-test-support test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTest.java b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTest.java index 9c1fb307a03b..bf65fb90925e 100644 --- a/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTest.java +++ b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTest.java @@ -32,7 +32,7 @@ @TestCertificates(certificates = { @Certificate(name = KafkaSaslSslTestResource.KAFKA_HOSTNAME, formats = { Format.PKCS12 }, password = KafkaSaslSslTestResource.KAFKA_KEYSTORE_PASSWORD) -}, baseDir = KafkaSaslSslTestResource.CERTS_BASEDIR) +}, baseDir = KafkaSaslSslTestResource.CERTS_BASEDIR, docker = true) @QuarkusTest @QuarkusTestResource(KafkaSaslSslTestResource.class) public class KafkaSaslSslTest { diff --git a/integration-tests/kafka-ssl/src/test/java/org/apache/camel/quarkus/kafka/ssl/KafkaSslTest.java b/integration-tests/kafka-ssl/src/test/java/org/apache/camel/quarkus/kafka/ssl/KafkaSslTest.java index 0921d58d97d1..f97fae8f293b 100644 --- a/integration-tests/kafka-ssl/src/test/java/org/apache/camel/quarkus/kafka/ssl/KafkaSslTest.java +++ b/integration-tests/kafka-ssl/src/test/java/org/apache/camel/quarkus/kafka/ssl/KafkaSslTest.java @@ -34,7 +34,7 @@ @TestCertificates(certificates = { @Certificate(name = KafkaSslTestResource.KAFKA_HOSTNAME, formats = { Format.PKCS12 }, password = KafkaSslTestResource.KAFKA_KEYSTORE_PASSWORD) -}, baseDir = KafkaSslTestResource.CERTS_BASEDIR) +}, baseDir = KafkaSslTestResource.CERTS_BASEDIR, docker = true) @QuarkusTest @QuarkusTestResource(KafkaSslTestResource.class) public class KafkaSslTest { diff --git a/integration-tests/lumberjack/pom.xml b/integration-tests/lumberjack/pom.xml index 12f53b34e13c..dcd2ac463c2b 100644 --- a/integration-tests/lumberjack/pom.xml +++ b/integration-tests/lumberjack/pom.xml @@ -69,6 +69,11 @@ mockito-core test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/lumberjack/src/main/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackRoutes.java b/integration-tests/lumberjack/src/main/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackRoutes.java index 0e90986455f3..c75271ac24c4 100644 --- a/integration-tests/lumberjack/src/main/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackRoutes.java +++ b/integration-tests/lumberjack/src/main/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackRoutes.java @@ -83,7 +83,7 @@ public SSLContextParameters createServerSSLContextParameters() { KeyManagersParameters keyManagersParameters = new KeyManagersParameters(); KeyStoreParameters keyStore = new KeyStoreParameters(); keyStore.setPassword("changeit"); - keyStore.setResource("ssl/keystore.jks"); + keyStore.setResource("certs/lumberjack-keystore.jks"); keyManagersParameters.setKeyPassword("changeit"); keyManagersParameters.setKeyStore(keyStore); sslContextParameters.setKeyManagers(keyManagersParameters); diff --git a/integration-tests/lumberjack/src/main/resources/application.properties b/integration-tests/lumberjack/src/main/resources/application.properties index f870ae692a57..9e8f5a92639b 100644 --- a/integration-tests/lumberjack/src/main/resources/application.properties +++ b/integration-tests/lumberjack/src/main/resources/application.properties @@ -15,4 +15,4 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.native.resources.includes = io/*,ssl/* +quarkus.native.resources.includes = io/*,certs/* diff --git a/integration-tests/lumberjack/src/main/resources/ssl/keystore.jks b/integration-tests/lumberjack/src/main/resources/ssl/keystore.jks deleted file mode 100644 index 78e8571fd300..000000000000 Binary files a/integration-tests/lumberjack/src/main/resources/ssl/keystore.jks and /dev/null differ diff --git a/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackClientUtil.java b/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackClientUtil.java index 21c79c415d0e..c93f48cad418 100644 --- a/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackClientUtil.java +++ b/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackClientUtil.java @@ -145,7 +145,7 @@ public static SSLContextParameters createClientSSLContextParameters() { TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); KeyStoreParameters trustStore = new CustomKeyStoreParameters(); trustStore.setPassword("changeit"); - trustStore.setResource("ssl/keystore.jks"); + trustStore.setResource("certs/lumberjack-keystore.jks"); trustManagersParameters.setKeyStore(trustStore); sslContextParameters.setTrustManagers(trustManagersParameters); diff --git a/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackTest.java b/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackTest.java index a27c298ce37b..54f8985ec8fe 100644 --- a/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackTest.java +++ b/integration-tests/lumberjack/src/test/java/org/apache/camel/quarkus/component/lumberjack/it/LumberjackTest.java @@ -22,6 +22,9 @@ import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.eclipse.microprofile.config.ConfigProvider; import org.junit.jupiter.api.Test; @@ -29,6 +32,9 @@ import static org.hamcrest.Matchers.hasSize; import static org.junit.jupiter.api.Assertions.assertEquals; +@TestCertificates(certificates = { + @Certificate(name = "lumberjack", formats = { + Format.JKS }, password = "changeit") }) @QuarkusTest @TestHTTPEndpoint(LumberjackResource.class) @QuarkusTestResource(LumberjackTestResource.class) diff --git a/integration-tests/mail/README.adoc b/integration-tests/mail/README.adoc deleted file mode 100644 index e82fb8e99f5a..000000000000 --- a/integration-tests/mail/README.adoc +++ /dev/null @@ -1,17 +0,0 @@ -== Camel Quarkus Mail integration tests - -To regenerate the SSL certificates and trust stores for use with local host testing run the following script: - -[source,shell] ----- -cd src/test/resources -./regenerate-certificates.sh ----- - -If required, you can override the default certificate CN and SAN configuration by passing them as script arguments: - -[source,shell] ----- -cd src/test/resources -./regenerate-certificates.sh "other-dns-or-ip" "DNS:another-dns,IP:192.168.1.150" ----- diff --git a/integration-tests/mail/pom.xml b/integration-tests/mail/pom.xml index c873e9a153c8..4f7ba475945c 100644 --- a/integration-tests/mail/pom.xml +++ b/integration-tests/mail/pom.xml @@ -85,6 +85,11 @@ quarkus-junit4-mock test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java index 4ca05a9f7b84..3f6665b64b99 100644 --- a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java +++ b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java @@ -35,8 +35,12 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import jakarta.json.bind.JsonbBuilder; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; import org.apache.camel.ExchangePropertyKey; import org.apache.camel.ServiceStatus; +import org.apache.camel.quarkus.test.support.certificate.CertificatesUtil; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.eclipse.angus.mail.util.MailConnectException; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; @@ -53,9 +57,14 @@ import static org.apache.camel.quarkus.component.mail.CamelRoute.USERNAME; import static org.hamcrest.Matchers.is; +@TestCertificates(certificates = { + @Certificate(name = "greenmail", formats = { + Format.PKCS12 }, password = MailTestResource.KEYSTORE_PASSWORD) +}, docker = true) @QuarkusTest @QuarkusTestResource(MailTestResource.class) public class MailTest { + static final String GREENMAIL_CERTIFICATE_STORE_FILE = CertificatesUtil.keystoreFile("greenmail", "p12"); private static final Pattern DELIMITER_PATTERN = Pattern.compile("\r\n[^\r\n]+"); private static final String EXPECTED_TEMPLATE = "${delimiter}\r\n" + "Content-Type: text/plain; charset=UTF8; other-parameter=true\r\n" diff --git a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java index a121a51cbb35..d65a80f99930 100644 --- a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java +++ b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java @@ -17,51 +17,32 @@ package org.apache.camel.quarkus.component.mail; import java.io.IOException; -import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import org.apache.commons.io.FileUtils; import org.eclipse.microprofile.config.ConfigProvider; import org.jboss.logging.Logger; -import org.testcontainers.DockerClientFactory; -import org.testcontainers.containers.Container.ExecResult; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; -import org.testcontainers.images.builder.Transferable; import org.testcontainers.utility.MountableFile; public class MailTestResource implements QuarkusTestResourceLifecycleManager { private static final Logger LOG = Logger.getLogger(MailTestResource.class); private static final String GREENMAIL_IMAGE_NAME = ConfigProvider.getConfig().getValue("greenmail.container.image", String.class); - private static final String GREENMAIL_CERTIFICATE_STORE_FILE = "greenmail.p12"; - private static final String GENERATE_CERTIFICATE_SCRIPT = "generate-certificates.sh"; + //default value used in testcontainer + static final String KEYSTORE_PASSWORD = "changeit"; + private GenericContainer container; - private Path certificateStoreLocation; @Override public Map start() { - try { - certificateStoreLocation = Files.createTempDirectory("MailTestResource-"); - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - try (InputStream in = classLoader.getResourceAsStream(GREENMAIL_CERTIFICATE_STORE_FILE)) { - Files.copy(in, certificateStoreLocation.resolve(GREENMAIL_CERTIFICATE_STORE_FILE)); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - - String dockerHost = DockerClientFactory.instance().dockerHostIpAddress(); - if (!dockerHost.equals("localhost") && !dockerHost.equals("127.0.0.1")) { - regenerateCertificatesForDockerHost(); - } - container = new GenericContainer<>(GREENMAIL_IMAGE_NAME) - .withCopyToContainer(Transferable.of(getCertificateStoreContent()), "/home/greenmail/greenmail.p12") + .withCopyToContainer(MountableFile.forClasspathResource("certs/greenmail-keystore.p12"), + "/home/greenmail/greenmail.p12") .withExposedPorts(MailProtocol.allPorts()) .waitingFor(new HttpWaitStrategy() .forPort(MailProtocol.API.getPort()) @@ -87,49 +68,11 @@ public void stop() { if (container != null) { container.stop(); } - if (certificateStoreLocation != null) { - try { - FileUtils.deleteDirectory(certificateStoreLocation.toFile()); - } catch (IOException e) { - // Ignored - } - } - } - - private void regenerateCertificatesForDockerHost() { - // Run certificate generation in a container in case the target platform does not have prerequisites like OpenSSL installed (E.g on Windows) - String imageName = ConfigProvider.getConfig().getValue("eclipse-temurin.container.image", String.class); - try (GenericContainer container = new GenericContainer<>(imageName)) { - container.withCreateContainerCmdModifier(modifier -> { - modifier.withEntrypoint("/bin/bash"); - modifier.withStdinOpen(true); - modifier.withAttachStdout(true); - }); - container.setWorkingDirectory("/"); - container.start(); - - String host = container.getHost(); - container.copyFileToContainer( - MountableFile.forClasspathResource(GENERATE_CERTIFICATE_SCRIPT), - "/" + GENERATE_CERTIFICATE_SCRIPT); - ExecResult result = container.execInContainer("/bin/bash", "/" + GENERATE_CERTIFICATE_SCRIPT, host, - "DNS:%s,IP:%s".formatted(host, host), "/" + GREENMAIL_CERTIFICATE_STORE_FILE); - - LOG.info(GENERATE_CERTIFICATE_SCRIPT + " - STDOUT:"); - LOG.info(result.getStdout()); - LOG.info(GENERATE_CERTIFICATE_SCRIPT + " - STDERR:"); - LOG.info(result.getStderr()); - - container.copyFileFromContainer("/" + GREENMAIL_CERTIFICATE_STORE_FILE, - certificateStoreLocation.resolve(GREENMAIL_CERTIFICATE_STORE_FILE).toString()); - } catch (Exception e) { - throw new RuntimeException(e); - } } private byte[] getCertificateStoreContent() { try { - return Files.readAllBytes(certificateStoreLocation.resolve(GREENMAIL_CERTIFICATE_STORE_FILE)); + return Files.readAllBytes(Path.of(MailTest.GREENMAIL_CERTIFICATE_STORE_FILE)); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/integration-tests/mail/src/test/resources/generate-certificates.sh b/integration-tests/mail/src/test/resources/generate-certificates.sh deleted file mode 100755 index d36cf81c9afe..000000000000 --- a/integration-tests/mail/src/test/resources/generate-certificates.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# 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. -# - - -export CN=${1:-localhost} -export SUBJECT_ALT_NAMES=${2:-"DNS:localhost,IP:127.0.0.1"} -export CERT_OUTPUT_FILE=${3:-greenmail.p12} - -echo "====> PWD = ${PWD}" -echo "====> CN = ${CN}" -echo "====> SUBJECT_ALT_NAMES = ${SUBJECT_ALT_NAMES}" -echo "====> CERT_OUTPUT_FILE = ${CERT_OUTPUT_FILE}" - -openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout greenmail.key -out greenmail.crt -subj "/CN=${CN}" -addext "subjectAltName=${SUBJECT_ALT_NAMES}" -openssl pkcs12 -export -out ${CERT_OUTPUT_FILE} -inkey greenmail.key -in greenmail.crt -password pass:changeit - -rm -f *.crt *.key diff --git a/integration-tests/mail/src/test/resources/greenmail.p12 b/integration-tests/mail/src/test/resources/greenmail.p12 deleted file mode 100644 index de455f1a734f..000000000000 Binary files a/integration-tests/mail/src/test/resources/greenmail.p12 and /dev/null differ diff --git a/integration-tests/nats/pom.xml b/integration-tests/nats/pom.xml index 92e21f513ff7..cf9ceba72ef5 100644 --- a/integration-tests/nats/pom.xml +++ b/integration-tests/nats/pom.xml @@ -80,6 +80,11 @@ quarkus-junit4-mock test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/nats/src/main/java/org/apache/camel/quarkus/component/nats/it/NatsRoutes.java b/integration-tests/nats/src/main/java/org/apache/camel/quarkus/component/nats/it/NatsRoutes.java index a8c5faba2e97..4e4a0fd120f0 100644 --- a/integration-tests/nats/src/main/java/org/apache/camel/quarkus/component/nats/it/NatsRoutes.java +++ b/integration-tests/nats/src/main/java/org/apache/camel/quarkus/component/nats/it/NatsRoutes.java @@ -72,7 +72,7 @@ SSLContextParameters createSSLContextParameters() { KeyManagersParameters keyManagersParameters = new KeyManagersParameters(); KeyStoreParameters keyStore = new KeyStoreParameters(); keyStore.setPassword("password"); - keyStore.setResource("certs/keystore.jks"); + keyStore.setResource("certs/nats-keystore.p12"); keyManagersParameters.setKeyPassword("password"); keyManagersParameters.setKeyStore(keyStore); sslContextParameters.setKeyManagers(keyManagersParameters); @@ -80,7 +80,7 @@ SSLContextParameters createSSLContextParameters() { TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); KeyStoreParameters trustStore = new KeyStoreParameters(); trustStore.setPassword("password"); - trustStore.setResource("certs/truststore.jks"); + trustStore.setResource("certs/nats-truststore.p12"); trustManagersParameters.setKeyStore(trustStore); sslContextParameters.setTrustManagers(trustManagersParameters); diff --git a/integration-tests/nats/src/main/resources/application.properties b/integration-tests/nats/src/main/resources/application.properties index 12875be04ea3..d52693413a94 100644 --- a/integration-tests/nats/src/main/resources/application.properties +++ b/integration-tests/nats/src/main/resources/application.properties @@ -14,6 +14,6 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.native.resources.includes=certs/*.jks +quarkus.native.resources.includes=certs/*.p12 camel.nats.test.enable-tls=${ENABLE_TLS_TESTS:false} \ No newline at end of file diff --git a/integration-tests/nats/src/main/resources/certs/keystore.jks b/integration-tests/nats/src/main/resources/certs/keystore.jks deleted file mode 100644 index daaea366bbd2..000000000000 Binary files a/integration-tests/nats/src/main/resources/certs/keystore.jks and /dev/null differ diff --git a/integration-tests/nats/src/main/resources/certs/truststore.jks b/integration-tests/nats/src/main/resources/certs/truststore.jks deleted file mode 100644 index 1d844c569938..000000000000 Binary files a/integration-tests/nats/src/main/resources/certs/truststore.jks and /dev/null differ diff --git a/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTest.java b/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTest.java index e69466173d10..71e535917044 100644 --- a/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTest.java +++ b/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTest.java @@ -21,6 +21,9 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.http.Header; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; @@ -28,6 +31,9 @@ import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; +@TestCertificates(certificates = { + @Certificate(name = "nats", formats = { + Format.PKCS12, Format.PEM }, password = "password") }) @QuarkusTestResource(NatsTestResource.class) @QuarkusTest class NatsTest { diff --git a/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTestResource.java b/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTestResource.java index a0c0c7cffb51..179dfccc31a4 100644 --- a/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTestResource.java +++ b/integration-tests/nats/src/test/java/org/apache/camel/quarkus/component/nats/it/NatsTestResource.java @@ -134,18 +134,19 @@ private static GenericContainer tlsAuthContainer(Map properti GenericContainer container = new GenericContainer<>(NATS_IMAGE) .withExposedPorts(NATS_SERVER_PORT) .withNetworkAliases("tlsAuthContainer") - .withClasspathResourceMapping("certs/ca.pem", "/certs/ca.pem", BindMode.READ_ONLY, SelinuxContext.SHARED) - .withClasspathResourceMapping("certs/key.pem", "/certs/key.pem", BindMode.READ_ONLY, SelinuxContext.SHARED) - .withClasspathResourceMapping("certs/server.pem", "/certs/server.pem", BindMode.READ_ONLY, + .withClasspathResourceMapping("certs/nats-ca.crt", "/certs/nats-ca.crt", BindMode.READ_ONLY, + SelinuxContext.SHARED) + .withClasspathResourceMapping("certs/nats.key", "/certs/nats.key", BindMode.READ_ONLY, SelinuxContext.SHARED) + .withClasspathResourceMapping("certs/nats.crt", "/certs/nats.crt", BindMode.READ_ONLY, SelinuxContext.SHARED) .withClasspathResourceMapping("conf/tls.conf", "/conf/tls.conf", BindMode.READ_ONLY, SelinuxContext.SHARED) .withCommand( "--config", "/conf/tls.conf", "--tls", - "--tlscert=/certs/server.pem", - "--tlskey=/certs/key.pem", + "--tlscert=/certs/nats.crt", + "--tlskey=/certs/nats.key", "--tlsverify", - "--tlscacert=/certs/ca.pem") + "--tlscacert=/certs/nats-ca.crt") .withLogConsumer(new Slf4jLogConsumer(LOG).withPrefix("tlsAuthContainer")) .waitingFor(Wait.forLogMessage(".*Server is ready.*", 1)); try { diff --git a/integration-tests/nats/src/test/resources/certs/ca.pem b/integration-tests/nats/src/test/resources/certs/ca.pem deleted file mode 100644 index d13e91363954..000000000000 --- a/integration-tests/nats/src/test/resources/certs/ca.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDXDCCAkQCCQDI2Vsry8+BDDANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJV -UzELMAkGA1UECAwCQ0ExEDAOBgNVBAoMB1N5bmFkaWExEDAOBgNVBAsMB25hdHMu -aW8xEjAQBgNVBAMMCWxvY2FsaG9zdDEcMBoGCSqGSIb3DQEJARYNZGVyZWtAbmF0 -cy5pbzAeFw0xOTEwMTcxMzAzNThaFw0yOTEwMTQxMzAzNThaMHAxCzAJBgNVBAYT -AlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHU3luYWRpYTEQMA4GA1UECwwHbmF0 -cy5pbzESMBAGA1UEAwwJbG9jYWxob3N0MRwwGgYJKoZIhvcNAQkBFg1kZXJla0Bu -YXRzLmlvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAohX2dXdHIDM5 -yZDWk96b0mwRTHhBIOKtMPTTs/zKmlAgjjDxW7kSg0JimTNds9YbJ33FhcEJKXtV -KH3Cn0uyZPS1VcTzPr7XP2QI+9SqqLuahkHAhgqoRwK62fTFJgzdZO0f9w9WwzMi -gGk/v7KkKFa/9xKLCa9DTEJ9FA34HuYoBxXMZvypDm8d+0kxOCdThpzhKeucE4ya -jFlvOP9/l7GyjlczzAD/nt/QhPfSeIx1MF0ICj5qzwPD/jB1ekoL9OShoHvoEyXo -UO13GMdVmZqwJcS7Vk5XNEZoH0cxSw/SrZGCE9SFjR1t8TAe3QZiZ9E8EAg4IzJQ -jfR2II5LiQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBIwib+0xLth/1+URtgQFn8 -dvQNqnJjlqC27U48qiTCTC5vJWbQDqUg9o6gtwZyYEHQ7dMmn68ozDzcGTCxaikV -n01Bj2ijODK96Jrm/P5aVkP5Cn06FfudluZI2Q/A1cqTsa8V4rj02PpwCcLEaDqX -yhztlhbKypWrlGuWpVlDBWstyRar98vvRK1XEyBu2NHp2fy49cwJCub4Cmz920fh -oiIwzXIKtfnf1GEjUnsuFPMgCxvhjirYNPWWjqaBldrM/dBJqwTyZf/p6g40vufN -JJDc65c4tyRwBSBdFn+Q4zD44M0AR/8THAeIfsT42lyl8fMV5A4fe1nAVJDC4Z/H ------END CERTIFICATE----- diff --git a/integration-tests/nats/src/test/resources/certs/key.pem b/integration-tests/nats/src/test/resources/certs/key.pem deleted file mode 100644 index f2c2c6c2f573..000000000000 --- a/integration-tests/nats/src/test/resources/certs/key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQDm+0dlzcmiLa+L -zdVqeVQ8B1/rWnErK+VvvjH7FmVodg5Z5+RXyojpd9ZBrVd6QrLSVMQPfFvBvGGX -4yI6Ph5KXUefa31vNOOMhp2FGSmaEVhETKGQ0xRh4VfaAerOP5Cunl0TbSyJyjkV -a7aeMtcqTEiFL7Ae2EtiMhTrMrYpBDQ8rzm2i1IyTb9DX5v7DUOmrSynQSlVyXCz -tRVGNL/kHlItpEku1SHt/AD3ogu8EgqQZFB8xRRw9fubYgh4Q0kx80e4k9QtTKnc -F3B2NGb/ZcE5Z+mmHIBq8J2zKMijOrdd3m5TbQmzDbETEOjs4L1eoZRLcL/cvYu5 -gmXdr4F7AgMBAAECggEBAK4sr3MiEbjcsHJAvXyzjwRRH1Bu+8VtLW7swe2vvrpd -w4aiKXrV/BXpSsRtvPgxkXyvdMSkpuBZeFI7cVTwAJFc86RQPt77x9bwr5ltFwTZ -rXCbRH3b3ZPNhByds3zhS+2Q92itu5cPyanQdn2mor9/lHPyOOGZgobCcynELL6R -wRElkeDyf5ODuWEd7ADC5IFyZuwb3azNVexIK+0yqnMmv+QzEW3hsycFmFGAeB7v -MIMjb2BhLrRr6Y5Nh+k58yM5DCf9h/OJhDpeXwLkxyK4BFg+aZffEbUX0wHDMR7f -/nMv1g6cKvDWiLU8xLzez4t2qNIBNdxw5ZSLyQRRolECgYEA+ySTKrBAqI0Uwn8H -sUFH95WhWUXryeRyGyQsnWAjZGF1+d67sSY2un2W6gfZrxRgiNLWEFq9AaUs0MuH -6syF4Xwx/aZgU/gvsGtkgzuKw1bgvekT9pS/+opmHRCZyQAFEHj0IEpzyB6rW1u/ -LdlR3ShEENnmXilFv/uF/uXP5tMCgYEA63LiT0w46aGPA/E+aLRWU10c1eZ7KdhR -c3En6zfgIxgFs8J38oLdkOR0CF6T53DSuvGR/OprVKdlnUhhDxBgT1oQjK2GlhPx -JV5uMvarJDJxAwsF+7T4H2QtZ00BtEfpyp790+TlypSG1jo/BnSMmX2uEbV722lY -hzINLY49obkCgYBEpN2YyG4T4+PtuXznxRkfogVk+kiVeVx68KtFJLbnw//UGT4i -EHjbBmLOevDT+vTb0QzzkWmh3nzeYRM4aUiatjCPzP79VJPsW54whIDMHZ32KpPr -TQMgPt3kSdpO5zN7KiRIAzGcXE2n/e7GYGUQ1uWr2XMu/4byD5SzdCscQwJ/Ymii -LoKtRvk/zWYHr7uwWSeR5dVvpQ3E/XtONAImrIRd3cRqXfJUqTrTRKxDJXkCmyBc -5FkWg0t0LUkTSDiQCJqcUDA3EINFR1kwthxja72pfpwc5Be/nV9BmuuUysVD8myB -qw8A/KsXsHKn5QrRuVXOa5hvLEXbuqYw29mX6QKBgDGDzIzpR9uPtBCqzWJmc+IJ -z4m/1NFlEz0N0QNwZ/TlhyT60ytJNcmW8qkgOSTHG7RDueEIzjQ8LKJYH7kXjfcF -6AJczUG5PQo9cdJKo9JP3e1037P/58JpLcLe8xxQ4ce03zZpzhsxR2G/tz8DstJs -b8jpnLyqfGrcV2feUtIZ ------END PRIVATE KEY----- diff --git a/integration-tests/nats/src/test/resources/certs/server.pem b/integration-tests/nats/src/test/resources/certs/server.pem deleted file mode 100644 index e36fd9d62c0f..000000000000 --- a/integration-tests/nats/src/test/resources/certs/server.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDPTCCAiWgAwIBAgIJAJCSLX9jr5W7MA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV -BAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHU3luYWRpYTEQMA4GA1UECwwH -bmF0cy5pbzESMBAGA1UEAwwJbG9jYWxob3N0MRwwGgYJKoZIhvcNAQkBFg1kZXJl -a0BuYXRzLmlvMB4XDTE5MTAxNzEzNTcyNloXDTI5MTAxNDEzNTcyNlowDTELMAkG -A1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm+0dlzcmi -La+LzdVqeVQ8B1/rWnErK+VvvjH7FmVodg5Z5+RXyojpd9ZBrVd6QrLSVMQPfFvB -vGGX4yI6Ph5KXUefa31vNOOMhp2FGSmaEVhETKGQ0xRh4VfaAerOP5Cunl0TbSyJ -yjkVa7aeMtcqTEiFL7Ae2EtiMhTrMrYpBDQ8rzm2i1IyTb9DX5v7DUOmrSynQSlV -yXCztRVGNL/kHlItpEku1SHt/AD3ogu8EgqQZFB8xRRw9fubYgh4Q0kx80e4k9Qt -TKncF3B2NGb/ZcE5Z+mmHIBq8J2zKMijOrdd3m5TbQmzDbETEOjs4L1eoZRLcL/c -vYu5gmXdr4F7AgMBAAGjPTA7MBoGA1UdEQQTMBGCCWxvY2FsaG9zdIcEfwAAATAd -BgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDQYJKoZIhvcNAQEFBQADggEB -ADQYaEjWlOb9YzUnFGjfDC06dRZjRmK8TW/4GiDHIDk5TyZ1ROtskvyhVyTZJ5Vs -qXOKJwpps0jK2edtrvZ7xIGw+Y41oPgYYhr5TK2c+oi2UOHG4BXqRbuwz/5cU+nM -ZWOG1OrHBCbrMSeFsn7rzETnd8SZnw6ZE7LI62WstdoCY0lvNfjNv3kY/6hpPm+9 -0bVzurZ28pdJ6YEJYgbPcOvxSzGDXTw9LaKEmqknTsrBKI2qm+myVTbRTimojYTo -rw/xjHESAue/HkpOwWnFTOiTT+V4hZnDXygiSy+LWKP4zLnYOtsn0lN9OmD0z+aa -gpoVMSncu2jMIDZX63IkQII= ------END CERTIFICATE----- diff --git a/integration-tests/netty/README.adoc b/integration-tests/netty/README.adoc deleted file mode 100644 index 6f9d3fca63d6..000000000000 --- a/integration-tests/netty/README.adoc +++ /dev/null @@ -1,16 +0,0 @@ -== Regenerating Self Signed SSL Certificates - - cd src/main/resources/ssl - keytool -genkeypair -keystore keystore.p12 -storetype PKCS12 -storepass changeit -alias localhost -keyalg RSA -keysize 2048 -validity 99999 -dname "CN=localhost" - -== Run tests on FIPS enabled system - -To execute the tests on FIPS enabled system add `-Dfips` property so that tests will use BCFKS keystore. Example of usage: - -`mvn clean test -f integration-tests/netty/ -Dfips` - - -=== Generate Bouncy Castle FIPS Keystore (BCFKS) - - cd src/main/resources/ssl - keytool -genkey -alias localhost -keyalg RSA -keystore fips-keystore.bcfks -keysize 2048 -validity 99999 -dname "CN=localhost" -keypass changeit -provider org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider -providerpath bc-fips.jar -storetype BCFKS diff --git a/integration-tests/netty/pom.xml b/integration-tests/netty/pom.xml index 8bd885f89952..99772375490e 100644 --- a/integration-tests/netty/pom.xml +++ b/integration-tests/netty/pom.xml @@ -66,6 +66,11 @@ camel-quarkus-integration-test-support test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + @@ -147,45 +152,6 @@ - - fips - - - fips - - - - fips - fips - - - - io.quarkus - quarkus-security - - - org.bouncycastle - bctls-fips - - - org.bouncycastle - bc-fips - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - fips - - - - - - diff --git a/integration-tests/netty/src/main/java/org/apache/camel/quarkus/component/netty/NettyProducers.java b/integration-tests/netty/src/main/java/org/apache/camel/quarkus/component/netty/NettyProducers.java index 9a62ae32d543..2e37f92d3618 100644 --- a/integration-tests/netty/src/main/java/org/apache/camel/quarkus/component/netty/NettyProducers.java +++ b/integration-tests/netty/src/main/java/org/apache/camel/quarkus/component/netty/NettyProducers.java @@ -130,15 +130,11 @@ public SSLContextParameters sslContextParameters( @ConfigProperty(name = "keystore.type") Optional keystoreType, @ConfigProperty(name = "keystore.provider") Optional keystoreProvider) { KeyStoreParameters keystoreParameters = new KeyStoreParameters(); - keystoreParameters.setResource(keystore); - keystoreType.ifPresent((it) -> keystoreParameters.setType(it)); - keystoreProvider.ifPresent((it) -> keystoreParameters.setProvider(it)); + keystoreParameters.setResource("certs/netty-keystore.p12"); keystoreParameters.setPassword("changeit"); KeyStoreParameters truststoreParameters = new KeyStoreParameters(); - truststoreType.ifPresent((it) -> truststoreParameters.setType(it)); - truststoreProvider.ifPresent((it) -> truststoreParameters.setProvider(it)); - truststoreParameters.setResource(truststore); + truststoreParameters.setResource("certs/netty-truststore.p12"); truststoreParameters.setPassword("changeit"); TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); diff --git a/integration-tests/netty/src/main/resources/application.properties b/integration-tests/netty/src/main/resources/application.properties index c7a6807b1f3d..1e2bcc156bca 100644 --- a/integration-tests/netty/src/main/resources/application.properties +++ b/integration-tests/netty/src/main/resources/application.properties @@ -14,14 +14,6 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.native.resources.includes = ssl/* -truststore.file=/ssl/truststore.jks -keystore.file=/ssl/keystore.p12 - -%fips.quarkus.security.security-providers=BCFIPSJSSE -%fips.truststore.file=/ssl/fips-truststore.bcfks -%fips.truststore.provider=BCFIPS -%fips.truststore.type=BCFKS -%fips.keystore.file=/ssl/fips-keystore.bcfks -%fips.keystore.provider=BCFIPS -%fips.keystore.type=BCFKS +quarkus.native.resources.includes = certs/* +truststore.file=/certs/netty-truststore.p12 +keystore.file=/certs/netty-keystore.p12 diff --git a/integration-tests/netty/src/main/resources/ssl/fips-keystore.bcfks b/integration-tests/netty/src/main/resources/ssl/fips-keystore.bcfks deleted file mode 100644 index 9b8547659618..000000000000 Binary files a/integration-tests/netty/src/main/resources/ssl/fips-keystore.bcfks and /dev/null differ diff --git a/integration-tests/netty/src/main/resources/ssl/fips-truststore.bcfks b/integration-tests/netty/src/main/resources/ssl/fips-truststore.bcfks deleted file mode 100644 index e74b445b2934..000000000000 Binary files a/integration-tests/netty/src/main/resources/ssl/fips-truststore.bcfks and /dev/null differ diff --git a/integration-tests/netty/src/main/resources/ssl/keystore.p12 b/integration-tests/netty/src/main/resources/ssl/keystore.p12 deleted file mode 100644 index 36cc5db56797..000000000000 Binary files a/integration-tests/netty/src/main/resources/ssl/keystore.p12 and /dev/null differ diff --git a/integration-tests/netty/src/main/resources/ssl/truststore.jks b/integration-tests/netty/src/main/resources/ssl/truststore.jks deleted file mode 100644 index 962450331a22..000000000000 Binary files a/integration-tests/netty/src/main/resources/ssl/truststore.jks and /dev/null differ diff --git a/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/tcp/NettyTcpTest.java b/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/tcp/NettyTcpTest.java index b3148b8555c8..defc4b202366 100644 --- a/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/tcp/NettyTcpTest.java +++ b/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/tcp/NettyTcpTest.java @@ -21,10 +21,16 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static org.hamcrest.Matchers.is; +@TestCertificates(certificates = { + @Certificate(name = "netty", formats = { + Format.PKCS12 }, password = "changeit") }) @QuarkusTest @QuarkusTestResource(NettyTcpTestResource.class) class NettyTcpTest { diff --git a/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/udp/NettyUdpTest.java b/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/udp/NettyUdpTest.java index 7bc9a69f4771..72ac2842c8b0 100644 --- a/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/udp/NettyUdpTest.java +++ b/integration-tests/netty/src/test/java/org/apache/camel/quarkus/component/netty/udp/NettyUdpTest.java @@ -21,10 +21,16 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static org.hamcrest.Matchers.is; +@TestCertificates(certificates = { + @Certificate(name = "netty", formats = { + Format.PKCS12 }, password = "changeit") }) @QuarkusTest @QuarkusTestResource(NettyUdpTestResource.class) class NettyUdpTest { diff --git a/integration-tests/oaipmh/pom.xml b/integration-tests/oaipmh/pom.xml index 576328ae1318..1c916fd797f7 100644 --- a/integration-tests/oaipmh/pom.xml +++ b/integration-tests/oaipmh/pom.xml @@ -82,6 +82,11 @@ wiremock-standalone test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/MockOaipmhServer.java b/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/MockOaipmhServer.java index e5e6b51c506f..0e3ebaf7951f 100644 --- a/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/MockOaipmhServer.java +++ b/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/MockOaipmhServer.java @@ -42,7 +42,7 @@ public final class MockOaipmhServer { private static Map responseCache; - private static final String PASSWORD = "changeit"; + static final String PASSWORD = "changeit"; private int httpPort; private int httpsPort; @@ -91,7 +91,7 @@ public void start() { WireMockConfiguration config = wireMockConfig().extensions(transformer); config.httpsPort(httpsPort); - String keyStorePath = MockOaipmhServer.class.getResource("/jettyKS/localhost.p12").toExternalForm(); + String keyStorePath = MockOaipmhServer.class.getResource("/certs/oaipmh-keystore.p12").toExternalForm(); config.keystorePath(keyStorePath); config.keystorePassword(PASSWORD); config.keyManagerPassword(PASSWORD); diff --git a/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/OaipmhTest.java b/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/OaipmhTest.java index 8d67cfe3e0b7..40da1ffe6765 100644 --- a/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/OaipmhTest.java +++ b/integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/OaipmhTest.java @@ -20,6 +20,9 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.get; @@ -27,6 +30,9 @@ import static org.awaitility.Awaitility.await; import static org.hamcrest.Matchers.is; +@TestCertificates(certificates = { + @Certificate(name = "oaipmh", formats = { + Format.PKCS12 }, password = MockOaipmhServer.PASSWORD) }) @QuarkusTest @QuarkusTestResource(OaipmhTestResource.class) class OaipmhTest { diff --git a/integration-tests/oaipmh/src/test/resources/jettyKS/localhost.p12 b/integration-tests/oaipmh/src/test/resources/jettyKS/localhost.p12 deleted file mode 100644 index 5f6a30d06907..000000000000 Binary files a/integration-tests/oaipmh/src/test/resources/jettyKS/localhost.p12 and /dev/null differ diff --git a/integration-tests/paho-mqtt5/pom.xml b/integration-tests/paho-mqtt5/pom.xml index 55fbad0fc720..61c085849c14 100644 --- a/integration-tests/paho-mqtt5/pom.xml +++ b/integration-tests/paho-mqtt5/pom.xml @@ -80,6 +80,11 @@ camel-quarkus-integration-test-support test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java b/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java index ef86d06a0b64..f6df2cc43b8a 100644 --- a/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java +++ b/integration-tests/paho-mqtt5/src/main/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Resource.java @@ -68,8 +68,8 @@ public class PahoMqtt5Resource { @Inject ConsumerTemplate consumerTemplate; - private final String keystore = "clientkeystore.jks"; - private final String password = "quarkus"; + private final String keystore = "certs/paho-mqtt5-keystore.p12"; + public final static String KEYSTORE_PASSWORD = "quarkus"; @Path("/{protocol}/{queueName}") @GET @@ -87,9 +87,9 @@ public String consumePahoMessage( sslClientProps = "&httpsHostnameVerificationEnabled=false" + "&sslHostnameVerifier=#hostnameVerifier" + "&sslClientProps.com.ibm.ssl.keyStore=" + tmpKeystore + - "&sslClientProps.com.ibm.ssl.keyStorePassword=" + password + + "&sslClientProps.com.ibm.ssl.keyStorePassword=" + KEYSTORE_PASSWORD + "&sslClientProps.com.ibm.ssl.trustStore=" + tmpKeystore + - "&sslClientProps.com.ibm.ssl.trustStorePassword=" + password; + "&sslClientProps.com.ibm.ssl.trustStorePassword=" + KEYSTORE_PASSWORD; } result = consumerTemplate.receiveBody( "paho-mqtt5:" + queueName + "?brokerUrl=" + brokerUrl(protocol) + sslClientProps, 5000, @@ -118,9 +118,9 @@ public Response producePahoMessage( sslClientProps = "&httpsHostnameVerificationEnabled=false" + "&sslHostnameVerifier=#hostnameVerifier" + "&sslClientProps.com.ibm.ssl.keyStore=" + tmpKeystore + - "&sslClientProps.com.ibm.ssl.keyStorePassword=" + password + + "&sslClientProps.com.ibm.ssl.keyStorePassword=" + KEYSTORE_PASSWORD + "&sslClientProps.com.ibm.ssl.trustStore=" + tmpKeystore + - "&sslClientProps.com.ibm.ssl.trustStorePassword=" + password; + "&sslClientProps.com.ibm.ssl.trustStorePassword=" + KEYSTORE_PASSWORD; } producerTemplate.sendBody( "paho-mqtt5:" + queueName + "?retained=true&brokerUrl=" + brokerUrl(protocol) + sslClientProps, message); diff --git a/integration-tests/paho-mqtt5/src/main/resources/application.properties b/integration-tests/paho-mqtt5/src/main/resources/application.properties index 7db61c14abd7..2a135a04772c 100644 --- a/integration-tests/paho-mqtt5/src/main/resources/application.properties +++ b/integration-tests/paho-mqtt5/src/main/resources/application.properties @@ -14,4 +14,4 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.native.resources.includes=*.jks +quarkus.native.resources.includes=certs/*.p12 diff --git a/integration-tests/paho-mqtt5/src/main/resources/clientkeystore.jks b/integration-tests/paho-mqtt5/src/main/resources/clientkeystore.jks deleted file mode 100644 index 51643f16d0d9..000000000000 Binary files a/integration-tests/paho-mqtt5/src/main/resources/clientkeystore.jks and /dev/null differ diff --git a/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Test.java b/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Test.java index 528c0b3ac56c..dcc9da8bdf73 100644 --- a/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Test.java +++ b/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5Test.java @@ -20,12 +20,19 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.hamcrest.core.Is.is; +@TestCertificates(certificates = { + @Certificate(name = "paho-mqtt5", formats = { + Format.PKCS12, Format.PEM }, password = PahoMqtt5Resource.KEYSTORE_PASSWORD) +}, docker = true) @QuarkusTest @QuarkusTestResource(PahoMqtt5TestResource.class) class PahoMqtt5Test { diff --git a/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5TestResource.java b/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5TestResource.java index 9bf04ab98949..ad84492a75c7 100644 --- a/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5TestResource.java +++ b/integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5TestResource.java @@ -86,9 +86,11 @@ public Map start() { .withExposedPorts(TCP_PORT, WS_PORT, SSL_PORT) .withClasspathResourceMapping("mosquitto.conf", "/mosquitto/config/mosquitto.conf", BindMode.READ_ONLY) .withClasspathResourceMapping("password.conf", "/etc/mosquitto/password", BindMode.READ_ONLY) - .withClasspathResourceMapping("certs/ca.pem", "/etc/mosquitto/certs/ca.pem", BindMode.READ_ONLY) - .withClasspathResourceMapping("certs/server.pem", "/etc/mosquitto/certs/server.pem", BindMode.READ_ONLY) - .withClasspathResourceMapping("certs/server.key", "/etc/mosquitto/certs/server.key", + .withClasspathResourceMapping("certs/paho-mqtt5-ca.crt", "/etc/mosquitto/certs/paho-mqtt5-ca.crt", + BindMode.READ_ONLY) + .withClasspathResourceMapping("certs/paho-mqtt5.crt", "/etc/mosquitto/certs/paho-mqtt5.crt", + BindMode.READ_ONLY) + .withClasspathResourceMapping("certs/paho-mqtt5.key", "/etc/mosquitto/certs/paho-mqtt5.key", BindMode.READ_ONLY); } diff --git a/integration-tests/paho-mqtt5/src/test/resources/certs/ca.key b/integration-tests/paho-mqtt5/src/test/resources/certs/ca.key deleted file mode 100644 index cd4cae6986ef..000000000000 --- a/integration-tests/paho-mqtt5/src/test/resources/certs/ca.key +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,82C51D0B8CD84E74 - -ParQZs7HrK6hAcDEY3OyqN2PAFEDwfpeV/43XYNr2b+tdG4TqnQ+liMiDPOJ3nSR -luNu9Y57N/EPtjfVPCj46fNPtuYotWwxUO1Nq9fZ8Y3JjAGE0f77bDAduMIIH6aL -oubriZ44Uav3TqBhAc7H7pdmdthuSX9wGHQ3FHWHoxS+zkTe01Lp8OYFP3aJggpR -gFfZF+S+rUKRV1AnMBV6Eytfu5magM5qTqZ10/R0VtuN3b0vlh72WhIakXnf7orG -P9/tRY3jl4z/ZB9q62FN6xlJSKZKXYdPQ8uYpK7z278ZGfoSsmLhXc5yAg4wnCxa -FmsirKvmohhDnrCEuIk47RtV7S6XbYQAcDnmwYNY5qvCDTWxaCVzxJe4WcJyHaq1 -MWj/SQn8sIQcTA0XPGh/fzJ6LLJgpWV+P9T3hgBRYUoLIGd+zxxaOd+KxOdHmvsU -sqV8v4O4KmYWKYIgaamiUHb/ahc/YKnzj9toTi3dYuZbOY6EnBvMX0+VfckGG86f -Xn+st7/ZtylJN2O1o+BKMYwqOKhZOTzzqgLZeDuHa7AyCAyBdh7+Bw5ZHVpFrUcp -ciNpNS8ywlgEibdIvBl/uIs/IL8uKvL7fZu6tsR/nbuhG/0THnhZtDILP04v75Oh -h5eN/JU8NqxuykfpP6C+KjerrR/+ExEJJ8wivEDRYF4vzY9+vjNdo7+Yh4yRSwgr -FxML9bC4CpR8zwvhhBmD6SzDvoKqM+vFnQr+g1/dFku7RCd/GeXTVK9tBJIr3974 -8BJ0j1wmJJyOaKIX+nwX/ptLiM9e9Yj7RkcOX7+V1QI9rs2f5LalXY8mulkg3tVK -axz49F7G5vV8ODLVqXoPZqZGNtEA9J84FGkfvAb2VqlAd1Bmv7Pwv/w3i5ldRxq4 -mCVY9Pm7VEi5qunV4fBHAHQNLMy899Cu/OGXEb0ZZ+JqgKnXKXyhPHBouTDI4mZ2 -81AqS0u3/11J82SCgtwICApWCpu1T9LWYt67kZ3hteI4Vy9j9d251eCArD/HoOJe -TCcfBAnNt2z2Ji0hKAqQQld3AV9800CAFifhAPb0/3KB48itNfhNHNIjFgym0puc -M8VaF5oBS2g36tay9lGEiSs9u1lojRoaFB4avL4oCdFXgAWNkrO0dtZhhj65q3HP -i0GRhCTKzQdIp6forBdMrz/oFMr117MsSdnXUd+78NKiczZMBYaoZOonmKQ1gkwe -hePqXy+QcOowPaNOdq+T7QpBX3C7tr52lnqQ26zvaspnDOkcYZZ27JjwM619JDvh -uAB7q8iySt985KKafN2rIY/5mVE7Nl/06m0lqzpd6aju5jmf8pUYcG2sdV509KQg -6ZRDZELizd2T/QwhGPKSAQBfF9CgqgWUBSeMtX1gbIShbf7hycPj1SmPMGzUUn+3 -hZ1Qtou2GdtHNQj1jSlHi8YVX7qM8tfAGDZnQ+30Dx0a03uKuieN/h6VACb9fkOI -TErii3pNuW5M/p4DPSXwW1cwQFpxs2FTZKyn7QBBPSSxymEK3mirZjFiKhtKxj/C -E64mtbZxdPH9tzO2WiqfHW1St7XmP1FshDfaQsOOMmq0l0giluc9Lg== ------END RSA PRIVATE KEY----- diff --git a/integration-tests/paho-mqtt5/src/test/resources/certs/ca.pem b/integration-tests/paho-mqtt5/src/test/resources/certs/ca.pem deleted file mode 100644 index bc257a93eb68..000000000000 --- a/integration-tests/paho-mqtt5/src/test/resources/certs/ca.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDqzCCApOgAwIBAgIUU/uMzfEhx21GXTOErSxGfoqt7qUwDQYJKoZIhvcNAQEL -BQAwZTELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxFTATBgNVBAcMDERl -ZmF1bHQgQ2l0eTEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEPMA0GA1UE -AwwGdGVzdENBMB4XDTIyMDQwMTA1NDEwMloXDTI3MDMzMTA1NDEwMlowZTELMAkG -A1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxFTATBgNVBAcMDERlZmF1bHQgQ2l0 -eTEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEPMA0GA1UEAwwGdGVzdENB -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyfqvVSox1n+5OBhCZC1C -OKpLVKEIalvxOQ5ezDcAeqUXfNJloP+7YeAylpOEiuxVlCvy4UScxUb98isr8Q0W -3hNIc1O/FNJfnOPEJoaJCGb0Uq0Mq4CaZonkN8/2nolPIC8yg2b2/mIa4ZJhH94x -KNzSiKfBMEqv8f3iGi8RhHrcMZAMosbIWZ1fIRhciJDa1xvsSFZz/gOq/D+YC/ST -MjgTm7q1HXugHDtTFNw0XO3iY7co13fZBJjGu8AqW1K8CFZEBoJlsTByvkkEYzf4 -OMjwKO6v9dc4spRY32v7Nt8zrTz4Hg4g2QrvJWacYfi3eHkoMTdJFMVGE6COo3dS -VwIDAQABo1MwUTAdBgNVHQ4EFgQUbkVV4nft2UZ3SqcaZqftJFleKtIwHwYDVR0j -BBgwFoAUbkVV4nft2UZ3SqcaZqftJFleKtIwDwYDVR0TAQH/BAUwAwEB/zANBgkq -hkiG9w0BAQsFAAOCAQEAVnGMYzl1xX5UHSTpGwpu+twd0GntIw8eSBZkLHp2GJdG -Xh1uozTq9UTwT7F/2zCcOFhCzTZi18cK0sHBb53yS6gK5HEarZvUyqFqmXNljJxi -I2sw640O1rAygM6lpth5Kt7038lr5MgFccU0/2AKbQUyW7tUwupf4nQACh+1xQ3J -m+jF050eJQTtApnRuUU+XF7ITYPANJPofa9rrfbP76LQk94De3PJP5Ijll+bgjs/ -7H1hm5PFaTF3zj86i77O7Ru63T8BajolosVVWcUSmtxa/zMRLNVSLncQd40bRl1i -mxfKR5assb31p+U/c1NH5yLtburJcB3GPyMdsmeO0w== ------END CERTIFICATE----- diff --git a/integration-tests/paho-mqtt5/src/test/resources/certs/server.key b/integration-tests/paho-mqtt5/src/test/resources/certs/server.key deleted file mode 100644 index 4dd056694e67..000000000000 --- a/integration-tests/paho-mqtt5/src/test/resources/certs/server.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAw/UF6GOP/oy8vlzPzgRdtaoLeYnGW+DGYnbdv3qY4LWpI+BE -MqprVUC69jvgNzwgRXmudx1DM68u1HWvXR7yA2hHPJqshlPplqeRarX7i9QwrdTg -FimEuw3BKeYjgqE9ddtYyDTcVF6mncRB6t4S9VrkuVBlIukt0lfZVs2JuaNKpRpc -/mQ04DcdA8QrEXTPDzpirCTC61p2OsyldhmkbvS9UpV4ur6lkCS4KJ8VZLGdJeSk -TGI7qOe6WJS859ukmgZjnaHuEcFzLcb0ywDubsO1q+dNaKyD8ju3GFJi2LnFKwlk -N7w+b/zq8XmAIKvp6q2AvG/jpgmVmSSrKfwSsQIDAQABAoIBAQCr/4Fz/RAC6h0x -Kd3sgsCOF/eCcn/9XUpEWvlAfKd7dXhE2TCDGDql1e9E+kFPuiLJWIjeXH0D/Jwq -ODH4lpTukLUWaN1N+pFpfyOQerOUhGdF7TfTvBWY6fXGhQ5eNpDvxdwjvuI12+57 -RCxnrw0M9v8T+ZEMF4f0vM8z9a0Rls097a246yAn040SjMJm4+FKWLB2/KXvh/nl -xOFk81TKl6f7/Sx+GKCOSLasdAwp5G/8uyzNH0i2q9yPkw/OR3QutntBphBq+RGH -pEBwshQNOwAwKlkIYiYv+KEZiL3JAZdPiV5p9HOIKtaIjzGZOFJqv/fZJLJDJZHu -FUwO8u1RAoGBAOVX6rW8Nnf3jh1ZqZu6Qr2bHT8p41k57m5airBqlqzFZesSwErO -X2utli11j+thZSuFG+pH70MTH2f3Me4AhOVO2wrllzo8ygjymjTWYm0217g5dYWy -NLqhRlD2FEKdXpfTIUYc52cbYEG4/q9L2MKBws/S6cKJZN5le8LsNrVHAoGBANq7 -s4JGEsgzEhx1IwdygqdZHkiE4plmT1i4ufogw1jLl4hN8ajF6pAHuF7ZiJDlQ+QR -M+tFrC0XEg7c23M9LgrnXRMUbKvjTsN3OnTZCKZ/U7Gimnfu4j6Lwu13l3AZLjWv -6cOx+B3bO31caa5rbsrCJNYTiFJQtn6Kuq5eR9RHAoGANbS/1u0LSE6lbgQYLsqQ -ZHxVffweLD/fsOHtBmD/hdf4BPNwKlRnjfypZV3ZZQJ6wZU7M0LDKc7plNwTSiu+ -8z/jFYssPcwMd8nwCJ2HkRG9tHtoJPXVWTr5D26A0hSuGRms+hE8sy16/gkHQx+c -0/e1GhvG9/Jat6XGNKBCM3MCgYB9jVRCqNpLFBWHRC1xLueUC3F4it5O0w0kjhQi -YQAATgyS7rqR99jmB6hquU7MbO0FUmKM35cu4pk48sj8Yte05ozkUMr39yfUxvFE -9PckKt3tjro/sV0oLa0cBZNlgu6lXm4+KD+VU6vYD12SApS7yai/QML1DONTy2nQ -gMmWLQKBgA3Nb5bFkb6NPHtb7JhJLB2/veuhOGN3yEEs1GFjLF5sgR8Fq+R84tWM -tGE9mqHGkhvrTlgAdY8DRZjcBg0VimUnXNCRn5wXmhcFs44zsprdr8+2Srcit6n4 -j/6HocZNXy46lBAFY7PYUYDfDSbyFRMfx3l34lV+tc9iM8HaWfev ------END RSA PRIVATE KEY----- diff --git a/integration-tests/paho-mqtt5/src/test/resources/certs/server.pem b/integration-tests/paho-mqtt5/src/test/resources/certs/server.pem deleted file mode 100644 index ddad4073b4c0..000000000000 --- a/integration-tests/paho-mqtt5/src/test/resources/certs/server.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDVDCCAjwCFD0B2OCkiJZYwb3trDFCX7mQ9wc1MA0GCSqGSIb3DQEBCwUAMGUx -CzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdCZWlqaW5nMRUwEwYDVQQHDAxEZWZhdWx0 -IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxDzANBgNVBAMMBnRl -c3RDQTAeFw0yMjA0MDExMTQwMTBaFw0zMjAzMjkxMTQwMTBaMGgxCzAJBgNVBAYT -AkNOMRAwDgYDVQQIDAdCZWlqaW5nMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAa -BgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxEjAQBgNVBAMMCWxvY2FsaG9zdDCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMP1Behjj/6MvL5cz84EXbWq -C3mJxlvgxmJ23b96mOC1qSPgRDKqa1VAuvY74Dc8IEV5rncdQzOvLtR1r10e8gNo -RzyarIZT6ZankWq1+4vUMK3U4BYphLsNwSnmI4KhPXXbWMg03FRepp3EQereEvVa -5LlQZSLpLdJX2VbNibmjSqUaXP5kNOA3HQPEKxF0zw86YqwkwutadjrMpXYZpG70 -vVKVeLq+pZAkuCifFWSxnSXkpExiO6jnuliUvOfbpJoGY52h7hHBcy3G9MsA7m7D -tavnTWisg/I7txhSYti5xSsJZDe8Pm/86vF5gCCr6eqtgLxv46YJlZkkqyn8ErEC -AwEAATANBgkqhkiG9w0BAQsFAAOCAQEAHFNHzAEW5x2A6dSoxopTR/SB1ffGnhfs -6mkMBFppYYCYwJyWSgnWYsBB/m2xakyCpup1mPT6AAb8NiS2c0R9dEQsEtgwwc/j -6KihqXSVBmux7pvMc6vLwGVYlHH7oAodS+ZPQUSs0wii++NzugRsHwwIdvGpUbVg -Tc8VAiDHYG7z88l/m5zWsKMQp8FK1PyhTL0eDGK8eCfuWTfM2lf7ITuAjhKXLbPY -/vHTp13/+IfuAREcl73iXm57epIgG715T6J3+jdxyqzKdkx2vkEo3dUWusu7WR73 -PsYsjXPTOI2/zUkkiVqwwIiVOLR9E332aOxeqZaqLBrYze9PHB1lPg== ------END CERTIFICATE----- diff --git a/integration-tests/paho-mqtt5/src/test/resources/mosquitto.conf b/integration-tests/paho-mqtt5/src/test/resources/mosquitto.conf index 921dc8fc2750..bbc5bc1ba952 100644 --- a/integration-tests/paho-mqtt5/src/test/resources/mosquitto.conf +++ b/integration-tests/paho-mqtt5/src/test/resources/mosquitto.conf @@ -6,9 +6,9 @@ protocol mqtt listener 8883 protocol mqtt -cafile /etc/mosquitto/certs/ca.pem -certfile /etc/mosquitto/certs/server.pem -keyfile /etc/mosquitto/certs/server.key +cafile /etc/mosquitto/certs/paho-mqtt5-ca.crt +certfile /etc/mosquitto/certs/paho-mqtt5.crt +keyfile /etc/mosquitto/certs/paho-mqtt5.key listener 9001 protocol websockets diff --git a/integration-tests/paho/pom.xml b/integration-tests/paho/pom.xml index b01412990ced..31b9b664f2b7 100644 --- a/integration-tests/paho/pom.xml +++ b/integration-tests/paho/pom.xml @@ -56,6 +56,11 @@ camel-quarkus-integration-tests-support-activemq test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java index 8250e0141eb0..9c0efbf7f951 100644 --- a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java +++ b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java @@ -57,8 +57,8 @@ public class PahoResource { @Inject ConsumerTemplate consumerTemplate; - private static final String KEYSTORE_FILE = "clientkeystore.jks"; - private static final String KEYSTORE_PASSWORD = "quarkus"; + private static final String KEYSTORE_FILE = "certs/paho-keystore.p12"; + public static final String KEYSTORE_PASSWORD = "quarkus"; @Path("/{protocol}/{queueName}") @GET @@ -176,7 +176,7 @@ private String sslOptions(java.nio.file.Path keyStore) { private java.nio.file.Path copyKeyStore() { java.nio.file.Path tmpKeystore = null; try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(KEYSTORE_FILE);) { - tmpKeystore = Files.createTempFile("keystore-", ".jks"); + tmpKeystore = Files.createTempFile("keystore-", ".p12"); Files.copy(in, tmpKeystore, StandardCopyOption.REPLACE_EXISTING); return tmpKeystore; } catch (Exception e) { diff --git a/integration-tests/paho/src/main/resources/application.properties b/integration-tests/paho/src/main/resources/application.properties index cc4b9d1c894c..403573f99305 100644 --- a/integration-tests/paho/src/main/resources/application.properties +++ b/integration-tests/paho/src/main/resources/application.properties @@ -14,4 +14,4 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.native.resources.includes=*.jks \ No newline at end of file +quarkus.native.resources.includes=certs/*.p12 \ No newline at end of file diff --git a/integration-tests/paho/src/main/resources/clientkeystore.jks b/integration-tests/paho/src/main/resources/clientkeystore.jks deleted file mode 100644 index 51643f16d0d9..000000000000 Binary files a/integration-tests/paho/src/main/resources/clientkeystore.jks and /dev/null differ diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java index 7da88ec23b91..bab923dedcbf 100644 --- a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java +++ b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java @@ -20,6 +20,10 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.component.paho.PahoResource; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -27,6 +31,10 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.core.StringRegularExpression.matchesRegex; +@TestCertificates(certificates = { + @Certificate(name = "paho", formats = { + Format.PKCS12, Format.PEM }, password = PahoResource.KEYSTORE_PASSWORD) +}, docker = true) @QuarkusTest @QuarkusTestResource(PahoTestResource.class) class PahoTest { diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java index 1070489fc3bb..5019578c084e 100644 --- a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java +++ b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java @@ -21,7 +21,6 @@ import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; import org.apache.camel.util.CollectionHelper; -import org.eclipse.microprofile.config.ConfigProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.containers.BindMode; @@ -32,7 +31,8 @@ public class PahoTestResource implements QuarkusTestResourceLifecycleManager { private static final Logger LOGGER = LoggerFactory.getLogger(PahoTestResource.class); - private static final String IMAGE = ConfigProvider.getConfig().getValue("eclipse-mosquitto.container.image", String.class); + // private static final String IMAGE = ConfigProvider.getConfig().getValue("eclipse-mosquitto.container.image", String.class); + private static final String IMAGE = "docker.io/eclipse-mosquitto:2.0.18"; private static final int TCP_PORT = 1883; private static final int SSL_PORT = 8883; private static final int WS_PORT = 9001; @@ -51,10 +51,9 @@ public Map start() { container = new GenericContainer<>(IMAGE).withExposedPorts(TCP_PORT, WS_PORT, SSL_PORT) .withClasspathResourceMapping("mosquitto.conf", "/mosquitto/config/mosquitto.conf", BindMode.READ_ONLY) .withClasspathResourceMapping("password.conf", "/etc/mosquitto/password", BindMode.READ_ONLY) - .withClasspathResourceMapping("certs/ca.pem", "/etc/mosquitto/certs/ca.pem", BindMode.READ_ONLY) - .withClasspathResourceMapping("certs/server.pem", "/etc/mosquitto/certs/server.pem", BindMode.READ_ONLY) - .withClasspathResourceMapping("certs/server.key", "/etc/mosquitto/certs/server.key", BindMode.READ_ONLY); - + .withClasspathResourceMapping("certs/paho-ca.crt", "/etc/mosquitto/certs/paho-ca.crt", BindMode.READ_ONLY) + .withClasspathResourceMapping("certs/paho.crt", "/etc/mosquitto/certs/paho.crt", BindMode.READ_ONLY) + .withClasspathResourceMapping("certs/paho.key", "/etc/mosquitto/certs/paho.key", BindMode.READ_ONLY); container.withLogConsumer(new Slf4jLogConsumer(LOGGER)) .waitingFor(Wait.forLogMessage(".* mosquitto version .* running", 1)).waitingFor(Wait.forListeningPort()); diff --git a/integration-tests/paho/src/test/resources/certs/ca.key b/integration-tests/paho/src/test/resources/certs/ca.key deleted file mode 100644 index cd4cae6986ef..000000000000 --- a/integration-tests/paho/src/test/resources/certs/ca.key +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,82C51D0B8CD84E74 - -ParQZs7HrK6hAcDEY3OyqN2PAFEDwfpeV/43XYNr2b+tdG4TqnQ+liMiDPOJ3nSR -luNu9Y57N/EPtjfVPCj46fNPtuYotWwxUO1Nq9fZ8Y3JjAGE0f77bDAduMIIH6aL -oubriZ44Uav3TqBhAc7H7pdmdthuSX9wGHQ3FHWHoxS+zkTe01Lp8OYFP3aJggpR -gFfZF+S+rUKRV1AnMBV6Eytfu5magM5qTqZ10/R0VtuN3b0vlh72WhIakXnf7orG -P9/tRY3jl4z/ZB9q62FN6xlJSKZKXYdPQ8uYpK7z278ZGfoSsmLhXc5yAg4wnCxa -FmsirKvmohhDnrCEuIk47RtV7S6XbYQAcDnmwYNY5qvCDTWxaCVzxJe4WcJyHaq1 -MWj/SQn8sIQcTA0XPGh/fzJ6LLJgpWV+P9T3hgBRYUoLIGd+zxxaOd+KxOdHmvsU -sqV8v4O4KmYWKYIgaamiUHb/ahc/YKnzj9toTi3dYuZbOY6EnBvMX0+VfckGG86f -Xn+st7/ZtylJN2O1o+BKMYwqOKhZOTzzqgLZeDuHa7AyCAyBdh7+Bw5ZHVpFrUcp -ciNpNS8ywlgEibdIvBl/uIs/IL8uKvL7fZu6tsR/nbuhG/0THnhZtDILP04v75Oh -h5eN/JU8NqxuykfpP6C+KjerrR/+ExEJJ8wivEDRYF4vzY9+vjNdo7+Yh4yRSwgr -FxML9bC4CpR8zwvhhBmD6SzDvoKqM+vFnQr+g1/dFku7RCd/GeXTVK9tBJIr3974 -8BJ0j1wmJJyOaKIX+nwX/ptLiM9e9Yj7RkcOX7+V1QI9rs2f5LalXY8mulkg3tVK -axz49F7G5vV8ODLVqXoPZqZGNtEA9J84FGkfvAb2VqlAd1Bmv7Pwv/w3i5ldRxq4 -mCVY9Pm7VEi5qunV4fBHAHQNLMy899Cu/OGXEb0ZZ+JqgKnXKXyhPHBouTDI4mZ2 -81AqS0u3/11J82SCgtwICApWCpu1T9LWYt67kZ3hteI4Vy9j9d251eCArD/HoOJe -TCcfBAnNt2z2Ji0hKAqQQld3AV9800CAFifhAPb0/3KB48itNfhNHNIjFgym0puc -M8VaF5oBS2g36tay9lGEiSs9u1lojRoaFB4avL4oCdFXgAWNkrO0dtZhhj65q3HP -i0GRhCTKzQdIp6forBdMrz/oFMr117MsSdnXUd+78NKiczZMBYaoZOonmKQ1gkwe -hePqXy+QcOowPaNOdq+T7QpBX3C7tr52lnqQ26zvaspnDOkcYZZ27JjwM619JDvh -uAB7q8iySt985KKafN2rIY/5mVE7Nl/06m0lqzpd6aju5jmf8pUYcG2sdV509KQg -6ZRDZELizd2T/QwhGPKSAQBfF9CgqgWUBSeMtX1gbIShbf7hycPj1SmPMGzUUn+3 -hZ1Qtou2GdtHNQj1jSlHi8YVX7qM8tfAGDZnQ+30Dx0a03uKuieN/h6VACb9fkOI -TErii3pNuW5M/p4DPSXwW1cwQFpxs2FTZKyn7QBBPSSxymEK3mirZjFiKhtKxj/C -E64mtbZxdPH9tzO2WiqfHW1St7XmP1FshDfaQsOOMmq0l0giluc9Lg== ------END RSA PRIVATE KEY----- diff --git a/integration-tests/paho/src/test/resources/certs/ca.pem b/integration-tests/paho/src/test/resources/certs/ca.pem deleted file mode 100644 index bc257a93eb68..000000000000 --- a/integration-tests/paho/src/test/resources/certs/ca.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDqzCCApOgAwIBAgIUU/uMzfEhx21GXTOErSxGfoqt7qUwDQYJKoZIhvcNAQEL -BQAwZTELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxFTATBgNVBAcMDERl -ZmF1bHQgQ2l0eTEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEPMA0GA1UE -AwwGdGVzdENBMB4XDTIyMDQwMTA1NDEwMloXDTI3MDMzMTA1NDEwMlowZTELMAkG -A1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxFTATBgNVBAcMDERlZmF1bHQgQ2l0 -eTEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEPMA0GA1UEAwwGdGVzdENB -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyfqvVSox1n+5OBhCZC1C -OKpLVKEIalvxOQ5ezDcAeqUXfNJloP+7YeAylpOEiuxVlCvy4UScxUb98isr8Q0W -3hNIc1O/FNJfnOPEJoaJCGb0Uq0Mq4CaZonkN8/2nolPIC8yg2b2/mIa4ZJhH94x -KNzSiKfBMEqv8f3iGi8RhHrcMZAMosbIWZ1fIRhciJDa1xvsSFZz/gOq/D+YC/ST -MjgTm7q1HXugHDtTFNw0XO3iY7co13fZBJjGu8AqW1K8CFZEBoJlsTByvkkEYzf4 -OMjwKO6v9dc4spRY32v7Nt8zrTz4Hg4g2QrvJWacYfi3eHkoMTdJFMVGE6COo3dS -VwIDAQABo1MwUTAdBgNVHQ4EFgQUbkVV4nft2UZ3SqcaZqftJFleKtIwHwYDVR0j -BBgwFoAUbkVV4nft2UZ3SqcaZqftJFleKtIwDwYDVR0TAQH/BAUwAwEB/zANBgkq -hkiG9w0BAQsFAAOCAQEAVnGMYzl1xX5UHSTpGwpu+twd0GntIw8eSBZkLHp2GJdG -Xh1uozTq9UTwT7F/2zCcOFhCzTZi18cK0sHBb53yS6gK5HEarZvUyqFqmXNljJxi -I2sw640O1rAygM6lpth5Kt7038lr5MgFccU0/2AKbQUyW7tUwupf4nQACh+1xQ3J -m+jF050eJQTtApnRuUU+XF7ITYPANJPofa9rrfbP76LQk94De3PJP5Ijll+bgjs/ -7H1hm5PFaTF3zj86i77O7Ru63T8BajolosVVWcUSmtxa/zMRLNVSLncQd40bRl1i -mxfKR5assb31p+U/c1NH5yLtburJcB3GPyMdsmeO0w== ------END CERTIFICATE----- diff --git a/integration-tests/paho/src/test/resources/certs/server.key b/integration-tests/paho/src/test/resources/certs/server.key deleted file mode 100644 index 4dd056694e67..000000000000 --- a/integration-tests/paho/src/test/resources/certs/server.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAw/UF6GOP/oy8vlzPzgRdtaoLeYnGW+DGYnbdv3qY4LWpI+BE -MqprVUC69jvgNzwgRXmudx1DM68u1HWvXR7yA2hHPJqshlPplqeRarX7i9QwrdTg -FimEuw3BKeYjgqE9ddtYyDTcVF6mncRB6t4S9VrkuVBlIukt0lfZVs2JuaNKpRpc -/mQ04DcdA8QrEXTPDzpirCTC61p2OsyldhmkbvS9UpV4ur6lkCS4KJ8VZLGdJeSk -TGI7qOe6WJS859ukmgZjnaHuEcFzLcb0ywDubsO1q+dNaKyD8ju3GFJi2LnFKwlk -N7w+b/zq8XmAIKvp6q2AvG/jpgmVmSSrKfwSsQIDAQABAoIBAQCr/4Fz/RAC6h0x -Kd3sgsCOF/eCcn/9XUpEWvlAfKd7dXhE2TCDGDql1e9E+kFPuiLJWIjeXH0D/Jwq -ODH4lpTukLUWaN1N+pFpfyOQerOUhGdF7TfTvBWY6fXGhQ5eNpDvxdwjvuI12+57 -RCxnrw0M9v8T+ZEMF4f0vM8z9a0Rls097a246yAn040SjMJm4+FKWLB2/KXvh/nl -xOFk81TKl6f7/Sx+GKCOSLasdAwp5G/8uyzNH0i2q9yPkw/OR3QutntBphBq+RGH -pEBwshQNOwAwKlkIYiYv+KEZiL3JAZdPiV5p9HOIKtaIjzGZOFJqv/fZJLJDJZHu -FUwO8u1RAoGBAOVX6rW8Nnf3jh1ZqZu6Qr2bHT8p41k57m5airBqlqzFZesSwErO -X2utli11j+thZSuFG+pH70MTH2f3Me4AhOVO2wrllzo8ygjymjTWYm0217g5dYWy -NLqhRlD2FEKdXpfTIUYc52cbYEG4/q9L2MKBws/S6cKJZN5le8LsNrVHAoGBANq7 -s4JGEsgzEhx1IwdygqdZHkiE4plmT1i4ufogw1jLl4hN8ajF6pAHuF7ZiJDlQ+QR -M+tFrC0XEg7c23M9LgrnXRMUbKvjTsN3OnTZCKZ/U7Gimnfu4j6Lwu13l3AZLjWv -6cOx+B3bO31caa5rbsrCJNYTiFJQtn6Kuq5eR9RHAoGANbS/1u0LSE6lbgQYLsqQ -ZHxVffweLD/fsOHtBmD/hdf4BPNwKlRnjfypZV3ZZQJ6wZU7M0LDKc7plNwTSiu+ -8z/jFYssPcwMd8nwCJ2HkRG9tHtoJPXVWTr5D26A0hSuGRms+hE8sy16/gkHQx+c -0/e1GhvG9/Jat6XGNKBCM3MCgYB9jVRCqNpLFBWHRC1xLueUC3F4it5O0w0kjhQi -YQAATgyS7rqR99jmB6hquU7MbO0FUmKM35cu4pk48sj8Yte05ozkUMr39yfUxvFE -9PckKt3tjro/sV0oLa0cBZNlgu6lXm4+KD+VU6vYD12SApS7yai/QML1DONTy2nQ -gMmWLQKBgA3Nb5bFkb6NPHtb7JhJLB2/veuhOGN3yEEs1GFjLF5sgR8Fq+R84tWM -tGE9mqHGkhvrTlgAdY8DRZjcBg0VimUnXNCRn5wXmhcFs44zsprdr8+2Srcit6n4 -j/6HocZNXy46lBAFY7PYUYDfDSbyFRMfx3l34lV+tc9iM8HaWfev ------END RSA PRIVATE KEY----- diff --git a/integration-tests/paho/src/test/resources/certs/server.pem b/integration-tests/paho/src/test/resources/certs/server.pem deleted file mode 100644 index ddad4073b4c0..000000000000 --- a/integration-tests/paho/src/test/resources/certs/server.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDVDCCAjwCFD0B2OCkiJZYwb3trDFCX7mQ9wc1MA0GCSqGSIb3DQEBCwUAMGUx -CzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdCZWlqaW5nMRUwEwYDVQQHDAxEZWZhdWx0 -IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxDzANBgNVBAMMBnRl -c3RDQTAeFw0yMjA0MDExMTQwMTBaFw0zMjAzMjkxMTQwMTBaMGgxCzAJBgNVBAYT -AkNOMRAwDgYDVQQIDAdCZWlqaW5nMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAa -BgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxEjAQBgNVBAMMCWxvY2FsaG9zdDCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMP1Behjj/6MvL5cz84EXbWq -C3mJxlvgxmJ23b96mOC1qSPgRDKqa1VAuvY74Dc8IEV5rncdQzOvLtR1r10e8gNo -RzyarIZT6ZankWq1+4vUMK3U4BYphLsNwSnmI4KhPXXbWMg03FRepp3EQereEvVa -5LlQZSLpLdJX2VbNibmjSqUaXP5kNOA3HQPEKxF0zw86YqwkwutadjrMpXYZpG70 -vVKVeLq+pZAkuCifFWSxnSXkpExiO6jnuliUvOfbpJoGY52h7hHBcy3G9MsA7m7D -tavnTWisg/I7txhSYti5xSsJZDe8Pm/86vF5gCCr6eqtgLxv46YJlZkkqyn8ErEC -AwEAATANBgkqhkiG9w0BAQsFAAOCAQEAHFNHzAEW5x2A6dSoxopTR/SB1ffGnhfs -6mkMBFppYYCYwJyWSgnWYsBB/m2xakyCpup1mPT6AAb8NiS2c0R9dEQsEtgwwc/j -6KihqXSVBmux7pvMc6vLwGVYlHH7oAodS+ZPQUSs0wii++NzugRsHwwIdvGpUbVg -Tc8VAiDHYG7z88l/m5zWsKMQp8FK1PyhTL0eDGK8eCfuWTfM2lf7ITuAjhKXLbPY -/vHTp13/+IfuAREcl73iXm57epIgG715T6J3+jdxyqzKdkx2vkEo3dUWusu7WR73 -PsYsjXPTOI2/zUkkiVqwwIiVOLR9E332aOxeqZaqLBrYze9PHB1lPg== ------END CERTIFICATE----- diff --git a/integration-tests/paho/src/test/resources/mosquitto.conf b/integration-tests/paho/src/test/resources/mosquitto.conf index 921dc8fc2750..8cdd3ea091f9 100644 --- a/integration-tests/paho/src/test/resources/mosquitto.conf +++ b/integration-tests/paho/src/test/resources/mosquitto.conf @@ -6,9 +6,9 @@ protocol mqtt listener 8883 protocol mqtt -cafile /etc/mosquitto/certs/ca.pem -certfile /etc/mosquitto/certs/server.pem -keyfile /etc/mosquitto/certs/server.key +cafile /etc/mosquitto/certs/paho-ca.crt +certfile /etc/mosquitto/certs/paho.crt +keyfile /etc/mosquitto/certs/paho.key listener 9001 protocol websockets diff --git a/integration-tests/platform-http-proxy-ssl/pom.xml b/integration-tests/platform-http-proxy-ssl/pom.xml index aaf739a00c62..b1d9ee0e37c5 100644 --- a/integration-tests/platform-http-proxy-ssl/pom.xml +++ b/integration-tests/platform-http-proxy-ssl/pom.xml @@ -63,6 +63,11 @@ org.apache.camel.quarkus camel-quarkus-integration-wiremock-support + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java b/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java index 085e80ec5a1e..1af4f020a78d 100644 --- a/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java +++ b/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java @@ -44,13 +44,13 @@ public SSLContextParameters sslContextParameters() { KeyManagersParameters keyManagersParameters = new KeyManagersParameters(); KeyStoreParameters keyStore = new KeyStoreParameters(); keyStore.setPassword("changeit"); - keyStore.setResource("ssl/keystore.p12"); + keyStore.setResource("certs/proxy-ssl-keystore.p12"); keyManagersParameters.setKeyPassword("changeit"); keyManagersParameters.setKeyStore(keyStore); sslContextParameters.setKeyManagers(keyManagersParameters); KeyStoreParameters truststoreParameters = new KeyStoreParameters(); - truststoreParameters.setResource("ssl/keystore.p12"); + truststoreParameters.setResource("certs/proxy-ssl-keystore.p12"); truststoreParameters.setPassword("changeit"); TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); diff --git a/integration-tests/platform-http-proxy-ssl/src/main/resources/application.properties b/integration-tests/platform-http-proxy-ssl/src/main/resources/application.properties index bdb7e92643bc..d71d52239c8a 100644 --- a/integration-tests/platform-http-proxy-ssl/src/main/resources/application.properties +++ b/integration-tests/platform-http-proxy-ssl/src/main/resources/application.properties @@ -16,4 +16,4 @@ ## --------------------------------------------------------------------------- -quarkus.native.resources.includes=ssl/keystore.p12 \ No newline at end of file +quarkus.native.resources.includes=certs/proxy-ssl-keystore.p12 \ No newline at end of file diff --git a/integration-tests/platform-http-proxy-ssl/src/main/resources/ssl/keystore.p12 b/integration-tests/platform-http-proxy-ssl/src/main/resources/ssl/keystore.p12 deleted file mode 100644 index fadac3cb35b5..000000000000 Binary files a/integration-tests/platform-http-proxy-ssl/src/main/resources/ssl/keystore.p12 and /dev/null differ diff --git a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java index 27b0fa00b53d..1430e3e553bf 100644 --- a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java +++ b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java @@ -50,7 +50,7 @@ protected void customizeWiremockConfiguration(WireMockConfiguration config) { // add an SSL port config.dynamicHttpsPort(); // Either a path to a file or a resource on the classpath - config.keystorePath("ssl/keystore.p12"); + config.keystorePath("certs/proxy-ssl-keystore.p12"); // The password used to access the keystore. Defaults to "password" if omitted config.keystorePassword("changeit"); // The password used to access individual keys in the keystore. Defaults to "password" if omitted diff --git a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java index 8df99de9cfcc..3faa5e4b7ab2 100644 --- a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java +++ b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java @@ -20,11 +20,17 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.equalTo; +@TestCertificates(certificates = { + @Certificate(name = "proxy-ssl", formats = { + Format.PKCS12 }, password = "changeit") }) @QuarkusTest @QuarkusTestResource(PlatformHttpSSLTestResource.class) public class ProxySslTest { diff --git a/integration-tests/platform-http/README.adoc b/integration-tests/platform-http/README.adoc deleted file mode 100644 index 9ef992cbb2ac..000000000000 --- a/integration-tests/platform-http/README.adoc +++ /dev/null @@ -1,37 +0,0 @@ -# Generating server SSL certificates and trust store - -* The CA is self-signed: - -When prompted for certificate information, everything is default. -``` -$ openssl genrsa -out ca.key 2048 -$ openssl req -x509 -new -key ca.key -nodes -out ca.pem -config ca-openssl.cnf -days 3650 -extensions v3_req -``` - -* Server certificate issued by CA: - -``` -$ openssl genrsa -out server.key.rsa 2048 -$ openssl pkcs8 -topk8 -in server.key.rsa -out server.key -nocrypt -$ rm server.key.rsa -``` - -When prompted for certificate information, everything is default except the common name which is set to _localhost_ for simple testing. -``` -$ openssl req -new -key server.key -out server.csr -$ openssl x509 -req -in server.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out server.pem -outform PEM -days 5000 -``` - -* Rename files - -``` -$ mv server.pem server-cert.pem -$ mv server.key server-key.pem -``` - -* Generate the PKCS12 trust store - -When prompted for a password, the value is _s3cr3t_. -``` -$ keytool -import -file server-cert.pem -alias server -keystore truststore.p12 -``` diff --git a/integration-tests/platform-http/ca-openssl.cnf b/integration-tests/platform-http/ca-openssl.cnf deleted file mode 100644 index e15866b281ea..000000000000 --- a/integration-tests/platform-http/ca-openssl.cnf +++ /dev/null @@ -1,18 +0,0 @@ -[req] -distinguished_name = req_distinguished_name -req_extensions = v3_req - -[req_distinguished_name] -countryName = Country Name (2 letter code) -countryName_default = AU -stateOrProvinceName = State or Province Name (full name) -stateOrProvinceName_default = Some-State -organizationName = Organization Name (eg, company) -organizationName_default = Internet Widgits Pty Ltd -commonName = Common Name (eg, YOUR name) -commonName_default = testca - -[v3_req] -basicConstraints = CA:true -keyUsage = critical, keyCertSign - diff --git a/integration-tests/platform-http/pom.xml b/integration-tests/platform-http/pom.xml index c77802c8b5e9..5dcb45b918b1 100644 --- a/integration-tests/platform-http/pom.xml +++ b/integration-tests/platform-http/pom.xml @@ -76,6 +76,11 @@ assertj-core test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/platform-http/src/main/resources/application.properties b/integration-tests/platform-http/src/main/resources/application.properties index 91b7768f8fa5..77e7fdcaa67f 100644 --- a/integration-tests/platform-http/src/main/resources/application.properties +++ b/integration-tests/platform-http/src/main/resources/application.properties @@ -18,8 +18,8 @@ # Quarkus # quarkus.http.body.uploads-directory=target/uploads -quarkus.http.ssl.certificate.files=server-cert.pem -quarkus.http.ssl.certificate.key-files=server-key.pem +quarkus.http.ssl.certificate.files=certs/platform-http.crt +quarkus.http.ssl.certificate.key-files=certs/platform-http.key quarkus.http.insecure-requests=disabled quarkus.http.auth.basic=true quarkus.http.auth.permission.default.paths=/platform-http/secure/basic @@ -32,4 +32,4 @@ quarkus.security.users.embedded.roles.camel=Admin # Required by the encoding() test quarkus.native.add-all-charsets = true -quarkus.native.resources.includes = *.pem +quarkus.native.resources.includes = certs/*.crt,certs/*.key diff --git a/integration-tests/platform-http/src/main/resources/server-cert.pem b/integration-tests/platform-http/src/main/resources/server-cert.pem deleted file mode 100644 index 4f6fb1f40000..000000000000 --- a/integration-tests/platform-http/src/main/resources/server-cert.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDMzCCAhsCFDB5CEpzuIQrToqmWRvTo5C5HpflMA0GCSqGSIb3DQEBCwUAMFYx -CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl -cm5ldCBXaWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBnRlc3RjYTAeFw0yMzEwMzEx -MjE0NThaFw0zNzA3MDkxMjE0NThaMFYxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxE -ZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxEjAQBgNV -BAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL8q -ewu3nW28mp4YZ0ZDM5vhkwiduCOkUcq6EwUFwetlp4plmdf/dm9CTLw/ue/Gkyz8 -h7MPgFkNc3l0wKfubuwt77ATMmzhvOIoTh1hNr+ZdfUGGtxXtU4yEQCYd8XvihbG -DYERu7WnMoVMqxixhc02iSvlmSATpDUGQ5awVOLvvpKa4k0EoZtqvE5Xx7SkyJHo -80OUK6gXM1Qe3naC2yX6vdYBq8vO9AB+19pC4Hla/9+RlRhcmhZsUvSxuZzqaQT0 -CETve10PFw9YvY2K1fchw0iiuvVP1TKcjOledrFO36kp8dXdh0oiAR2fonSyq9pS -0FdBKlwzmd7XOirEjZ8CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAvrpKOKpz6YEw -AqvXGMohjaTxEDW1CyeDCmAmjo4VqPR3nTBjslXbhJgwu8YK/qnUL2WEVXh0cUiI -gMp4/6UxeH29wMSnK20hIocqjiR3suaV/pNJ4bsl9yNbImtsHZ9Y6kCizsSQ+Qt+ -b3OX1ycwPDcvR2DTxLKO6G0AShFXKvqdPNORGMap6n5kZgjGEwIdrnvWB9zF/uO+ -g/GYF9FCO78LOzfcACqJ09cuhve1KJreorMTTC5ps5YUOkE8K4xpmq7MM6W15vAK -gPyb7sQMuD5n6ZlMHlJKF+EoXCid2Rc2llU96YO0tuDoJMjbVwUupI1emfqRPDvQ -EfYwoInX3A== ------END CERTIFICATE----- diff --git a/integration-tests/platform-http/src/main/resources/server-key.pem b/integration-tests/platform-http/src/main/resources/server-key.pem deleted file mode 100644 index e937e3a27524..000000000000 --- a/integration-tests/platform-http/src/main/resources/server-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQC/KnsLt51tvJqe -GGdGQzOb4ZMInbgjpFHKuhMFBcHrZaeKZZnX/3ZvQky8P7nvxpMs/IezD4BZDXN5 -dMCn7m7sLe+wEzJs4bziKE4dYTa/mXX1BhrcV7VOMhEAmHfF74oWxg2BEbu1pzKF -TKsYsYXNNokr5ZkgE6Q1BkOWsFTi776SmuJNBKGbarxOV8e0pMiR6PNDlCuoFzNU -Ht52gtsl+r3WAavLzvQAftfaQuB5Wv/fkZUYXJoWbFL0sbmc6mkE9AhE73tdDxcP -WL2NitX3IcNIorr1T9UynIzpXnaxTt+pKfHV3YdKIgEdn6J0sqvaUtBXQSpcM5ne -1zoqxI2fAgMBAAECggEBAIh5SFzGGgLUqcGCBICZy0dW1ARLrMDtN2M2Ugu834Mx -EFnyTNFyVFf7ihK+n/x41GtCYZJI18U7oBuuaTe6NcAwzzPxkIdA5PrD8XhyBYbl -hNuHHzf8+be4cIDvWFqbtwapH8zsHwkBM0UMxf0cBzzI2UbYY+gNfaZJMYlrmz5i -0UJPPSWjT1IA1oq7mXGBAhgnNsJKxdZHgjoP3wYO/V1216PGdIS2Ufb+ZBOvN+xw -aZctrSwzVQw/0a4E+gKhLT24a6cCu4sANMQ/+KF0SJYLXEgDWfXGVLRX6hl2oHIG -mLXzzjxG8wIVvHW9aNVYQzE4Cxa0VDUOtq0cwi9cMSkCgYEA+3IH8awVrGEX6jTX -Gd7V0MmybyhXqbC8egKxT2bHpnMJyL6Zi3moEK1z3LBcbYgavqpYTEJk3Fid+zKF -DPSP+bynPqxR+x5E2wG5FlRzBpSuTBNHTAZlcb7gBJdHbbRfXUco7umaG1fxTrx+ -cLJ84+iapErpRWAStaJYpdbV+U0CgYEAwqDt/Y2h8Jjd1E6ZLKk0+iwbOsi7io5t -0o+Z7XgKuO3FU4RbWTPqrLuCo6aA4bjuD2K9l2twM+L5sdlvqcPrDi8Sfa+rpFv8 -4vIUvaHkIWyNSjPSV6gHgt8wnwJkXwweeqBmOWGfcQo5ELwRhqmyXzyoQOQUuyLL -990pCOIjDJsCgYEAm7FsAdTQRsCIEllNp5M3SeTaO8H7JfNtgQ8Rw1yc2w/4Svja -EmbuDgWY7Fm3oYrZJJ5NtkqWMWodyGDrya3VSInr9P62dIu1jvZuKMl5v+VoV2rI -huafAeNyyuTxMZiyRAu/6M90wOGfZWWJ1TZv5p8swfYwouhuLVGtGmMAczECgYEA -us/vP7WHn8GLAvKicczELfDR/h2YbYkCft4ZOGdFm3WWNvDPIZMEiOG+pkf2YzK3 -RgtXwZR9cUBGvV/gn0mPP+EM1ZkdnjgxRsBoChDvQOnJwFR3bG27L/H84FNSdizS -wI9fL2q1uLHAToDGLcSKkoFNWmPSRkFDGFmuvnkYfUsCgYEAyg8N8Ha3WDZqaj26 -TgOQlrl3rTp77qTWWG0nNnpGYLMu/T56ED2gjAdFFR/Kl589jWUbdZBwIHLKMb1y -ctL00b+e2Rs7idV6gieQvRSkqy9VkhkKk3bU3pVmM1i0cVw1I7HDA0nh4Dv0fOiA -S8QEYnxRrnyf3KmtpWxXTOwPWPI= ------END PRIVATE KEY----- diff --git a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java index da6d35b9eca3..8e0bc4ce4455 100644 --- a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java +++ b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java @@ -23,8 +23,11 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.http.Method; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; import org.apache.camel.component.platform.http.PlatformHttpComponent; import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpEngine; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -35,12 +38,15 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.notNullValue; +@TestCertificates(certificates = { + @Certificate(name = "platform-http", formats = { + Format.PKCS12, Format.PEM }, password = "changeit") }) @QuarkusTest class PlatformHttpTest { @BeforeAll public static void beforeAll() { - RestAssured.trustStore("truststore.p12", "s3cr3t"); + RestAssured.trustStore("certs/platform-http-truststore.p12", "changeit"); } @Test diff --git a/integration-tests/platform-http/src/test/resources/truststore.p12 b/integration-tests/platform-http/src/test/resources/truststore.p12 deleted file mode 100644 index 2612d2c7be03..000000000000 Binary files a/integration-tests/platform-http/src/test/resources/truststore.p12 and /dev/null differ diff --git a/integration-tests/vertx-websocket/README.adoc b/integration-tests/vertx-websocket/README.adoc deleted file mode 100644 index a567f2ab507b..000000000000 --- a/integration-tests/vertx-websocket/README.adoc +++ /dev/null @@ -1,15 +0,0 @@ -# Generating server SSL certificates and trust store - -1. Generate the certificate keypair - -When prompted for the 'Common Name', use localhost. The other prompts can be skipped. - -``` -openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout src/main/resources/server-key.pem -out src/main/resources/server-cert.pem -``` - -2. Generate the PKCS12 trust store - -``` -cat src/main/resources/server-key.pem src/main/resources/server-cert.pem | openssl pkcs12 -export -out src/test/resources/truststore.p12 -passout pass:s3cr3t -``` diff --git a/integration-tests/vertx-websocket/pom.xml b/integration-tests/vertx-websocket/pom.xml index b77cadc0c055..b45f5db3b10d 100644 --- a/integration-tests/vertx-websocket/pom.xml +++ b/integration-tests/vertx-websocket/pom.xml @@ -68,6 +68,11 @@ awaitility test + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-certificate-generator + test + diff --git a/integration-tests/vertx-websocket/src/main/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketResource.java b/integration-tests/vertx-websocket/src/main/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketResource.java index 5789689ecf34..6ed424a61915 100644 --- a/integration-tests/vertx-websocket/src/main/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketResource.java +++ b/integration-tests/vertx-websocket/src/main/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketResource.java @@ -141,7 +141,7 @@ public Response invalidConsumerHostPort(@QueryParam("hostPort") String hostPort) @Named public SSLContextParameters clientSSLContextParameters() { KeyStoreParameters truststoreParameters = new KeyStoreParameters(); - truststoreParameters.setResource("/truststore.p12"); + truststoreParameters.setResource("/certs/vertx-websocket-truststore.p12"); truststoreParameters.setPassword("changeit"); TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); diff --git a/integration-tests/vertx-websocket/src/main/resources/application.properties b/integration-tests/vertx-websocket/src/main/resources/application.properties index 1f68f1a12661..98bf8c542278 100644 --- a/integration-tests/vertx-websocket/src/main/resources/application.properties +++ b/integration-tests/vertx-websocket/src/main/resources/application.properties @@ -15,4 +15,4 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.native.resources.includes = *.pem,*.p12 +quarkus.native.resources.includes = certs/*.key,certs/*.crt diff --git a/integration-tests/vertx-websocket/src/main/resources/server-cert.pem b/integration-tests/vertx-websocket/src/main/resources/server-cert.pem deleted file mode 100644 index d5f9ce332b20..000000000000 --- a/integration-tests/vertx-websocket/src/main/resources/server-cert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICpDCCAYwCCQDF3E7qvZcoTjANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls -b2NhbGhvc3QwHhcNMjEwOTE3MDkyODA4WhcNMzEwOTE1MDkyODA4WjAUMRIwEAYD -VQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCi -1+uq4ZcXTrY3j28k5ivqvSp9PyYhfCn6VZHB3Yk9+8Mn+QGMsUow9F4SPCTsHaOP -p0SAVVBIiQxR5ucfrxPq+6TcZaccJcDTkiM2xsZeL5t1pRVz77RrUOPvDfTuPDSV -MR2DVx/I/IZyKHYYL9JweUMHcCoAxWHWg74YiC9QLOiK55rO5Js9uz4FObf9oQee -tjN4rVhBfwl8LSysnKdbRJzeLWajwlKRUwLZIUXDDyEG5kpEZI3P/E6IfaoOxLzE -BnHa93ospIVSjgc24xgkUWkrki0LFQcooyu4kExJAO7uCjbqWjfOvoE7DOkjUslB -bJQrzTGX8Ix+IR8Bg6XpAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFRpebKqbaET -+2OcY4YGvun2e6zigc1Rd5fCHFt2CnOMAkJRrqrfRpLm71IvYp+lHGxk/fHW7Bi6 -vH66KC2sCIOjGIRF+/VL6Umwx3SPTVPilYHQ54bHSF5c4MV6pi3hPjFZyMfUY0RJ -cgltmEMxIXtGU088jurqEsXHeBS5iOCNItVOjanUv9C2bl4dyMwwJDa7jkbHLII6 -VxrohPSdVSqVPRJisH6we7/txquEbtnW4YnrGFvNvhR4PJPJlyVfMQi904vxdxqq -XSaaBHGDBomitbxp+NxMZ8yEDVlZeDPJb8nW0po7+i5ul2T0hGtCaCtJiwxZzKD2 -aPPjxB4aNfo= ------END CERTIFICATE----- diff --git a/integration-tests/vertx-websocket/src/main/resources/server-key.pem b/integration-tests/vertx-websocket/src/main/resources/server-key.pem deleted file mode 100644 index 35a0a9671555..000000000000 --- a/integration-tests/vertx-websocket/src/main/resources/server-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCi1+uq4ZcXTrY3 -j28k5ivqvSp9PyYhfCn6VZHB3Yk9+8Mn+QGMsUow9F4SPCTsHaOPp0SAVVBIiQxR -5ucfrxPq+6TcZaccJcDTkiM2xsZeL5t1pRVz77RrUOPvDfTuPDSVMR2DVx/I/IZy -KHYYL9JweUMHcCoAxWHWg74YiC9QLOiK55rO5Js9uz4FObf9oQeetjN4rVhBfwl8 -LSysnKdbRJzeLWajwlKRUwLZIUXDDyEG5kpEZI3P/E6IfaoOxLzEBnHa93ospIVS -jgc24xgkUWkrki0LFQcooyu4kExJAO7uCjbqWjfOvoE7DOkjUslBbJQrzTGX8Ix+ -IR8Bg6XpAgMBAAECggEBAIK+0DX8OH57MSw82qUKtRoc1Z+H80qRUXbv+z5na8i7 -ej5+2/KlagcSPPFxHsgBKBCv4P0VAoeqmZyswscan+hcMUrPxzN/UGnOfL1/LUfz -+2KisC3MuNQtN0T5tL0O070xmRuZ+Sg7MIs510+mHdU2V04CjYbe86XzUs6JkUtR -62l9ed5eVoYl7K6n/S0JyDzR/2wCdsLYvr+Y5r31qB4yYyVmKat3pTTb52EuseCl -vZ4LggKz7jxDof/Kn/CyjkhU8dh6mv6opFsw7hUMO9f/OLfDMbFpBSm9eJCxrlm/ -qaD17gSpkSVehK5Hhnzc4jwlTgYHeQ89ga7+tfNCyAECgYEAzIYVuSJcA7j7Ye/3 -RFFoV2dDRu6YfXYKYkQP32gLpwWF3N1fKddGh45V73fa4SJN/5PeTlouK3F0OUNk -Yr0F8AVkyEBMKDvvDKmz0aR9FHqsooGPLzucwMiEpWkGeX2hO+g1V2vRX1SHrdO2 -ywDlHqEHqKvlYBn6zwzqTN1mhwECgYEAy9RH2aqqEc/RFUylbLcmF6Rks7HdTOzS -yA6wdiy/3zVxXjCpp++yMmTYjn9To//47Yx/7LSTBamiv21Kq8iKWnoku+ekxO6V -pfIA6kiY6MgR7+Q+RW/xmXu8VZ6NYm5wffSWMLwYcRuLaof8SdnX3ODwDZLX3DOf -UgvTvLrIxukCgYAEfzpBDNlbF5knaSBVtziFG3cmOx7NO2g1CuwSbHY9IOj1l0R9 -Zgdd+ao4DrmYU6nFYdn0fRUgzWjRzYKKjT9xLJ0vrgI+rDqwW5bhmC1L4vqixBiC -4Fus/Xu1K18CEtoVuCBcILnEz9X/43TUd9uR1daWRdlQSKH0JYONVxznAQKBgQCV -9vduJGzAciApBZ1oYU/7cQ5OT3y8zjk+y9/08nOw7Ace/7qzPl3jSeMy5GdLcFdb -n1W3eBv7vJVrNiQMQ53Xd6pzPbky0z7zOxyFQyiNjDX2Q/205OnivPESJXdshkjp -wvyFmr546YUnuilaxJZXgn/b3MBI2QpNOTptzxdNkQKBgDOOuUDz0uHFUFU3o+Mg -xOb5Ilsa/h26HmtviA1H+GUXOyUPqnWpBcIEHJcgCdpSRQ13mfe6ItLKDdo8Ig8d -udA76MX1brGYo6o5wzhgRf8slDXXaZ3/2TzZFJbQb8c5+oqDvLJxGxFCjYxw2Xnx -eu9IttUytA5O9JVxngDTtJJE ------END PRIVATE KEY----- diff --git a/integration-tests/vertx-websocket/src/main/resources/truststore.p12 b/integration-tests/vertx-websocket/src/main/resources/truststore.p12 deleted file mode 100644 index 38ef0d9d37ef..000000000000 Binary files a/integration-tests/vertx-websocket/src/main/resources/truststore.p12 and /dev/null differ diff --git a/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketClientSslProvider.java b/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketClientSslProvider.java index c6021aa8672c..cdfc1994e96a 100644 --- a/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketClientSslProvider.java +++ b/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketClientSslProvider.java @@ -35,7 +35,8 @@ public class VertxWebsocketClientSslProvider implements WebsocketClientSslProvid private static final SSLContext SSL_CONTEXT; static { - try (InputStream stream = VertxWebsocketClientSslProvider.class.getResourceAsStream("/truststore.p12")) { + try (InputStream stream = VertxWebsocketClientSslProvider.class + .getResourceAsStream("/certs/vertx-websocket-truststore.p12")) { KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(stream, "changeit".toCharArray()); diff --git a/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTest.java b/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTest.java index a7df544035f7..2053c2aba74f 100644 --- a/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTest.java +++ b/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTest.java @@ -23,11 +23,17 @@ import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import io.restassured.RestAssured; +import me.escoffier.certs.Format; +import me.escoffier.certs.junit5.Certificate; +import org.apache.camel.quarkus.test.support.certificate.TestCertificates; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +@TestCertificates(certificates = { + @Certificate(name = "vertx-websocket", formats = { + Format.PKCS12, Format.PEM }, password = "changeit") }) @TestProfile(VertxWebsocketSslTestProfile.class) @QuarkusTest public class VertxWebsocketSslTest { @@ -36,7 +42,7 @@ public class VertxWebsocketSslTest { @BeforeAll public static void beforeAll() { - RestAssured.trustStore("truststore.p12", "changeit"); + RestAssured.trustStore("certs/vertx-websocket-truststore.p12", "changeit"); } @Test diff --git a/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTestProfile.java b/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTestProfile.java index 7bba8b76b08b..ed7e2dbabce5 100644 --- a/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTestProfile.java +++ b/integration-tests/vertx-websocket/src/test/java/org/apache/camel/quarkus/component/vertx/websocket/it/VertxWebsocketSslTestProfile.java @@ -25,8 +25,8 @@ public class VertxWebsocketSslTestProfile implements QuarkusTestProfile { @Override public Map getConfigOverrides() { return Map.of( - "quarkus.http.ssl.certificate.files", "server-cert.pem", - "quarkus.http.ssl.certificate.key-files", "server-key.pem", + "quarkus.http.ssl.certificate.files", "certs/vertx-websocket.crt", + "quarkus.http.ssl.certificate.key-files", "certs/vertx-websocket.key", "quarkus.http.insecure-requests", "disabled"); } } diff --git a/pom.xml b/pom.xml index 148f6e58c1c9..b530f34d52d2 100644 --- a/pom.xml +++ b/pom.xml @@ -226,7 +226,6 @@ docker.io/couchbase/server:7.2.0 docker.io/couchdb:2.3.1 docker.io/eclipse-mosquitto:2.0.18 - eclipse-temurin:17-jdk docker.io/elasticsearch:8.8.1 docker.io/hapiproject/hapi ${fhir.container.image.base}:v6.8.3