【问题标题】:False positive kafka-authorizer.log when using listTopics() of KafkaConsumer使用 KafkaConsumer 的 listTopics() 时出现误报 kafka-authorizer.log
【发布时间】:2021-02-11 01:19:41
【问题描述】:

当对集群中的每个主题使用listTopics() method from KafkaConsumer 时,用户没有授权,SimpleAuthorizer.scala 在 kafka-authorizer.log 中创建如下日志行:

INFO Principal = User:user is Denied Operation = Describe from host = ip on resource = Topic:LITERAL:topicName (kafka.authorizer.logger)

有没有一种简单的方法可以从 listTopics() 中删除这些“误报”日志,而不会失去访问“外部”主题的真正尝试? 背景:在一个大型共享集群中来自不同独立开发团队的大量主题(一个团队对其自己的主题只有一个“描述”ACL 条目),这会导致大量安全日志,当使用 listTopics() 时,并没有“黑客攻击”的意图.

【问题讨论】:

    标签: apache-kafka kafka-consumer-api


    【解决方案1】:

    向所有用户授予 DESCRIBE acl 操作怎么样? 像这样:

    /bin/kafka-acls --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=zoo-1:2181 --allow-principal User:\* --topic \* --operation describe --add
    /bin/kafka-acls --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=zoo-1:2181 --allow-principal User:\* --group \* --operation describe --add
    /bin/kafka-acls --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=zoo-1:2181 --allow-principal User:\* --cluster \* --operation describe --add
    

    【讨论】:

    • 集群是共享的,授予如此广泛的Describe权限将允许任何用户查看集群上的所有主题和消费者组——即使是他们无权使用的那些。有时这是不可取的。例如,如果用户是客户,并且他们每个人都有权访问自己的主题,例如 customerFoocustomerBar,那么客户 Foo 不应该能够描述集群并看到 Bar 也是客户。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 2021-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多