Apache Kafka Tutorial 0/111 lessons ~6 min read Lesson 58
SASL
What is SASL?
Course progress0%
Focus
9 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
What is SASL? SASL provides authentication mechanisms such as PLAIN, SCRAM, GSSAPI/Kerberos, and OAUTHBEARER.
Understanding the topic
What happens — SASL:
- Enable TLS for encrypted transport.
- Authenticate clients with SASL or mTLS.
- Authorize with ACLs per topic/group.
- Rotate secrets via vault or K8s.
| Term | Description |
|---|---|
| TLS | Encrypt data in transit. |
| SASL | Username/password or Kerberos/OAuth. |
| ACL | Allow/deny per principal + resource. |
| Principal | Identity string for ACLs. |
Visual explanation
Pipeline view:
text
Client identity↓TLS/SASL authentication↓ACL authorization↓topic operation↓audit log
Step-by-step explanation
- Encrypt — TLS on listeners.
- Authenticate — SASL or certificates.
- Authorize — kafka-acls grants.
- Audit — Log access attempts.
Informative example
Example:
bash
kafka-topics --bootstrap-server localhost:9092 --create --topic sasl --partitions 6 --replication-factor 3kafka-console-producer --bootstrap-server localhost:9092 --topic saslkafka-console-consumer --bootstrap-server localhost:9092 --topic sasl --from-beginningkafka-consumer-groups --bootstrap-server localhost:9092 --describe --group sasl-service
Execution workflow
1SASL workflow
1 / 4Encrypt
TLS on listeners.
Best practices
- Use least-privilege ACLs.
- Separate producer and consumer principals.
- Rotate credentials and avoid plaintext secrets.
- Audit access to sensitive topics.
Common mistakes
- Using wildcard ACLs in production.
- Committing JAAS configs or passwords.
- Assuming encryption solves authorization.
Summary
SASL — Apply least privilege per service, per topic, per operation; rotate secrets and audit access.
Ready to mark this lesson complete?Track your journey across the entire course.