skip to content

Security

Locking down a cluster: TLS in transit, SASL authentication, ACL authorization, the listener matrix, and quotas. Interviewers ask because Kafka is wide open by default and usually holds the company's data.

part ofApache Kafkaoverview, primer and where to startread it →
on this pageshow

explore

questions

62 · 12 sections

What does TLS/SSL encryption in transit protect in Kafka, and which broker and client configs enable it?

level: juniorimportance: must knowfreq 70%
basics
~20 s

TLS encrypts data moving between clients and brokers (and between brokers) so it can't be read or tampered with on the wire. You set security.protocol=SSL and point clients at a truststore (ssl.truststore.location/password); brokers add an SSL listener plus a keystore.

open as a page

What does ssl.endpoint.identification.algorithm control, and why is disabling it dangerous?

level: seniorimportance: must knowfreq 55%
basics
~20 s

It controls TLS hostname verification — whether the client checks that the broker's certificate actually matches the hostname it connected to. The default is https (enabled). Setting it to empty disables that check, which lets an attacker with any valid-looking cert impersonate the broker (man-in-the-middle).

open as a page

What is the difference between JKS and PEM store formats in Kafka, and how do you configure each?

level: middleimportance: should knowfreq 45%
basics
~20 s

JKS is a binary Java keystore file (password-protected, holds cert+key) configured via ssl.keystore.location plus ssl.keystore.type=JKS. PEM is plain text Base64 cert/key data; set ssl.keystore.type=PEM and you can pass the material inline or by file. PEM avoids the keytool step.

open as a page

How do you control which TLS protocol versions and cipher suites Kafka negotiates, and what are sane defaults?

level: seniorimportance: should knowfreq 40%
basics
~10 s

Use ssl.enabled.protocols to allow versions (e.g. TLSv1.2,TLSv1.3) and ssl.protocol for the default context; restrict algorithms with ssl.cipher.suites. Sane defaults: enable only TLSv1.2 and TLSv1.3, disable TLSv1.0/1.1, and rely on strong AEAD ciphers (GCM/ChaCha20).

open as a page

How do you rotate broker TLS keys/certificates and CA trust without downtime?

level: principalimportance: should knowfreq 35%
basics
~20 s

Rotate leaf certs by updating each broker's keystore and reloading without a full restart — Kafka watches the keystore/truststore files and reloads them when the file changes (KIP-226 dynamic config / file watch). Rotate the CA by adding the new CA to every truststore first, migrating certs, then removing the old CA last.

open as a page

What is mutual TLS (mTLS) client authentication in Kafka, and how does it differ from plain TLS encryption?

level: juniorimportance: must knowfreq 70%
basics
~20 s

With plain TLS, only the broker proves its identity with a certificate. With mutual TLS, the client ALSO presents its own certificate, so the broker authenticates the client. The client's certificate identity becomes its Kafka principal.

open as a page

How do you configure a Kafka client to authenticate with mTLS, and what keystore/truststore settings are required?

level: middleimportance: must knowfreq 60%
basics
~10 s

Set security.protocol=SSL, point ssl.keystore.location/password (and ssl.key.password) at the client's keystore holding its cert+private key, and ssl.truststore.location/password at the truststore holding the broker's CA. The broker side must have ssl.client.auth=required.

open as a page

How does Kafka derive a principal from a client certificate, and how do ssl.principal.mapping.rules let you customize it?

level: seniorimportance: must knowfreq 55%
basics
~20 s

By default the principal is the full certificate Subject DN, e.g. User:CN=svc,OU=apps,O=Acme. ssl.principal.mapping.rules is an ordered list of RULE: regex transforms (like Kerberos auth_to_local) that rewrite the DN into a shorter principal such as User:svc.

open as a page

Why are CA-signed client certificates preferred over self-signed ones for Kafka mTLS, and how does the broker truststore relate to client certs?

level: middleimportance: should knowfreq 35%
basics
~20 s

With a CA-signed model the broker truststore only needs the one CA cert; any client cert signed by that CA is trusted automatically. With self-signed certs you'd have to add every individual client cert to every broker's truststore, which doesn't scale.

open as a page

What are the operational challenges of certificate revocation and renewal for Kafka mTLS, and how do you handle them?

