Remove all the Kafka ACLs
Asked Answered
V

3

5

Do you know any command to remove all the available ACLs from Kafka? If you added literal ACLs to Kafka, when you want to remove it you cannot use prefixed or ... (it just doesn't match with the literal ACLs).

Thanks.

Vamp answered 18/4, 2019 at 15:56 Comment(1)
I assume you're using the default ACL provider? If so, then the commands would probably require a direct Zookeeper connectionNovikoff
B
5

You can use the --remove flag of kafka-acl tool, which removes all the acls applied to the topic. Simply loop the command through all the topics.

for each TOPIC in topicList:

./kafka-acls --authorizer kafka.security.auth.SimpleAclAuthorizer \
--authorizer-properties zookeeper.connect=$ZOOKEEPER \
--topic $TOPIC --remove
Balough answered 20/11, 2020 at 22:40 Comment(0)
L
2

You can use kafka-acls --bootstrap-server kafka:9092 --remove --topic *. The --topics argument accepts wildcards:

--topic <String: topic>                  topic to which ACLs should be added or 
                                           removed. A value of * indicates ACL  
                                           should apply to all topics.
Livable answered 5/5, 2021 at 12:49 Comment(0)
A
0

The proposed solutions did not work for me, the ACLs were not deleted unless they matched exactly.

My workaround was to use the AdminClient directly:

        try (AdminClient adminClient = AdminClient.create(props)) {
            adminClient.deleteAcls(
                    List.of(new AclBindingFilter(ResourcePatternFilter.ANY, AccessControlEntryFilter.ANY)));
        }
Avner answered 23/2, 2022 at 11:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.