Bird
Raised Fist0
Kafkadevops~20 mins

Client authentication configuration in Kafka - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Kafka Client Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What is the output of this SASL/PLAIN client configuration?
Given the following Kafka client configuration snippet, what will be the SASL mechanism used when connecting?
Kafka
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user1" password="pass1";
ASCRAM-SHA-256
BPLAIN
CGSSAPI
DOAUTHBEARER
Attempts:
2 left
💡 Hint
Look at the sasl.mechanism property to identify the authentication method.
❓ Predict Output
intermediate
2:00remaining
What error occurs with this incomplete JAAS config?
Consider this Kafka client JAAS configuration snippet: sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user1";
Kafka
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user1";
AAuthentication fails due to missing password
BSyntaxError: missing password in JAAS config
CConnection succeeds with username only
DRuntimeException: Unknown SASL mechanism
Attempts:
2 left
💡 Hint
The PlainLoginModule requires both username and password.
🧠 Conceptual
advanced
2:00remaining
Which Kafka client property enables SSL client authentication?
To configure Kafka client for SSL client authentication (mutual TLS), which property must be set to provide the client's private key and certificate?
Assl.truststore.location
Bssl.enabled.protocols
Cssl.keystore.location
Dssl.client.auth
Attempts:
2 left
💡 Hint
The keystore contains the client's private key and certificate.
❓ Predict Output
advanced
2:00remaining
What is the effect of this SASL/OAUTHBEARER config snippet?
Given this Kafka client configuration snippet: security.protocol=SASL_SSL sasl.mechanism=OAUTHBEARER sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required;
Kafka
security.protocol=SASL_SSL
sasl.mechanism=OAUTHBEARER
sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required;
AClient fails due to missing OAuth token
BClient uses username/password authentication
CClient uses Kerberos ticket for authentication
DClient uses OAuth 2.0 token for authentication
Attempts:
2 left
💡 Hint
OAUTHBEARER mechanism uses OAuth 2.0 tokens.
🔧 Debug
expert
2:00remaining
Why does this Kafka client fail to authenticate with SCRAM?
This Kafka client configuration fails to authenticate: security.protocol=SASL_PLAINTEXT sasl.mechanism=SCRAM-SHA-256 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user1" password="pass1"; What is the most likely cause?
Kafka
security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user1" password="pass1";
ABroker does not support SCRAM-SHA-256 mechanism
BMissing ssl.keystore.location property
CUsing SASL_PLAINTEXT instead of SASL_SSL causes failure
DIncorrect username format in JAAS config
Attempts:
2 left
💡 Hint
Check if the Kafka broker supports the SASL mechanism configured.

Practice

(1/5)
1. What is the main purpose of client authentication in Kafka?
easy
A. To verify the identity of clients connecting to the Kafka broker
B. To increase the speed of message delivery
C. To compress messages before sending
D. To store messages permanently on the client side

Solution

  1. Step 1: Understand client authentication

    Client authentication is about confirming who is connecting to Kafka to ensure security.
  2. Step 2: Identify the purpose in Kafka context

    Kafka uses client authentication to verify client identity before allowing access.
  3. Final Answer:

    To verify the identity of clients connecting to the Kafka broker -> Option A
  4. Quick Check:

    Client authentication = verify identity [OK]
Hint: Authentication means verifying who you are [OK]
Common Mistakes:
  • Confusing authentication with message compression
  • Thinking authentication speeds up delivery
  • Mixing authentication with data storage
2. Which Kafka client configuration property is used to enable SSL authentication?
easy
A. enable.ssl.auth=true
B. ssl.enabled=true
C. security.protocol=SSL
D. auth.method=ssl

Solution

  1. Step 1: Recall Kafka SSL config property

    The correct property to enable SSL is 'security.protocol' set to 'SSL'.
  2. Step 2: Check other options for correctness

    Other options are not valid Kafka config keys for SSL authentication.
  3. Final Answer:

    security.protocol=SSL -> Option C
  4. Quick Check:

    SSL enabled by security.protocol=SSL [OK]
