首页 文章

Kafka ACLs - 在设置ACL后无法在Kafka Tool中描述组或视图偏移

提问于
浏览
0

使用Kafka 1.1版
我在客户端的一个端口上启用了SASL,同时使用PLAINTEXT将interbroker通信移动到其他端口 .
问题是我在为客户端设置ACL之后发现有关主题和组的信息时遇到了麻烦,如下所述 .

server.properties - 下面添加了条目
allow.everyone.if.no.acl.found=true super.users=User:admin (user included in jaas config file)

创建主题"testavro"并按以下方式为其中一个主题设置ACL:
kafka-acls --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:cons --consumer --topic testavro --group testavroCons


kafka-acls --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:prod --producer --topic testavro

现在 生产环境 和消费工作就好了 .
但是当我尝试使用kafka-consumer-group工具来描述testavroCons组时,我会得到以下信息:
错误:由于未授权访问组,执行使用者组命令失败:组授权失败 .

Simmilar当我尝试使用Kafka Tool来读取指定消费者组testavroCons的偏移时 . 我不明白他们 . 我现在甚至都没有在列表中看到testavro主题 .

在这种情况下还需要哪些其他权限?我理解它的ACL问题,但我想避免全局规则 . Zookeeper或Zookeeper与经纪人之间是否有设置缺失?

2 回答

  • 0

    有两件事需要 .
    (除了很好地理解客户端 - 服务器角色和身份验证与授权之间的安全性!)

    First 将用户添加到SASL配置 . 经纪人和客户都是 .
    (解决认证部分)
    Second 将新用户作为SuperUser添加到Kafka broker server.properties .
    (解决授权部分)

    Details (仅以一个条目为例):
    经纪人方面的jaas配置

    KafkaServer {
         org.apache.kafka.common.security.plain.PlainLoginModule required
         user_testuser="testuser_password";
     };
    

    jaas配置"client"方

    security.protocol=SASL_PLAINTEXT
    sasl.mechanism=PLAIN
    sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
    username=\"testuser\" password=\"testuser_password\";
    

    server.properties

    super.users=User:testuser
    

    现在我跑的时候
    (其中kafka_tools_jaas.conf包含客户端的jaas配置)它运行良好 .

    kafka-consumer-groups --describe --group testavroCons --bootstrap-server server:port --command-config /tmp/kafka_tools_jaas.conf
    
  • 0

    对于用户 u 能够描述从主题 t 消耗的组 g ,这些ACL权限是必需的:

    bin/kafka-acls.sh --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:u --operation Describe --group g
    bin/kafka-acls.sh --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:u --operation Describe --topic t
    

    Reference

相关问题