level: seniorimportance: should knowfreq 40%
basics
~20 s

Certs expire, so you must renew client certs before expiry or clients drop off. Revocation (killing a compromised cert early) is hard: Kafka's TLS layer doesn't check CRLs/OCSP by default, so teams often rely on short-lived certs and rotating the CA/truststore instead.

open as a page

What is SASL in Kafka, and what is the difference between the PLAIN and SCRAM SASL mechanisms?

level: juniorimportance: must knowfreq 70%
basics
~10 s

SASL is Kafka's pluggable authentication framework. PLAIN sends a username and password (must run over TLS). SCRAM uses a salted challenge-response so the raw password never travels the wire.

open as a page

How do you create, list, and delete a SCRAM user with kafka-configs, and what gets stored?

level: middleimportance: must knowfreq 60%
basics
~10 s

Use kafka-configs.sh --alter --add-config 'SCRAM-SHA-256=[password=secret]' --entity-type users --entity-name alice. Kafka stores a salted, iterated hash (not the password). Delete with --delete-config; list with --describe.

open as a page

How do you configure sasl.jaas.config on a Kafka client and broker for PLAIN vs SCRAM, and what login modules are used?

level: middleimportance: should knowfreq 50%
basics
~10 s

Set sasl.jaas.config inline. PLAIN uses PlainLoginModule, SCRAM uses ScramLoginModule, each with username/password. On the broker, the KafkaServer JAAS section defines accepted users (PLAIN) or the inter-broker login.

open as a page

Explain the SCRAM salted challenge-response handshake and why it resists credential theft better than PLAIN over SASL_SSL.

level: seniorimportance: should knowfreq 40%
basics
~20 s

In SCRAM the client and server exchange nonces; the client derives a salted PBKDF2 key and sends a proof, never the password. The broker stores only StoredKey/ServerKey, so even a server breach or absent TLS doesn't directly leak the password.

open as a page

When would you choose SASL/PLAIN vs SASL/SCRAM (vs mTLS or OAUTHBEARER) for a production Kafka cluster, and what are the operational trade-offs?

level: principalimportance: should knowfreq 35%
basics
~20 s

Use SCRAM for self-managed username/password auth with live user management. Use PLAIN only when an external system (e.g. LDAP via a custom callback) validates credentials. Prefer OAUTHBEARER/mTLS for identity-provider or certificate-based auth. Always wrap in TLS.

open as a page

What is SASL/GSSAPI in Kafka, and what does it let a client and broker prove to each other?

level: juniorimportance: must knowfreq 55%
basics
~20 s

SASL/GSSAPI is Kafka's way of authenticating with Kerberos. Clients get a ticket from a Kerberos KDC and present it to the broker, so both sides prove who they are without sending passwords over the wire.

open as a page

How do you configure a Kafka client and broker for GSSAPI using a keytab, principal, and sasl.kerberos.service.name?

level: middleimportance: must knowfreq 50%
basics
~10 s

Set security.protocol=SASL_SSL, sasl.mechanism=GSSAPI, and sasl.kerberos.service.name=kafka. Provide a JAAS config (via sasl.jaas.config) pointing useKeyTab to a keytab file and the principal that keytab contains.

open as a page

What does krb5.conf contain for a Kafka deployment, and how do clock skew and DNS affect GSSAPI authentication?

level: middleimportance: should knowfreq 32%
basics
~10 s

krb5.conf tells the JVM the default realm, where the KDCs are, and how DNS domains map to realms. Kerberos also requires synchronized clocks (within ~5 minutes) and consistent forward/reverse DNS, or authentication fails.

open as a page

How does Kafka handle Kerberos ticket renewal, and what does sasl.kerberos.ticket.renew.window.factor control?

level: seniorimportance: should knowfreq 35%
basics
~20 s

Kafka runs a background login thread that re-logs in or renews the Kerberos ticket before it expires. sasl.kerberos.ticket.renew.window.factor (default 0.8) sets how far into the ticket's lifetime to wait before renewing — at 80% of its life.

open as a page

How do you integrate Kafka GSSAPI with enterprise Active Directory, and how do you map Kerberos principals to Kafka users for ACLs?

level: principalimportance: should knowfreq 30%
basics
~20 s

