Skip to content

Commit 468d809

Browse files
committed
Reviews
Signed-off-by: Jakub Stejskal <[email protected]>
1 parent bcc878e commit 468d809

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

systemtest/src/test/java/io/strimzi/systemtest/kafka/listeners/ListenersST.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
import io.strimzi.systemtest.utils.kubeUtils.objects.SecretUtils;
5959
import io.strimzi.systemtest.utils.kubeUtils.objects.ServiceUtils;
6060
import io.vertx.core.json.JsonArray;
61+
import org.apache.kafka.common.config.SslClientAuth;
62+
import org.apache.kafka.common.config.SslConfigs;
6163
import org.apache.kafka.common.security.auth.SecurityProtocol;
6264
import org.apache.logging.log4j.LogManager;
6365
import org.apache.logging.log4j.Logger;
@@ -471,11 +473,13 @@ void testSendMessagesCustomListenerTlsScramSha() {
471473
void testSendMessagesCustomListenerTlsCustomization() {
472474
final TestStorage testStorage = new TestStorage(ResourceManager.getTestContext());
473475

474-
String superuserName = "pepa";
475-
String customCaCertName = "custom-ca";
476-
String customUserCertName1 = "custom-user-1-cert";
477-
String customUserCertName2 = "custom-user-2-cert";
478-
String mountPath = "/mnt/kafka/custom-authn-secrets/my-listener";
476+
final String superuserName = "pepa";
477+
final String customCaCertName = "custom-ca";
478+
final String customUserCertName1 = "custom-user-1-cert";
479+
final String customUserCertName2 = "custom-user-2-cert";
480+
final String mountPath = "/mnt/kafka/custom-authn-secrets/my-listener";
481+
// This is needed due to test-client implementation, it doesn't accept other keys for mTLS
482+
final String usedKeyInSecret = "user";
479483

480484
final CertAndKey rootCa1 = generateRootCaCertAndKey();
481485
final CertAndKey rootCa2 = generateRootCaCertAndKey();
@@ -490,8 +494,8 @@ void testSendMessagesCustomListenerTlsCustomization() {
490494
final CertAndKeyFiles chainCertAndKey1 = exportToPemFiles(user1);
491495
final CertAndKeyFiles chainCertAndKey2 = exportToPemFiles(user2);
492496

493-
SecretUtils.createCustomCertSecret(testStorage.getNamespaceName(), testStorage.getClusterName(), customUserCertName1, chainCertAndKey1, "user");
494-
SecretUtils.createCustomCertSecret(testStorage.getNamespaceName(), testStorage.getClusterName(), customUserCertName2, chainCertAndKey2, "user");
497+
SecretUtils.createCustomCertSecret(testStorage.getNamespaceName(), testStorage.getClusterName(), customUserCertName1, chainCertAndKey1, usedKeyInSecret);
498+
SecretUtils.createCustomCertSecret(testStorage.getNamespaceName(), testStorage.getClusterName(), customUserCertName2, chainCertAndKey2, usedKeyInSecret);
495499
SecretUtils.createCustomCertSecret(testStorage.getNamespaceName(), testStorage.getClusterName(), customCaCertName, rootCertAndKey);
496500

497501
resourceManager.createResourceWithWait(
@@ -529,9 +533,9 @@ void testSendMessagesCustomListenerTlsCustomization() {
529533
.withNewKafkaListenerAuthenticationCustomAuth()
530534
.withSasl(false)
531535
// Change ssl config to see if user can actually change it
532-
.addToListenerConfig("ssl.client.auth", "required")
533-
.addToListenerConfig("ssl.truststore.location", mountPath + "/" + customCaCertName + "/ca.crt")
534-
.addToListenerConfig("ssl.truststore.type", "PEM")
536+
.addToListenerConfig("ssl.client.auth", SslClientAuth.REQUIRED)
537+
.addToListenerConfig(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, mountPath + "/" + customCaCertName + "/ca.crt")
538+
.addToListenerConfig(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG, "PEM")
535539
.addToListenerConfig("ssl.principal.mapping.rules", "RULE:^CN=(.*?),(.*)$/CN=$1/")
536540
.endKafkaListenerAuthenticationCustomAuth()
537541
.build())

0 commit comments

Comments
 (0)