SASL stands for Simple Authentication and Security Layer. It is a framework for adding authentication support to connection-based protocols.
Click to reveal answer
beginner
Name two common SASL mechanisms used in Kafka.
Two common SASL mechanisms in Kafka are SASL/PLAIN and SASL/SCRAM. SASL/PLAIN sends username and password in plain text (usually over SSL), while SASL/SCRAM uses a challenge-response mechanism for better security.
Click to reveal answer
intermediate
How do you enable SASL authentication in Kafka broker configuration?
You enable SASL by setting 'security.inter.broker.protocol' and 'sasl.mechanism.inter.broker.protocol' in the broker's server.properties file. Also, configure 'sasl.enabled.mechanisms' to list allowed SASL mechanisms.
Click to reveal answer
intermediate
What is the role of JAAS in Kafka SASL authentication?
JAAS (Java Authentication and Authorization Service) is used to configure the login modules for SASL authentication in Kafka. It defines how Kafka clients and brokers authenticate using SASL mechanisms.
Click to reveal answer
beginner
Why is it important to use SSL/TLS with SASL/PLAIN in Kafka?
SASL/PLAIN sends credentials in clear text, so using SSL/TLS encrypts the connection to protect username and password from being intercepted.
Click to reveal answer
Which SASL mechanism uses a challenge-response protocol for authentication in Kafka?
ASASL/PLAIN
BSASL/GSSAPI
CSASL/SCRAM
DSASL/OAUTHBEARER
✗ Incorrect
SASL/SCRAM uses a challenge-response mechanism to securely authenticate clients without sending passwords in clear text.
What configuration property enables SASL mechanisms on a Kafka broker?
Asecurity.protocol
Bsasl.enabled.mechanisms
Cssl.enabled.protocols
Dbroker.id
✗ Incorrect
'sasl.enabled.mechanisms' lists the SASL mechanisms the broker accepts for authentication.
Which file is used to configure JAAS login modules for Kafka SASL authentication?
Ajaas.conf
Bserver.properties
Ckafka.properties
Dsasl.conf
✗ Incorrect
The JAAS configuration file (commonly named jaas.conf) defines login modules for SASL authentication.
Why should SASL/PLAIN be used only with SSL/TLS in Kafka?
ABecause SASL/PLAIN is deprecated
BBecause SASL/PLAIN encrypts passwords by itself
CBecause SSL/TLS disables SASL/PLAIN
DBecause SASL/PLAIN sends credentials in clear text
✗ Incorrect
SASL/PLAIN sends username and password in clear text, so SSL/TLS is needed to encrypt the connection.
Which Kafka configuration property sets the protocol used between brokers for SASL?
Asecurity.inter.broker.protocol
Bsasl.mechanism.inter.broker.protocol
Clisteners
Dbroker.id
✗ Incorrect
'security.inter.broker.protocol' defines the protocol (e.g., SASL_SSL) used for communication between Kafka brokers.
Explain how SASL authentication works in Kafka and why it is important.
Think about how Kafka verifies user identity securely.
You got /4 concepts.
Describe the steps to configure SASL authentication on a Kafka broker.
Focus on broker properties and JAAS file setup.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of SASL authentication in Kafka?
easy
A. To compress messages for faster transmission
B. To verify user identity before allowing access
C. To balance load between Kafka brokers
D. To encrypt data stored on disk
Solution
Step 1: Understand SASL role in Kafka
SASL is a protocol used to verify who is connecting to Kafka, ensuring only authorized users can access it.
Step 2: Differentiate from other Kafka features
Compression, load balancing, and disk encryption are unrelated to SASL authentication.
Final Answer:
To verify user identity before allowing access -> Option B
Quick Check:
SASL = user verification [OK]
Hint: SASL is about user identity, not data or load [OK]
Common Mistakes:
Confusing SASL with encryption
Thinking SASL manages data compression
Mixing SASL with load balancing
2. Which of the following is the correct way to specify SASL mechanism in Kafka client configuration?
easy
A. security.protocol = SASL_PLAINTEXT
B. sasl.config = PLAIN
C. sasl.mechanism = PLAIN
D. security.mechanism = SASL
Solution
Step 1: Identify correct property for SASL mechanism
The Kafka client uses sasl.mechanism to specify the SASL mechanism like PLAIN, SCRAM, etc.
Step 2: Check other options for correctness
security.protocol sets protocol type, not mechanism; sasl.config is invalid; security.mechanism is not a valid property.
Final Answer:
sasl.mechanism = PLAIN -> Option C
Quick Check:
sasl.mechanism sets SASL type [OK]
Hint: Use sasl.mechanism to set SASL type like PLAIN [OK]
The client fails to authenticate. What is the most likely cause?
medium
A. Broker does not support SASL_PLAINTEXT
B. Incorrect sasl.mechanism value
C. Wrong format in sasl.jaas.config string
D. Missing SSL configuration causes failure
Solution
Step 1: Check security.protocol compatibility
SASL_PLAINTEXT means SASL without encryption. Many brokers disable this for security reasons.
Step 2: Consider broker support
If the broker is configured to reject SASL_PLAINTEXT connections, authentication will fail even if credentials and mechanism are correct.
Final Answer:
Broker does not support SASL_PLAINTEXT -> Option A
Quick Check:
Broker must allow SASL_PLAINTEXT [OK]
Hint: Check if broker allows SASL_PLAINTEXT connections [OK]
Common Mistakes:
Assuming SSL is required for SASL_PLAINTEXT
Misformatting sasl.jaas.config string
Using wrong sasl.mechanism value
5. You want to configure a Kafka client to use SASL_SSL with SCRAM-SHA-512 mechanism. Which of the following is the correct minimal configuration snippet in Java?
hard
A. props.put("security.protocol", "SASL_SSL");
props.put("sasl.mechanism", "SCRAM-SHA-512");
props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user\" password=\"pass\";");
B. props.put("security.protocol", "SSL");
props.put("sasl.mechanism", "SCRAM-SHA-512");
props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user\" password=\"pass\";");
C. props.put("security.protocol", "SASL_PLAINTEXT");
props.put("sasl.mechanism", "SCRAM-SHA-256");
props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user\" password=\"pass\";");
D. props.put("security.protocol", "SASL_SSL");
props.put("sasl.mechanism", "PLAIN");
props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"user\" password=\"pass\";");
Solution
Step 1: Match security.protocol with SASL_SSL
To use encrypted SASL, security.protocol must be SASL_SSL.
Step 2: Confirm sasl.mechanism and JAAS config
For SCRAM-SHA-512, sasl.mechanism must be SCRAM-SHA-512 and JAAS config must use ScramLoginModule with username and password.
Step 3: Eliminate incorrect options
props.put("security.protocol", "SSL");
props.put("sasl.mechanism", "SCRAM-SHA-512");
props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user\" password=\"pass\";"); uses SSL without SASL, C uses wrong mechanism and protocol, D uses PLAIN mechanism instead of SCRAM-SHA-512.
Final Answer:
Correct SASL_SSL with SCRAM-SHA-512 and proper JAAS config -> Option A