Point krb5.conf at the AD domain controllers (AD is a KDC), create service accounts and SPNs in AD, export keytabs, and use sasl.kerberos.principal.to.local.rules (or a custom KafkaPrincipalBuilder) to turn full principals like [email protected] into Kafka users like alice for ACL matching.

open as a page

What is the SASL/OAUTHBEARER mechanism in Kafka, and how does a client authenticate with it?

level: juniorimportance: must knowfreq 55%
basics
~10 s

OAUTHBEARER is a Kafka SASL mechanism where the client presents an OAuth2 bearer token (usually a JWT) instead of a username/password. Kafka validates the token to authenticate the connection.

open as a page

How does a Kafka broker validate an OAUTHBEARER JWT, and which sasl.oauthbearer.* configs control it?

level: seniorimportance: must knowfreq 45%
basics
~10 s

The broker fetches the IdP's public keys from a JWKS endpoint and checks the JWT's signature, issuer, audience, and expiry. Configs like sasl.oauthbearer.jwks.endpoint.url, expected.issuer, expected.audience, and sub.claim.name control this.

open as a page

How does a Kafka client refresh its OAUTHBEARER token, and what happens to a long-lived connection when the token expires?

level: middleimportance: should knowfreq 35%
basics
~20 s

The client's login manager proactively re-acquires a new token before the old one expires, based on a fraction of the token lifetime. Established connections stay open after a token expires; expiry mainly gates new connections (re-authentication can enforce expiry on live ones).

open as a page

What are Kafka delegation tokens (KIP-48), and what problem do they solve for distributed workers and jobs?

level: seniorimportance: should knowfreq 30%
basics
~20 s

Delegation tokens are lightweight shared-secret credentials a client first authenticates (e.g. via Kerberos or OAUTHBEARER), then requests from the broker. Workers/tasks use the token to authenticate to Kafka without distributing the original credential, simplifying secret distribution in distributed jobs.

open as a page

For a multi-tenant job platform that runs short-lived jobs against Kafka, how would you choose between OAUTHBEARER, delegation tokens, and per-tenant credentials for worker/job impersonation?

level: principalimportance: nice to knowfreq 18%
basics
~20 s

Use OAUTHBEARER when each job/worker can talk to your IdP for its own short-lived token (best for centralized identity and revocation). Use delegation tokens when a coordinator authenticates once and must fan out cheap, revocable credentials to many executors without contacting the IdP per task.

open as a page

What is a Kafka ACL, and what are the fields that make up a single ACL binding?

level: juniorimportance: must knowfreq 70%
basics
~20 s

An ACL (access control list entry) is a rule saying a principal (user) is allowed or denied a specific operation (like Read or Write) on a resource (like a topic), optionally from a specific host.

open as a page

What ACLs does a basic producer need to write to a topic, and what does a consumer in a consumer group need to read from it?

level: middleimportance: must knowfreq 75%
basics
~10 s

A producer needs Write on the topic. A consumer needs Read on the topic plus Read on its consumer group. Both implicitly get Describe from Write/Read.

open as a page

Explain Kafka's ACL evaluation precedence — how are ALLOW and DENY rules combined, and what happens when both match?

level: seniorimportance: must knowfreq 65%
basics
~10 s

Kafka is deny-by-default: if nothing matches, access is denied. If any matching DENY exists, access is denied even if an ALLOW also matches. An ALLOW grants only when no DENY matches.

open as a page

How do prefixed and wildcard (literal '*') ACLs differ, and how do you create each with kafka-acls?

level: middleimportance: should knowfreq 55%
basics
~20 s

A wildcard ACL uses the literal name '*' to match all resources of a type. A prefixed ACL matches every resource whose name starts with a given prefix. You select prefixed mode with --resource-pattern-type prefixed.

open as a page

Which authorizer class do you configure for ACLs on a modern KRaft cluster versus a legacy ZooKeeper cluster, and how does ACL storage differ?

level: seniorimportance: should knowfreq 45%
basics
~10 s

On KRaft set authorizer.class.name to StandardAuthorizer; on legacy ZooKeeper clusters use AclAuthorizer (formerly SimpleAclAuthorizer). KRaft stores ACLs in the metadata log; ZooKeeper-based authorizers store them in ZooKeeper.