Hint: Use security.protocol=SSL to enable SSL [OK]
Common Mistakes:
  • Using non-existent properties like ssl.enabled
  • Confusing property names with auth.method
  • Adding extra words like enable.ssl.auth
3. Given this Kafka client config snippet:
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user" password="pass";

What type of client authentication is configured?
medium
A. SSL without SASL
B. SASL with PLAIN mechanism over SSL
C. SASL with SCRAM mechanism
D. No authentication

Solution

  1. Step 1: Analyze security.protocol and sasl.mechanism

    security.protocol=SASL_SSL means SASL authentication over SSL. sasl.mechanism=PLAIN means using PLAIN SASL mechanism.
  2. Step 2: Confirm authentication type

    The config uses SASL PLAIN mechanism secured by SSL transport.
  3. Final Answer:

    SASL with PLAIN mechanism over SSL -> Option B
  4. Quick Check:

    SASL_SSL + PLAIN = SASL PLAIN over SSL [OK]
Hint: SASL_SSL means SASL over SSL, check sasl.mechanism [OK]
Common Mistakes:
  • Ignoring sasl.mechanism and assuming only SSL
  • Confusing PLAIN with SCRAM mechanism
  • Thinking no authentication is set
4. You have this Kafka client config:
security.protocol=SSL
ssl.keystore.location=/path/to/keystore
ssl.keystore.password=wrongpass

The client fails to authenticate. What is the most likely cause?
medium
A. Incorrect keystore password
B. Missing sasl.mechanism property
C. security.protocol should be PLAINTEXT
D. ssl.keystore.location path is not needed

Solution

  1. Step 1: Check SSL keystore config

    The keystore password is set to 'wrongpass', which likely does not match the actual password.
  2. Step 2: Evaluate other options

    Missing sasl.mechanism is irrelevant for SSL-only config. PLAINTEXT disables security. Keystore location is required.
  3. Final Answer:

    Incorrect keystore password -> Option A
  4. Quick Check:

    Wrong password causes SSL auth failure [OK]
Hint: Check passwords carefully for SSL keystore [OK]
Common Mistakes:
  • Assuming sasl.mechanism is needed for SSL-only
  • Changing security.protocol to PLAINTEXT by mistake
  • Ignoring keystore location requirement
5. You want to configure a Kafka client to authenticate using SASL SCRAM-SHA-512 over SSL. Which configuration snippet is correct?
hard
A. security.protocol=SASL_SSL sasl.mechanism=PLAIN sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user" password="pass";
B. security.protocol=SSL sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass";
C. security.protocol=SASL_PLAINTEXT sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass";
D. security.protocol=SASL_SSL sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass";

Solution

  1. Step 1: Identify correct security.protocol for SASL SCRAM over SSL

    It must be 'SASL_SSL' to use SASL authentication over SSL.
  2. Step 2: Match sasl.mechanism and jaas config

    For SCRAM-SHA-512, sasl.mechanism must be 'SCRAM-SHA-512' and jaas config must use ScramLoginModule.
  3. Step 3: Verify options

    security.protocol=SASL_SSL sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass"; matches all requirements. security.protocol=SSL sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass"; misses SASL in protocol. security.protocol=SASL_PLAINTEXT sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass"; uses PLAINTEXT transport. security.protocol=SASL_SSL sasl.mechanism=PLAIN sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user" password="pass"; uses PLAIN mechanism, not SCRAM.
  4. Final Answer:

    security.protocol=SASL_SSL sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass"; -> Option D
  5. Quick Check:

    SASL_SSL + SCRAM-SHA-512 + ScramLoginModule = security.protocol=SASL_SSL sasl.mechanism=SCRAM-SHA-512 sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="user" password="pass"; [OK]
Hint: Use SASL_SSL with matching SCRAM mechanism and login module [OK]
Common Mistakes:
  • Using SSL without SASL for SCRAM
  • Mixing PLAIN mechanism with SCRAM config
  • Setting security.protocol to PLAINTEXT
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard