Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

Kafka ACL Configuration

Access Control Lists (ACLs) control authorization in Kafka. ACLs define which principals can perform which operations on which resources.


server.properties
# Enable authorizer (KRaft mode)
authorizer.class.name=org.apache.kafka.metadata.authorizer.StandardAuthorizer
# Super users (bypass ACL checks)
super.users=User:admin;User:kafka
# Default behavior when no ACL matches
allow.everyone.if.no.acl.found=false
SettingDefaultDescription
authorizer.class.name(none)Authorizer implementation
super.users(none)Principals that bypass ACL checks
allow.everyone.if.no.acl.foundfalseAllow access when no ACL exists
ModeAuthorizer Class
KRaftorg.apache.kafka.metadata.authorizer.StandardAuthorizer
ZooKeeperkafka.security.authorizer.AclAuthorizer

allow.everyone.if.no.acl.found

Setting this to true creates an open cluster where any authenticated user can access resources without explicit ACLs. In production, this should be false.


ResourceDescriptionExample
TOPICKafka topicorders, events.*
GROUPConsumer groupmy-consumer-group
CLUSTERCluster operationsCluster-wide actions
TRANSACTIONAL_IDTransactional producermy-transactional-id
DELEGATION_TOKENDelegation tokensToken operations
USERUser quotas and SCRAMUser management
OperationApplicable ResourcesDescription
READTopic, GroupConsume messages, fetch offsets
WRITETopicProduce messages
CREATETopic, ClusterCreate topics
DELETETopic, GroupDelete topics, consumer groups
ALTERTopic, ClusterModify configuration
DESCRIBETopic, Group, ClusterView metadata
CLUSTER_ACTIONClusterInter-broker operations
DESCRIBE_CONFIGSTopic, ClusterView configuration
ALTER_CONFIGSTopic, ClusterModify configuration
IDEMPOTENT_WRITEClusterIdempotent producer
ALLAllAll operations
PermissionDescription
ALLOWExplicitly permit the operation
DENYExplicitly forbid the operation

DENY Precedence

DENY rules take precedence over ALLOW rules. If both exist for the same principal/resource/operation, access is denied.


Terminal window
# Allow producer to write to topic
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:producer-app \
--operation Write \
--operation Describe \
--topic orders
# Allow consumer to read from topic and commit offsets
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:consumer-app \
--operation Read \
--operation Describe \
--topic orders \
--group order-consumers
Terminal window
# Remove specific ACL
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--remove \
--allow-principal User:producer-app \
--operation Write \
--topic orders
# Remove all ACLs for a topic
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--remove \
--topic orders
Terminal window
# List all ACLs
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--list
# List ACLs for specific topic
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--list \
--topic orders
# List ACLs for specific principal
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--list \
--principal User:producer-app

Terminal window
# Minimum permissions for producer
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-producer \
--operation Write \
--operation Describe \
--topic my-topic
Terminal window
# Idempotent producer requires cluster-level permission
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-producer \
--operation IdempotentWrite \
--cluster
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-producer \
--operation Write \
--operation Describe \
--topic my-topic
Terminal window
# Transactional producer permissions
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-producer \
--operation Write \
--operation Describe \
--transactional-id my-tx-id
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-producer \
--operation Write \
--operation Describe \
--topic my-topic
Terminal window
# Consumer with consumer group
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-consumer \
--operation Read \
--operation Describe \
--topic my-topic
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-consumer \
--operation Read \
--operation Describe \
--group my-consumer-group
Terminal window
# Kafka Streams requires internal topic permissions
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:streams-app \
--operation Read \
--operation Write \
--operation Create \
--operation Describe \
--topic input-topic
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:streams-app \
--operation All \
--topic 'streams-app-*' \
--resource-pattern-type prefixed
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:streams-app \
--operation All \
--group 'streams-app-*' \
--resource-pattern-type prefixed
Terminal window
# Connect worker permissions
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:connect-worker \
--operation All \
--topic connect-configs
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:connect-worker \
--operation All \
--topic connect-offsets
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:connect-worker \
--operation All \
--topic connect-status
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:connect-worker \
--operation All \
--group connect-cluster

Pattern TypeSyntaxDescription
LITERAL--topic ordersExact match (default)
PREFIXED--resource-pattern-type prefixedPrefix match
Terminal window
# Allow access to all topics starting with "events-"
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:events-processor \
--operation Read \
--operation Write \
--topic events- \
--resource-pattern-type prefixed
Terminal window
# Allow all users to read from public topic
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal 'User:*' \
--operation Read \
--operation Describe \
--topic public-events

DENY rules explicitly forbid access and take precedence over ALLOW rules.

Terminal window
# Deny specific user even if group allows
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--deny-principal User:restricted-user \
--operation All \
--topic sensitive-data
  1. If a DENY rule matches, access is denied
  2. If an ALLOW rule matches, access is granted
  3. If no rules match, check allow.everyone.if.no.acl.found
  4. If false (default), access is denied

Terminal window
# Allow access only from specific hosts
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--allow-principal User:my-app \
--allow-host 10.0.0.100 \
--allow-host 10.0.0.101 \
--operation Read \
--topic my-topic
# Deny access from specific hosts
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--add \
--deny-principal 'User:*' \
--deny-host 192.168.1.0 \
--operation All \
--cluster

Use CaseRequired OperationsResource
ProduceWrite, DescribeTopic
ConsumeRead, DescribeTopic, Group
Idempotent produceIdempotentWriteCluster
Transactional produceWrite, DescribeTransactionalId, Topic
Create topicCreateCluster or Topic
Delete topicDelete, DescribeTopic
List topicsDescribeTopic
Alter topic configAlterConfigsTopic
View topic configDescribeConfigsTopic
List consumer groupsDescribeGroup
Delete consumer groupDeleteGroup
Terminal window
# Non-idempotent producer
kafka-acls.sh --add --allow-principal User:producer \
--operation Write --operation Describe --topic my-topic
# Idempotent producer (recommended)
kafka-acls.sh --add --allow-principal User:producer \
--operation IdempotentWrite --cluster
kafka-acls.sh --add --allow-principal User:producer \
--operation Write --operation Describe --topic my-topic
Terminal window
kafka-acls.sh --add --allow-principal User:consumer \
--operation Read --operation Describe --topic my-topic
kafka-acls.sh --add --allow-principal User:consumer \
--operation Read --operation Describe --group my-group

The admin.properties file for ACL management:

admin.properties
bootstrap.servers=kafka:9092
security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
username="admin" \
password="admin-secret";
ssl.truststore.location=/etc/kafka/ssl/truststore.jks
ssl.truststore.password=truststore-password

Check broker logs for authorization errors:

Terminal window
grep -i "authorization" /var/log/kafka/server.log

Example log entry:

Principal = User:my-app is Denied Operation = Write from host = 10.0.0.1
on resource = Topic:LITERAL:orders for request = Produce
Terminal window
# List all ACLs to understand effective permissions
kafka-acls.sh --bootstrap-server kafka:9092 \
--command-config admin.properties \
--list \
--principal User:my-app
IssueCauseSolution
Producer deniedMissing Write or DescribeAdd both operations
Consumer deniedMissing Group permissionAdd Read on consumer group
Idempotent deniedMissing cluster permissionAdd IdempotentWrite on cluster
Transactional deniedMissing transactional-id permissionAdd Write on transactional-id