open as a page

What is the super.users setting in Kafka, and what happens when a principal is listed in it?

level: juniorimportance: must knowfreq 70%
basics
~10 s

super.users is a broker config listing principals that are granted full access and bypass all ACL checks. Any principal in the list is always authorized for every operation, no ACLs needed.

open as a page

What does allow.everyone.if.no.acl.found control, and what is its default and recommended value?

level: middleimportance: must knowfreq 65%
basics
~10 s

It controls the fallback when no ACL matches a resource: if true, access is allowed; if false, access is denied. The default is false (default-deny), which is the recommended secure posture.

open as a page

Walk through how the authorizer combines super.users, DENY/ALLOW ACLs, and the no-ACL fallback to reach a decision.

level: seniorimportance: must knowfreq 55%
basics
~10 s

Order: super user → ALLOWED. Else any matching DENY → DENIED. Else any matching ALLOW → ALLOWED. Else fall back to allow.everyone.if.no.acl.found (true=allow, false=deny). DENY always beats ALLOW.

open as a page

What is authorizer.class.name, and how do the authorizer implementations differ between ZooKeeper and KRaft modes?

level: seniorimportance: should knowfreq 45%
basics
~10 s

authorizer.class.name selects the pluggable Authorizer the broker uses. If unset, no authorization runs (allow all). KRaft clusters use StandardAuthorizer; legacy ZooKeeper clusters used AclAuthorizer.

open as a page

How is a KafkaPrincipal derived from an authenticated connection, and why would you implement a custom KafkaPrincipalBuilder?

level: seniorimportance: should knowfreq 40%
basics
~20 s

Kafka turns an authenticated connection into a KafkaPrincipal (type:name) via a KafkaPrincipalBuilder. By default mTLS uses the full certificate DN and SASL uses the username. A custom builder lets you remap that to cleaner or group-based principal names.

open as a page

What are Kafka's four security protocols, and what does each one provide in terms of encryption and authentication?

level: juniorimportance: must knowfreq 70%
basics
~10 s

Kafka has four security protocols: PLAINTEXT (no encryption, no auth), SSL (TLS encryption, optional client cert auth), SASL_PLAINTEXT (SASL auth, no encryption), and SASL_SSL (SASL auth plus TLS encryption).

open as a page

What is the difference between listeners and advertised.listeners, and why does a misconfigured advertised.listeners break clients even when the broker starts fine?

level: middleimportance: must knowfreq 65%
basics
~20 s

listeners is where the broker binds and accepts connections. advertised.listeners is the address the broker hands back to clients in metadata so they can reconnect. If the advertised address is unreachable, clients connect once for metadata, then fail to reach the broker.

open as a page

How does listener.security.protocol.map work, and how do you use named listeners to run multiple security protocols on one broker?

level: middleimportance: should knowfreq 50%
basics
~20 s

listener.security.protocol.map maps each named listener to one of the four security protocols. With custom listener names you must define this map; it lets one broker expose, for example, an SSL internal listener and a SASL_SSL external listener at the same time.

open as a page

What does inter.broker.listener.name configure, how does it relate to security.inter.broker.protocol, and what are the constraints when separating broker-to-broker traffic onto its own listener?

level: seniorimportance: should knowfreq 40%
basics
~20 s

inter.broker.listener.name selects which named listener brokers use to talk to each other (replication, controller coordination). It is mutually exclusive with security.inter.broker.protocol — you set one or the other. It lets broker-to-broker traffic run on a dedicated, often more-trusted listener separate from client traffic.

open as a page

Design the listener and security configuration for a broker that must serve internal services on a private network and external clients over the internet, with appropriately differentiated hardening.

level: seniorimportance: should knowfreq 35%
basics
~10 s

Define two named listeners: INTERNAL (private network) and EXTERNAL (internet). Map INTERNAL to SSL/mTLS and EXTERNAL to SASL_SSL via listener.security.protocol.map, advertise each with its reachable address, and point inter.broker.listener.name at INTERNAL.

open as a page

What are Kafka client quotas, and what problem do they solve in a multi-tenant cluster?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Quotas are per-client limits that Kafka brokers enforce to cap how much produce/fetch traffic (bytes per second) or broker request time a client can use, stopping one noisy client from starving others.

