Kafka ACL Configuration
Access Control Lists (ACLs) control authorization in Kafka. ACLs define which principals can perform which operations on which resources.
Enabling Authorization
Section titled “Enabling Authorization”Broker Configuration
Section titled “Broker Configuration”# 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 matchesallow.everyone.if.no.acl.found=false| Setting | Default | Description |
|---|---|---|
authorizer.class.name | (none) | Authorizer implementation |
super.users | (none) | Principals that bypass ACL checks |
allow.everyone.if.no.acl.found | false | Allow access when no ACL exists |
Authorizer Classes
Section titled “Authorizer Classes”| Mode | Authorizer Class |
|---|---|
| KRaft | org.apache.kafka.metadata.authorizer.StandardAuthorizer |
| ZooKeeper | kafka.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.
ACL Components
Section titled “ACL Components”Resource Types
Section titled “Resource Types”| Resource | Description | Example |
|---|---|---|
TOPIC | Kafka topic | orders, events.* |
GROUP | Consumer group | my-consumer-group |
CLUSTER | Cluster operations | Cluster-wide actions |
TRANSACTIONAL_ID | Transactional producer | my-transactional-id |
DELEGATION_TOKEN | Delegation tokens | Token operations |
USER | User quotas and SCRAM | User management |
Operations
Section titled “Operations”| Operation | Applicable Resources | Description |
|---|---|---|
READ | Topic, Group | Consume messages, fetch offsets |
WRITE | Topic | Produce messages |
CREATE | Topic, Cluster | Create topics |
DELETE | Topic, Group | Delete topics, consumer groups |
ALTER | Topic, Cluster | Modify configuration |
DESCRIBE | Topic, Group, Cluster | View metadata |
CLUSTER_ACTION | Cluster | Inter-broker operations |
DESCRIBE_CONFIGS | Topic, Cluster | View configuration |
ALTER_CONFIGS | Topic, Cluster | Modify configuration |
IDEMPOTENT_WRITE | Cluster | Idempotent producer |
ALL | All | All operations |
Permission Types
Section titled “Permission Types”| Permission | Description |
|---|---|
ALLOW | Explicitly permit the operation |
DENY | Explicitly forbid the operation |
DENY Precedence
DENY rules take precedence over ALLOW rules. If both exist for the same principal/resource/operation, access is denied.
Managing ACLs
Section titled “Managing ACLs”Adding ACLs
Section titled “Adding ACLs”# Allow producer to write to topickafka-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 offsetskafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --add \ --allow-principal User:consumer-app \ --operation Read \ --operation Describe \ --topic orders \ --group order-consumersRemoving ACLs
Section titled “Removing ACLs”# Remove specific ACLkafka-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 topickafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --remove \ --topic ordersListing ACLs
Section titled “Listing ACLs”# List all ACLskafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --list
# List ACLs for specific topickafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --list \ --topic orders
# List ACLs for specific principalkafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --list \ --principal User:producer-appCommon ACL Patterns
Section titled “Common ACL Patterns”Producer Application
Section titled “Producer Application”# Minimum permissions for producerkafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --add \ --allow-principal User:my-producer \ --operation Write \ --operation Describe \ --topic my-topicIdempotent Producer
Section titled “Idempotent Producer”# Idempotent producer requires cluster-level permissionkafka-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-topicTransactional Producer
Section titled “Transactional Producer”# Transactional producer permissionskafka-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-topicConsumer Application
Section titled “Consumer Application”# Consumer with consumer groupkafka-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-groupKafka Streams Application
Section titled “Kafka Streams Application”# Kafka Streams requires internal topic permissionskafka-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 prefixedKafka Connect
Section titled “Kafka Connect”# Connect worker permissionskafka-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-clusterWildcard and Prefix Patterns
Section titled “Wildcard and Prefix Patterns”Resource Pattern Types
Section titled “Resource Pattern Types”| Pattern Type | Syntax | Description |
|---|---|---|
LITERAL | --topic orders | Exact match (default) |
PREFIXED | --resource-pattern-type prefixed | Prefix match |
Prefix ACLs
Section titled “Prefix ACLs”# 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 prefixedWildcard Principal
Section titled “Wildcard Principal”# Allow all users to read from public topickafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --add \ --allow-principal 'User:*' \ --operation Read \ --operation Describe \ --topic public-eventsDeny Rules
Section titled “Deny Rules”DENY rules explicitly forbid access and take precedence over ALLOW rules.
# Deny specific user even if group allowskafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --add \ --deny-principal User:restricted-user \ --operation All \ --topic sensitive-dataACL Evaluation Order
Section titled “ACL Evaluation Order”- If a DENY rule matches, access is denied
- If an ALLOW rule matches, access is granted
- If no rules match, check
allow.everyone.if.no.acl.found - If false (default), access is denied
Host-Based Restrictions
Section titled “Host-Based Restrictions”# Allow access only from specific hostskafka-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 hostskafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --add \ --deny-principal 'User:*' \ --deny-host 192.168.1.0 \ --operation All \ --clusterOperation Requirements
Section titled “Operation Requirements”Operations by Use Case
Section titled “Operations by Use Case”| Use Case | Required Operations | Resource |
|---|---|---|
| Produce | Write, Describe | Topic |
| Consume | Read, Describe | Topic, Group |
| Idempotent produce | IdempotentWrite | Cluster |
| Transactional produce | Write, Describe | TransactionalId, Topic |
| Create topic | Create | Cluster or Topic |
| Delete topic | Delete, Describe | Topic |
| List topics | Describe | Topic |
| Alter topic config | AlterConfigs | Topic |
| View topic config | DescribeConfigs | Topic |
| List consumer groups | Describe | Group |
| Delete consumer group | Delete | Group |
Minimum Producer Permissions
Section titled “Minimum Producer Permissions”# Non-idempotent producerkafka-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 --clusterkafka-acls.sh --add --allow-principal User:producer \ --operation Write --operation Describe --topic my-topicMinimum Consumer Permissions
Section titled “Minimum Consumer Permissions”kafka-acls.sh --add --allow-principal User:consumer \ --operation Read --operation Describe --topic my-topickafka-acls.sh --add --allow-principal User:consumer \ --operation Read --operation Describe --group my-groupAdmin Client Configuration
Section titled “Admin Client Configuration”The admin.properties file for ACL management:
bootstrap.servers=kafka:9092security.protocol=SASL_SSLsasl.mechanism=SCRAM-SHA-512sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \ username="admin" \ password="admin-secret";ssl.truststore.location=/etc/kafka/ssl/truststore.jksssl.truststore.password=truststore-passwordTroubleshooting
Section titled “Troubleshooting”Authorization Failures
Section titled “Authorization Failures”Check broker logs for authorization errors:
grep -i "authorization" /var/log/kafka/server.logExample log entry:
Principal = User:my-app is Denied Operation = Write from host = 10.0.0.1on resource = Topic:LITERAL:orders for request = ProduceListing Effective Permissions
Section titled “Listing Effective Permissions”# List all ACLs to understand effective permissionskafka-acls.sh --bootstrap-server kafka:9092 \ --command-config admin.properties \ --list \ --principal User:my-appCommon Issues
Section titled “Common Issues”| Issue | Cause | Solution |
|---|---|---|
| Producer denied | Missing Write or Describe | Add both operations |
| Consumer denied | Missing Group permission | Add Read on consumer group |
| Idempotent denied | Missing cluster permission | Add IdempotentWrite on cluster |
| Transactional denied | Missing transactional-id permission | Add Write on transactional-id |
Related Documentation
Section titled “Related Documentation”- Configuration Overview - Configuration guide
- Security Overview - Security architecture
- Authentication - SASL and SSL
- Authorization - Authorization concepts