使用Kafka 1.1版
我已在一个端口上为客户端启用了SASL,同时使用PLAINTEXT将代理间通信转移到另一个端口。
问题是,如下所述为客户端设置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组时,会收到以下消息:
错误:由于未获得访问组的授权,执行消费者组命令失败:组授权失败。
当我尝试使用Kafka工具读取指定消费者组testavroCons的偏移量时的Simmilar。我看不到他们。我什至没有在列表中看到testavro主题。
在这种情况下还需要其他什么特权?我知道这是ACL问题,但我想避免使用全局规则。 Zookeeper上或Zookeeper与经纪人之间是否缺少某些设置?
答案 0 :(得分:0)
要使用户u
能够描述从主题g
消费的组t
,这些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
答案 1 :(得分:0)
需要两件事。
(除了对客户端-服务器角色以及身份验证与授权的安全性有很好的理解!)
首先将用户添加到SASL配置中。既适合经纪人,也适合客户。
(解决身份验证部分)
第二已将新用户作为超级用户添加到Kafka代理server.properties。
(解决授权部分)
详细信息(仅一个示例为例):
经纪人方面的 jaas配置
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
user_testuser="testuser_password";
};
jaas配置“客户端”端
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