open as a page

How do you set a produce byte-rate quota for a specific user using kafka-configs, and how do default quotas interact with specific ones?

level: middleimportance: must knowfreq 55%
basics
~10 s

Use kafka-configs.sh --alter --add-config 'producer_byte_rate=...' against --entity-type users --entity-name <user>. A specific entity quota overrides the cluster --entity-default for that level.

open as a page

When would byte-rate quotas fail to protect a broker, and how do request-percentage quotas address that?

level: seniorimportance: should knowfreq 35%
basics
~20 s

Byte-rate quotas only limit data volume, so a client sending many tiny but expensive requests can saturate broker CPU without moving many bytes. request_percentage caps the share of broker IO/network thread time a client uses, covering that gap.

open as a page

Explain how the broker measures rate and computes the throttle delay, including the role of quota.window.size.seconds and quota.window.num.

level: seniorimportance: should knowfreq 40%
basics
~20 s

The broker tracks each client's rate over a sliding window of quota.window.num samples, each quota.window.size.seconds long. When the average exceeds the quota, it computes a delay = how long the client must pause to bring the windowed average back under the limit, then delays the response by that much.

open as a page

What are controller mutation quotas (KIP-599), what do they protect, and how do they differ from request-percentage quotas?

level: principalimportance: nice to knowfreq 22%
basics
~20 s

Controller mutation quotas limit how fast a user/client-id can create or delete topics and partitions, protecting the controller from a flood of metadata changes. They throttle metadata-mutation rate, whereas request_percentage throttles general request CPU on data-path brokers.

open as a page

Does Apache Kafka natively encrypt the data it writes to disk (log segments)? If not, how do teams achieve encryption at rest?

level: juniorimportance: must knowfreq 70%
basics
~20 s

No. Open-source Kafka has no built-in encryption of log segment files on disk. Encryption at rest is provided externally: encrypt the broker's volume/disk (LUKS or a cloud KMS-backed encrypted EBS volume), or encrypt the message payload before producing it.

open as a page

How would you implement client-side (application-level) encryption for PII fields in Kafka messages, and what are the trade-offs?

level: seniorimportance: must knowfreq 60%
basics
~20 s

Encrypt the sensitive payload in the producer before send() and decrypt in the consumer after poll(), typically via a custom Serializer or interceptor using envelope encryption: a KMS issues a data key that encrypts the message, and the wrapped data key travels alongside. The broker stores only ciphertext.

open as a page

How do you audit authentication and authorization (ACL) decisions in Kafka for governance and compliance?

level: middleimportance: should knowfreq 40%
basics
~20 s

Kafka's authorizer logs allowed/denied authorization decisions. Enable the authorizer logger (kafka.authorizer.logger) at INFO/DEBUG to capture which principal was allowed or denied which operation on which resource. Ship those logs to a central, tamper-evident store. Enterprise distributions (Confluent) add structured audit-log topics.

open as a page

A GDPR erasure request requires deleting all of a user's data from a compacted Kafka topic. How do tombstones and retention/compaction make this work, and what are the caveats?

level: seniorimportance: should knowfreq 45%
basics
~20 s

On a compacted topic, produce a tombstone — a record with the user's key and a null value. Log compaction eventually removes all prior records for that key and then drops the tombstone after delete.retention.ms. Deletion is asynchronous, not immediate, and only works per key.

open as a page

Compare KMS-backed volume encryption versus client-side payload encryption for Kafka: which threats does each address, and when would you mandate both?

level: principalimportance: should knowfreq 35%
basics
~20 s

Volume encryption (KMS-backed EBS, LUKS) protects against stolen disks and leaked snapshots but the running broker still sees plaintext. Client-side payload encryption protects PII even from the broker/operator but breaks content-based features and adds key-management cost. Mandate both for regulated PII: defense-in-depth plus operator-proof confidentiality.

open as a page

Why does a Kafka cluster's ZooKeeper ensemble need to be secured, and what is the risk of leaving it open to unauthenticated access?

level: juniorimportance: must knowfreq 70%
basics
~10 s

In ZooKeeper-based Kafka, ZooKeeper stores critical metadata: topic configs, ACLs, SCRAM credentials, and broker registrations. An unauthenticated client can read or delete this metadata directly, bypassing Kafka entirely, so ZooKeeper must require authentication.

