You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2021/04/23 14:59:36 UTC

[camel-quarkus] 01/02: Add test coverage for Kafka with SASL_SSL

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit df148e3519cbd381bb6fa24c11aad6a0714c008a
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Apr 23 10:10:55 2021 +0100

    Add test coverage for Kafka with SASL_SSL
    
    Fixes #2409
---
 integration-tests/kafka-sasl-ssl/README.adoc       |  26 ++++
 integration-tests/kafka-sasl-ssl/pom.xml           | 129 ++++++++++++++++
 .../quarkus/kafka/sasl/KafkaSaslSslResource.java   | 119 ++++++++++++++
 .../quarkus/kafka/sasl/KafkaSaslSslRoutes.java     |  28 ++++
 .../src/main/resources/application.properties      |  18 +++
 .../camel/quarkus/kafka/sasl/KafkaSaslSslIT.java   |  23 +++
 .../camel/quarkus/kafka/sasl/KafkaSaslSslTest.java |  55 +++++++
 .../kafka/sasl/KafkaSaslSslTestResource.java       | 171 +++++++++++++++++++++
 .../src/test/resources/config/kafka-keystore.p12   | Bin 0 -> 2451 bytes
 .../src/test/resources/config/kafka-truststore.p12 | Bin 0 -> 1010 bytes
 .../test/resources/config/kafka_server_jaas.conf   |   7 +
 integration-tests/pom.xml                          |   1 +
 tooling/scripts/test-categories.yaml               |   5 +-
 13 files changed, 580 insertions(+), 2 deletions(-)

