58
58
import io .strimzi .systemtest .utils .kubeUtils .objects .SecretUtils ;
59
59
import io .strimzi .systemtest .utils .kubeUtils .objects .ServiceUtils ;
60
60
import io .vertx .core .json .JsonArray ;
61
+ import org .apache .kafka .common .config .SslClientAuth ;
62
+ import org .apache .kafka .common .config .SslConfigs ;
61
63
import org .apache .kafka .common .security .auth .SecurityProtocol ;
62
64
import org .apache .logging .log4j .LogManager ;
63
65
import org .apache .logging .log4j .Logger ;
@@ -471,11 +473,13 @@ void testSendMessagesCustomListenerTlsScramSha() {
471
473
void testSendMessagesCustomListenerTlsCustomization () {
472
474
final TestStorage testStorage = new TestStorage (ResourceManager .getTestContext ());
473
475
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" ;
479
483
480
484
final CertAndKey rootCa1 = generateRootCaCertAndKey ();
481
485
final CertAndKey rootCa2 = generateRootCaCertAndKey ();
@@ -490,8 +494,8 @@ void testSendMessagesCustomListenerTlsCustomization() {
490
494
final CertAndKeyFiles chainCertAndKey1 = exportToPemFiles (user1 );
491
495
final CertAndKeyFiles chainCertAndKey2 = exportToPemFiles (user2 );
492
496
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 );
495
499
SecretUtils .createCustomCertSecret (testStorage .getNamespaceName (), testStorage .getClusterName (), customCaCertName , rootCertAndKey );
496
500
497
501
resourceManager .createResourceWithWait (
@@ -529,9 +533,9 @@ void testSendMessagesCustomListenerTlsCustomization() {
529
533
.withNewKafkaListenerAuthenticationCustomAuth ()
530
534
.withSasl (false )
531
535
// 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" )
535
539
.addToListenerConfig ("ssl.principal.mapping.rules" , "RULE:^CN=(.*?),(.*)$/CN=$1/" )
536
540
.endKafkaListenerAuthenticationCustomAuth ()
537
541
.build ())
0 commit comments