open as a page

In KRaft mode, how do you secure the controller quorum, and why is the controller listener security distinct from the broker's client listeners?

level: seniorimportance: must knowfreq 45%
basics
~20 s

KRaft controllers form a Raft quorum that replicates the metadata log. You secure their listener (named in controller.listener.names) with its own SSL/SASL entry in listener.security.protocol.map, separate from client listeners, because that channel carries all cluster metadata.

open as a page

How do you configure SASL and TLS between Kafka brokers and ZooKeeper, and what do zookeeper.set.acl and zookeeper.ssl.client.enable control?

level: middleimportance: should knowfreq 50%
basics
~10 s

SASL is set up via a JAAS Client section so brokers authenticate to ZooKeeper. zookeeper.set.acl=true makes Kafka write znodes with restrictive ACLs. zookeeper.ssl.client.enable=true plus keystore/truststore turns on TLS encryption to ZooKeeper.

open as a page

How are sensitive metadata items like SCRAM credentials and ACLs protected from unauthenticated access in both ZooKeeper-mode and KRaft, and what's the bootstrap challenge for SCRAM in KRaft?

level: seniorimportance: should knowfreq 35%
basics
~20 s

In ZK-mode, SCRAM hashes and ACLs live in znodes protected by ZooKeeper ACLs (zookeeper.set.acl) plus SASL/TLS. In KRaft they live in the __cluster_metadata log, protected by securing the controller listener. KRaft's bootstrap challenge: seed the first SCRAM credential with kafka-storage --add-scram.

open as a page

What are the security implications of migrating a live cluster from ZooKeeper to KRaft, and how do you keep the dual-write/bridge period secure?

level: principalimportance: should knowfreq 25%
basics
~20 s

During ZK→KRaft migration (KIP-866) both systems run together and metadata is dual-written, so you must keep ZooKeeper hardened (SASL/TLS/ACLs) AND secure the new controller listener at the same time. The migration controllers still connect to ZK, so neither attack surface can be relaxed until ZK is removed.

open as a page

How do you turn on an audit log of allowed and denied authorization decisions in Apache Kafka, and where does that output go?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Kafka's authorizer writes an audit trail via a dedicated logger named kafka.authorizer.logger. Set that log4j logger to DEBUG to see allowed requests too; at INFO you only see denials. Route it to its own file appender.

open as a page

A client suddenly can't produce to a topic. How do you tell from monitoring whether it's an authentication failure or an authorization (ACL) denial?

level: middleimportance: must knowfreq 55%
basics
~20 s

Check two different sources. If failed-authentication-total is climbing on that listener, it's an authentication problem (bad cert/credential). If the authorizer log shows a 'Denied' Write line for that principal and topic, it's an ACL/authorization problem. They're surfaced separately.

open as a page

Which JMX metrics expose failed authentications and SSL/SASL handshake failures on a Kafka broker, and how would you alert on them?

level: middleimportance: must knowfreq 60%
basics
~10 s

The broker exposes per-listener authentication counters under kafka.server:type=socket-server-metrics, including failed-authentication-total / failed-authentication-rate and successful-authentication-total. Scrape them via JMX (e.g. JMX exporter to Prometheus) and alert when the failed rate spikes.

open as a page

What does Kafka's expired-connections-killed-count metric measure, and which configuration drives it?

level: seniorimportance: should knowfreq 35%
basics
~10 s

expired-connections-killed-count counts connections the broker closed because a SASL credential (e.g. an OAuth token or Kerberos ticket) expired and the client did not re-authenticate in time. It is driven by connections.max.reauth.ms (KIP-368).

open as a page

Design an end-to-end audit pipeline that ships Kafka authorization denials and authentication failures to a central SIEM. What sources do you tap and what are the pitfalls?

level: principalimportance: should knowfreq 30%
basics
~20 s

Tap two sources: the authorizer audit log (kafka.authorizer.logger, allow/deny lines) and the broker authentication metrics (failed-authentication, expired-connections-killed). Ship logs via a forwarder and metrics via a JMX/Prometheus exporter into the SIEM, normalizing principal, resource, listener, and result.

open as a page