Search code examples
apache-kafkaaclkafka-clusterapache-kafka-security

ACLs for cluster resource in kafka


What are the cluster operations in kafka and what all operations can be allowed/denied by specifying --cluster option in kafka-acls.sh script?

From this

The inter-broker operations are split into two classes: cluster and topic. Cluster operations refer to operations necessary for the management of the cluster, like updating broker and partition metadata, changing the leader and the set of in-sync replicas of a partition, and triggering a controlled shutdown

But I'am not able to understand the actual use-cases here.


Solution

  • This is an interesting one.

    Following are the 2 use cases I could think of:

    1. Graceful shutdown of brokers - In some situations, you may need to bring down a broker intentionally for maintenance or configuration changes. Kafka provides the ControlledShutdown API for this purpose. This API has 2 main optimisations i.e. all logs in buffer cache are flushed to the disk to avoid any recovery and migrating any partitions to other brokers for which the broker shutting down is the leader for. This operation however isn't something that one would prefer to just open up so setting an ACL would help here. So, by default you could choose to disable this and then add ACL like the following:

    Principal P is Allowed Operation "CLUSTER_ACTION" From Host H On Resource "CLUSTER"

    1. Deleting ACLs for topics (Another cluster operation) - If you choose to delete a topic in Kafka then the ACLs related to that topic aren't automatically deleted. They need to be deleted explicitly. Similar to the first one, you wouldn't want to allow any user to run this for an operational topic. So, you could add an ACL similar to the first one to allow only specific principals to carry out this operation.

    I'll add more as I learn about them.

    Hope this helps!