apache-kafkajaassasl

How to enable SASL mechanism in kafka locally


How to enable SASL mechanism with JAAS Authentication for kafka ? thus the consumer/producer have to provide username & password in order to be able to publish in the broker enter image description here


Solution

  • The process of enabling SASL authentication in Kafka is extensively described in the Authentication using SASL section in the documentation. I suggest you follow the official documentation as it contains instructions for all the mechanisms and recommendations for production environments.

    To give a bit of background, at a glance you need to:

    1. Create a JAAS file for brokers with a KafkaServer block and the configuration for the specific mechanism.

    2. Add -Djava.security.auth.login.config=<PATH_TO_JAAS_FILE> to your broker JVM command line argument.

    3. Configure client to use SASL via the security.protocol, sasl.mechanism and sasl.jaas.config settings.