diff --git a/integration-tests/kafka-sasl-ssl/README.adoc b/integration-tests/kafka-sasl-ssl/README.adoc
new file mode 100644
index 0000000..66c14f2
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/README.adoc
@@ -0,0 +1,26 @@
+== Camel Quarkus Kafka SASL SSL integration tests
+
+To regenerate the SSL key and trust stores, do the following:
+
+[source,shell]
+----
+cd src/test/resources/config
+rm -f *.p12
+
+export SECRET=kafkas3cret
+export JKS_FILE=kafka-keystore.jks
+export JKS_TRUST_FILE=kafka-truststore.jks
+export CERT_FILE=localhost.crt
+export PKCS_FILE=kafka-keystore.p12
+export PKCS_TRUST_FILE=kafka-truststore.p12
+export PEM_FILE_CERT=kafka-cert.pem
+export PEM_FILE_KEY=kafka-key.pem
+
+keytool -genkey -alias kafka-test-store -keyalg RSA -keystore ${JKS_FILE} -keysize 2048 -validity 3650 -dname CN=localhost -keypass ${SECRET} -storepass ${SECRET}
+keytool -export -alias kafka-test-store -file ${CERT_FILE} -keystore ${JKS_FILE} -keypass ${SECRET} -storepass ${SECRET}
+keytool -importkeystore -srckeystore ${JKS_FILE} -srcstorepass ${SECRET} -destkeystore ${PKCS_FILE} -deststoretype PKCS12 -deststorepass ${SECRET}
+keytool -keystore ${JKS_TRUST_FILE} -import -file ${CERT_FILE} -keypass ${SECRET} -storepass ${SECRET} -noprompt
+keytool -importkeystore -srckeystore ${JKS_TRUST_FILE} -srcstorepass ${SECRET} -destkeystore ${PKCS_TRUST_FILE} -deststoretype PKCS12 -deststorepass ${SECRET}
+
+rm -f *.crt *.jks
+----
diff --git a/integration-tests/kafka-sasl-ssl/pom.xml b/integration-tests/kafka-sasl-ssl/pom.xml
new file mode 100644
index 0000000..c60f530
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-integration-tests</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-kafka-sasl-ssl</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Kafka SASL SSL</name>
+    <description>Integration tests for Camel Quarkus Kafka SASL SSL</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-kafka</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-tests-support-kafka</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jsonb</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-jackson</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>kafka</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-kafka-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-log-deployment</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.package.type>native</quarkus.package.type>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/integration-tests/kafka-sasl-ssl/src/main/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslResource.java b/integration-tests/kafka-sasl-ssl/src/main/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslResource.java
new file mode 100644
index 0000000..e7b3318
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/main/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslResource.java
@@ -0,0 +1,119 @@
+/*
+ * 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.kafka.sasl;
+
+import java.time.Duration;
+import java.util.Collections;
+import java.util.Properties;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.quarkus.test.support.kafka.KafkaTestSupport;
+import org.apache.kafka.clients.CommonClientConfigs;
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.Producer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.clients.producer.RecordMetadata;
+import org.apache.kafka.common.config.SaslConfigs;
+import org.apache.kafka.common.config.SslConfigs;
+
+@Path("/kafka-sasl-ssl")
+@ApplicationScoped
+public class KafkaSaslSslResource {
+
+    @Inject
+    @Named("kafka-consumer-properties")
+    Properties consumerProperties;
+
+    @Inject
+    @Named("kafka-producer-properties")
+    Properties producerProperties;
+
+    @Path("/{topicName}")
+    @POST
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject post(@PathParam("topicName") String topicName, String message) throws Exception {
+        Properties props = (Properties) producerProperties.clone();
+        configureSaslSSL(props);
+
+        try (Producer<Integer, String> producer = new KafkaProducer<>(props)) {
+            RecordMetadata meta = producer.send(new ProducerRecord<>(topicName, 1, message)).get();
+
+            return Json.createObjectBuilder()
+                    .add("topicName", meta.topic())
+                    .add("partition", meta.partition())
+                    .add("offset", meta.offset())
+                    .build();
+        }
+    }
+
+    @Path("/{topicName}")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject get(@PathParam("topicName") String topicName) {
+        Properties props = (Properties) consumerProperties.clone();
+        configureSaslSSL(props);
+
+        try (KafkaConsumer<Integer, String> consumer = new KafkaConsumer<>(props)) {
+            consumer.subscribe(Collections.singletonList(topicName));
+
+            ConsumerRecord<Integer, String> record = consumer.poll(Duration.ofSeconds(60)).iterator().next();
+            return Json.createObjectBuilder()
+                    .add("topicName", record.topic())
+                    .add("partition", record.partition())
+                    .add("offset", record.offset())
+                    .add("key", record.key())
+                    .add("body", record.value())
+                    .build();
+        }
+    }
+
+    private void configureSaslSSL(Properties props) {
+        KafkaTestSupport.setKafkaConfigFromProperty(props, CommonClientConfigs.SECURITY_PROTOCOL_CONFIG,
+                "camel.component.kafka.security-protocol");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_KEY_PASSWORD_CONFIG,
+                "camel.component.kafka.ssl-key-password");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG,
+                "camel.component.kafka.ssl-keystore-location");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG,
+                "camel.component.kafka.ssl-keystore-password");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_KEYSTORE_TYPE_CONFIG,
+                "camel.component.kafka.ssl-keystore-type");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,
+                "camel.component.kafka.ssl-truststore-location");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,
+                "camel.component.kafka.ssl-truststore-password");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG,
+                "camel.component.kafka.ssl-truststore-type");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SaslConfigs.SASL_JAAS_CONFIG,
+                "camel.component.kafka.sasl-jaas-config");
+        KafkaTestSupport.setKafkaConfigFromProperty(props, SaslConfigs.SASL_MECHANISM,
+                "camel.component.kafka.sasl-mechanism");
+    }
+}
diff --git a/integration-tests/kafka-sasl-ssl/src/main/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslRoutes.java b/integration-tests/kafka-sasl-ssl/src/main/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslRoutes.java
new file mode 100644
index 0000000..646cc1f
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/main/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslRoutes.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.kafka.sasl;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class KafkaSaslSslRoutes extends RouteBuilder {
+    @Override
+    public void configure() throws Exception {
+        from("kafka:inbound")
+                .to("log:kafka")
+                .to("kafka:outbound");
+    }
+}
diff --git a/integration-tests/kafka-sasl-ssl/src/main/resources/application.properties b/integration-tests/kafka-sasl-ssl/src/main/resources/application.properties
new file mode 100644
index 0000000..8136208
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/main/resources/application.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+quarkus.ssl.native=true
diff --git a/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslIT.java b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslIT.java
new file mode 100644
index 0000000..113d16c
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.kafka.sasl;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class KafkaSaslSslIT extends KafkaSaslSslTest {
+}
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
new file mode 100644
index 0000000..947a7ee
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.kafka.sasl;
+
+import java.util.UUID;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.path.json.JsonPath;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@QuarkusTest
+@QuarkusTestResource(KafkaSaslSslTestResource.class)
+public class KafkaSaslSslTest {
+
+    @Test
+    void testKafkaBridge() {
+        String body = UUID.randomUUID().toString();
+
+        RestAssured.given()
+                .contentType("text/plain")
+                .body(body)
+                .post("/kafka-sasl-ssl/inbound")
+                .then()
+                .statusCode(200);
+
+        JsonPath result = RestAssured.given()
+                .get("/kafka-sasl-ssl/outbound")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .jsonPath();
+
+        assertThat(result.getString("topicName")).isEqualTo("outbound");
+        assertThat(result.getString("body")).isEqualTo(body);
+    }
+}
diff --git a/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTestResource.java b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTestResource.java
new file mode 100644
index 0000000..3a26d62
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/test/java/org/apache/camel/quarkus/kafka/sasl/KafkaSaslSslTestResource.java
@@ -0,0 +1,171 @@
+/*
+ * 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.kafka.sasl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+
+import com.github.dockerjava.api.command.InspectContainerResponse;
+import org.apache.camel.quarkus.test.support.kafka.KafkaTestResource;
+import org.apache.camel.util.CollectionHelper;
+import org.testcontainers.containers.KafkaContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.images.builder.Transferable;
+import org.testcontainers.shaded.org.apache.commons.io.FileUtils;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.MountableFile;
+
+public class KafkaSaslSslTestResource extends KafkaTestResource {
+
+    private static final String KAFKA_KEYSTORE_FILE = "kafka-keystore.p12";
+    private static final String KAFKA_KEYSTORE_PASSWORD = "kafkas3cret";
+    private static final String KAFKA_KEYSTORE_TYPE = "PKCS12";
+    private static final String KAFKA_SSL_CREDS_FILE = "broker-creds";
+    private static final String KAFKA_TRUSTSTORE_FILE = "kafka-truststore.p12";
+    private static final File TMP_DIR = Paths.get(System.getProperty("java.io.tmpdir"), "kafka").toFile();
+    private SaslSslKafkaContainer container;
+
+    @Override
+    public Map<String, String> start() {
+        // Set up the SSL key / trust store directory
+        try {
+            TMP_DIR.mkdirs();
+
+            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+            URL resource = classLoader.getResource("config");
+            File serviceBindings = new File(resource.getPath());
+
+            for (File keyStore : serviceBindings.listFiles()) {
+                URL serviceBindingResource = classLoader.getResource("config/" + keyStore.getName());
+                FileUtils.copyInputStreamToFile(serviceBindingResource.openStream(),
+                        Paths.get(TMP_DIR.getPath(), keyStore.getName()).toFile());
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        container = new SaslSslKafkaContainer(KAFKA_IMAGE_NAME);
+        container.start();
+
+        String jaasConfig = "org.apache.kafka.common.security.scram.ScramLoginModule required "
+                + "username=\"alice\" "
+                + "password=\"alice-secret\";";
+
+        Path keystorePath = TMP_DIR.toPath();
+        return CollectionHelper.mapOf(
+                "camel.component.kafka.brokers", container.getBootstrapServers(),
+                "camel.component.kafka.sasl-mechanism", "SCRAM-SHA-512",
+                "camel.component.kafka.sasl-jaas-config", jaasConfig,
+                "camel.component.kafka.security-protocol", "SASL_SSL",
+                "camel.component.kafka.ssl-key-password", KAFKA_KEYSTORE_PASSWORD,
+                "camel.component.kafka.ssl-keystore-location", keystorePath.resolve(KAFKA_KEYSTORE_FILE).toString(),
+                "camel.component.kafka.ssl-keystore-password", KAFKA_KEYSTORE_PASSWORD,
+                "camel.component.kafka.ssl-keystore-type", KAFKA_KEYSTORE_TYPE,
+                "camel.component.kafka.ssl-truststore-location", keystorePath.resolve(KAFKA_TRUSTSTORE_FILE).toString(),
+                "camel.component.kafka.ssl-truststore-password", KAFKA_KEYSTORE_PASSWORD,
+                "camel.component.kafka.ssl-truststore-type", KAFKA_KEYSTORE_TYPE);
+    }
+
+    @Override
+    public void stop() {
+        if (this.container != null) {
+            try {
+                this.container.stop();
+                FileUtils.deleteDirectory(TMP_DIR);
+            } catch (Exception e) {
+                // Ignored
+            }
+        }
+    }
+
+    // KafkaContainer does not support SASL SSL OOTB so we need some customizations
+    static final class SaslSslKafkaContainer extends KafkaContainer {
+
+        SaslSslKafkaContainer(final DockerImageName dockerImageName) {
+            super(dockerImageName);
+
+            String protocolMap = "SASL_SSL:SASL_SSL,BROKER:PLAINTEXT";
+            String listeners = "SASL_SSL://0.0.0.0:" + KAFKA_PORT + ",BROKER://0.0.0.0:9092";
+
+            withEnv("KAFKA_OPTS", "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf");
+            withEnv("KAFKA_LISTENERS", listeners);
+            withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", protocolMap);
+            withEnv("KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE", "false");
+            withEnv("KAFKA_SASL_ENABLED_MECHANISMS", "SCRAM-SHA-512");
+            withEnv("ZOOKEEPER_SASL_ENABLED", "false");
+            withEnv("KAFKA_INTER_BROKER_LISTENER_NAME", "BROKER");
+            withEnv("KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL", "SCRAM-SHA-512");
+            withEnv("KAFKA_SSL_KEY_CREDENTIALS", KAFKA_SSL_CREDS_FILE);
+            withEnv("KAFKA_SSL_KEYSTORE_FILENAME", KAFKA_KEYSTORE_FILE);
+            withEnv("KAFKA_SSL_KEYSTORE_CREDENTIALS", KAFKA_SSL_CREDS_FILE);
+            withEnv("KAFKA_SSL_KEYSTORE_TYPE", KAFKA_KEYSTORE_TYPE);
+            withEnv("KAFKA_SSL_TRUSTSTORE_FILENAME", KAFKA_TRUSTSTORE_FILE);
+            withEnv("KAFKA_SSL_TRUSTSTORE_CREDENTIALS", KAFKA_SSL_CREDS_FILE);
+            withEnv("KAFKA_SSL_TRUSTSTORE_TYPE", KAFKA_KEYSTORE_TYPE);
+            withEnv("KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM", "");
+            waitingFor(Wait.forLogMessage(".*started.*KafkaServer.*", 1));
+        }
+
+        @Override
+        public String getBootstrapServers() {
+            return String.format("SASL_SSL://%s:%s", getHost(), getMappedPort(KAFKA_PORT));
+        }
+
+        @Override
+        protected void containerIsStarting(InspectContainerResponse containerInfo, boolean reused) {
+            super.containerIsStarting(containerInfo, reused);
+            copyFileToContainer(
+                    MountableFile.forClasspathResource("config/kafka_server_jaas.conf"),
+                    "/etc/kafka/kafka_server_jaas.conf");
+
+            copyFileToContainer(
+                    MountableFile.forClasspathResource("config/" + KAFKA_KEYSTORE_FILE),
+                    "/etc/kafka/secrets/" + KAFKA_KEYSTORE_FILE);
+
+            copyFileToContainer(
+                    MountableFile.forClasspathResource("config/" + KAFKA_TRUSTSTORE_FILE),
+                    "/etc/kafka/secrets/" + KAFKA_TRUSTSTORE_FILE);
+
+            copyFileToContainer(
+                    Transferable.of(KAFKA_KEYSTORE_PASSWORD.getBytes(StandardCharsets.UTF_8)),
+                    "/etc/kafka/secrets/" + KAFKA_SSL_CREDS_FILE);
+
+            String setupUsersScript = "#!/bin/bash\n"
+                    + "KAFKA_OPTS= /usr/bin/kafka-configs --zookeeper localhost:" + ZOOKEEPER_PORT
+                    + " --alter --add-config 'SCRAM-SHA-512=[iterations=8192,password=alice-secret]' --entity-type users --entity-name alice";
+
+            copyFileToContainer(
+                    Transferable.of(setupUsersScript.getBytes(StandardCharsets.UTF_8), 0775),
+                    "/setup-users.sh");
+        }
+
+        @Override
+        protected void containerIsStarted(InspectContainerResponse containerInfo) {
+            super.containerIsStarted(containerInfo);
+            try {
+                execInContainer("/setup-users.sh");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+}
diff --git a/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka-keystore.p12 b/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka-keystore.p12
new file mode 100644
index 0000000..2585d2e
Binary files /dev/null and b/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka-keystore.p12 differ
diff --git a/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka-truststore.p12 b/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka-truststore.p12
new file mode 100644
index 0000000..c124e21
Binary files /dev/null and b/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka-truststore.p12 differ
diff --git a/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka_server_jaas.conf b/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka_server_jaas.conf
new file mode 100644
index 0000000..4cd805f
--- /dev/null
+++ b/integration-tests/kafka-sasl-ssl/src/test/resources/config/kafka_server_jaas.conf
@@ -0,0 +1,7 @@
+KafkaServer {
+   org.apache.kafka.common.security.scram.ScramLoginModule required
+  username="admin"
+  password="admin-secret"
+  user_admin="admin-secret"
+  user_alice="alice-secret";
+};
\ No newline at end of file
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 32ef973..b0c3e07 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -136,6 +136,7 @@
         <module>jta</module>
         <module>kafka</module>
         <module>kafka-sasl</module>
+        <module>kafka-sasl-ssl</module>
         <module>kafka-ssl</module>
         <module>kamelet</module>
         <module>kotlin</module>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index d19bd9a..7643395 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -23,6 +23,8 @@ group-01:
   - caffeine
   - http
   - jsch
+  - kafka
+  - kafka-sasl
   - hazelcast
   - ipfs
   - mllp
@@ -125,8 +127,7 @@ group-08:
 group-09:
   - activemq
   - amqp
-  - kafka
-  - kafka-sasl
+  - kafka-sasl-ssl
   - kafka-ssl
   - messaging
   - nats