Kafka access control is built from five elements: Principal (who), Resource (what), Operation (what action), Permission (allow/deny), and Pattern (how it matches). What trips people up on the exam and in production is how to combine these five elements and how the evaluation order works.
This article distills the design fundamentals and minimal CLI examples based on the official documentation. With CCAAK in mind, it covers naming conventions, prefix matching, and Deny rule handling that you can apply directly in production.
A Kafka ACL is defined by a combination of Principal (User:app, CN=client, a Kerberos principal, etc.), Resource (Topic, Group, Cluster, TransactionalId, etc.), Operation (READ, WRITE, CREATE, etc.), Permission (ALLOW or DENY), and Pattern (LITERAL or PREFIXED). The evaluation rule is simple: if any matching DENY exists, deny; otherwise if any matching ALLOW exists, allow; otherwise deny.
For the initial rollout, enable StandardAuthorizer (the default Authorizer in recent Kafka versions), explicitly declare super-users for operations, and grant only the minimum required privileges to business apps.
| Resource Pattern | Example | Primary Use | Exam Pitfall |
|---|---|---|---|
| LITERAL | --topic payments | Allow/deny a single topic only | Fragile when topics get renamed; hard to follow future expansion |
| PREFIXED | --topic payments- (--resource-pattern-type prefixed) | Allow at the namespace (prefix) level | Easy to grant more than intended; mixing in denies invites trouble |
| Wildcard | --topic "*" | Blanket allow/deny (for operators or internal tooling) | Minimize in practice; exam questions often try to lead you into misusing it |
Granting a basic ACL (Broker 3.x and later: --bootstrap-server is recommended)
bin/kafka-acls.sh \
--bootstrap-server broker1:9092 \
--add --allow-principal User:app-writer \
--operation WRITE --operation DESCRIBE \
--topic payments
# Consumer (READ on topic + READ on group)
bin/kafka-acls.sh \
--bootstrap-server broker1:9092 \
--add --allow-principal User:app-reader \
--operation READ --topic payments \
--operation READ --group pay-consumer
A Principal is the identity passed in from the authentication layer. Common forms are SASL/SCRAM usernames, SASL/PLAIN users, mTLS certificate subjects (CN, etc.), and Kerberos principals. ACLs are ultimately evaluated against a string such as User:xxx.
Design service accounts per app and per role, and embed the environment and system name in the prefix to avoid collisions and accidental cross-cutting grants. Always separate human-use principals from service principals so incident investigation stays clean.
Creating a SASL/SCRAM user and granting an ACL (example)
# Create a SCRAM user (on the broker)
bin/kafka-configs.sh --bootstrap-server broker1:9092 \
--alter --add-config 'SCRAM-SHA-512=[password=secret-pass]' \
--entity-type users --entity-name prod-appA-writer
# Write ACL
auth_user=User:prod-appA-writer
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal "$auth_user" \
--operation WRITE --operation DESCRIBE \
--topic payments-orders
Carving out namespaces for topics and groups dramatically simplifies ACL design. Standardize on a convention like system-domain-purpose-environment and grant in bulk with prefix matching (PREFIXED).
That said, PREFIXED tends to cover more than you think. Rather than papering over the issue with Deny rules, it is safer to revisit the prefix design on the ALLOW side.
Conceptual view of namespaces and prefix-matched ACLs
Granting a PREFIXED ACL (apply across topics/groups at once)
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:prod-appA-reader \
--resource-pattern-type prefixed \
--operation READ --topic payments- \
--operation READ --group prod-appA-
The required Operations are essentially fixed per typical role: producer, consumer, or admin. If you use an idempotent producer or transactions, you also need to grant on Cluster and/or TransactionalId.
In production, auto.create.topics.enable is typically disabled, so restrict topic creation to admin principals.
ACL examples for typical roles
# Idempotent producer
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:prod-appA-writer \
--operation WRITE --operation DESCRIBE --topic payments-orders-prod
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:prod-appA-writer \
--operation IDEMPOTENT_WRITE --cluster
# Transactional producer (transactional.id=tx-payments)
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:prod-appA-writer \
--operation WRITE --transactional-id tx-payments
# Consumer (per group)
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:prod-appA-reader \
--operation READ --topic payments-orders-prod \
--operation READ --group prod-appA-consumer
The Kafka Authorizer follows a simple rule: if any matching DENY exists, deny; if there is no DENY but any matching ALLOW exists, allow; otherwise deny. There is no concept of one pattern being "more specific" than another. If you place a narrow LITERAL DENY against a broad PREFIXED ALLOW, the DENY always wins and the request is blocked.
One exception: principals listed in the broker's super.users config bypass ACLs entirely. Restrict super.users to operators only and always keep audit logs enabled.
Concrete Deny example (block one specific topic)
# Broad allow (READ on payments-*)
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:prod-appA-reader \
--resource-pattern-type prefixed \
--operation READ --topic payments-
# But block refunds (Deny wins)
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --deny-principal User:prod-appA-reader \
--operation READ --topic payments-refunds-prod
ACLs take effect immediately, so misconfigurations have a big blast radius. Make changes safer by visualizing the impact in advance and codifying naming rules and grant policies as code (IaC) for reviewability. On Confluent you can also combine ACLs with RBAC, but the exam focuses on basic ACL evaluation.
For auditing, reconcile deny logs against who was denied which operation and which ACL matched, on a daily basis. During app migrations, the practical approach is to grant broadly via PREFIXED temporarily, then tighten the scope once the migration completes.
Inventory, deletion, and safe rollback
# List
bin/kafka-acls.sh --bootstrap-server broker1:9092 --list
# Remove a specific ACL (undo a mistake)
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--remove --allow-principal User:prod-appA-reader \
--operation READ --group prod-appA-consumer
# Temporarily grant a broad PREFIXED allow to help migration, then narrow it later
bin/kafka-acls.sh --bootstrap-server broker1:9092 \
--add --allow-principal User:migration-helper \
--resource-pattern-type prefixed --operation READ --topic payments-
CCAAK
問題 1
On a running cluster, User:svc-a has READ access to many topics via PREFIXED grants (e.g., payments-). You want to block reads on payments-refunds-prod only. Which approach is the safest and most predictable?
正解: A
In Kafka's evaluation, Deny always wins. Even with a broad ALLOW (PREFIXED), a DENY on READ for a specific topic reliably blocks access. Options C and D have side effects that are too broad, and B has high operational cost and is error-prone.
What ACLs does an idempotent producer need?
WRITE + DESCRIBE on the target topic, plus IDEMPOTENT_WRITE on the Cluster resource. If you also use transactions, grant WRITE on the TransactionalId (for example, --transactional-id tx-foo).
What is the minimum ACL set for a consumer?
READ on the target Topic plus READ on the target Group. That covers fetch, group join, and offset commits. Administrative operations like delete or config changes are not needed.
What happens to existing apps when you enable ACLs?
When the Authorizer is enabled and no ACLs are configured, requests are denied by default. Before cutover, create the required ALLOW rules, verify access via audit logs, and only then route production traffic.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Kafka Topics & Partitions: Distribution Fundamentals (2026)
How Kafka topics and partitions enable scale — ordering guar...
CCDAK Exam Guide: Confluent Certified Developer (2026)
Complete prep for the CCDAK exam — Producer/Consumer API, St...
CCAAK Exam Guide: Confluent Certified Administrator (2026)
Pass the CCAAK exam — cluster management, partitions, securi...
Kafka Replicas & ISR: Fault Tolerance Explained (2026)
Replica placement, in-sync replicas (ISR), leader election. ...
Kafka Offsets: Commit Modes & Consumer Position (2026)
Offset semantics — auto vs. manual commit, __consumer_offset...