How to configure kafka Jaas file with IBM JDK ?

In order to understand use of jaas file in Kafka and its parameters please refer my previous postĀ Troubleshooting kerberos issues in kafka for producer/consumers

In java producer/consumer one needs to configure service name in application codeĀ 

Sample code for producer :

Map<String, Object> producerConfig = new HashMap<>();
producerConfig.put("sasl.kerberos.service.name","kafka");

Sample code for consumer :

Map<String, Object> ConsumerConfig = new HashMap<>();
ConsumerConfig.put("sasl.kerberos.service.name","kafka");

One needs to configure JAAS file for IBM java as follows :

KafkaClient {
com.ibm.security.auth.module.Krb5LoginModule required
debug=true
credsType=both
useKeytab="/Path/To/Keytab"
principal="<Principal>";
};

Client {
com.ibm.security.auth.module.Krb5LoginModule required
debug=true
credsType=both
useKeytab="/Path/To/Keytab"
principal="<Principal>"
};

For example :

KafkaClient {
com.ibm.security.auth.module.Krb5LoginModule required
debug=true
credsType=both
useKeytab="/etc/security/keytabs/testuser.keytab"
principal="testuser@HWX.COM";
};

Client {
com.ibm.security.auth.module.Krb5LoginModule required
debug=true
credsType=both
useKeytab="/etc/security/keytabs/testuser.keytab"
principal="testuser@HWX.COM";
};

Leave a Reply

Your email address will not be published. Required fields are marked *