我已经使用 kafka 设置了 jaas 配置sasl.jaas.config
财产。我想更新此配置并动态添加用户。
根据这个文档 -http://kafka.apache.org/11/documentation.html#dynamicbrokerconfigs http://kafka.apache.org/11/documentation.html#dynamicbrokerconfigs,我们可以通过使用来做到这一点bin/kafka-configs.sh
.
The above doc has config column, which says as follow -
我尝试过更新sasl.jaas.config
使用以下命令:
bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type brokers --entity-name 59 --alter --add-config sasl.jaas.config="KafkaServer {\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username=\"myuser\"\n password=\"mypassword\";\n};\nClient {\n org.apache.zookeeper.server.auth.DigestLoginModule required\n username=\"myuser2\"\n password=\"mypassword2\";\n};"
但它给了我以下错误:
requirement failed: Invalid entity config: all configs to be added must be in the format "key=val"
如果我查看上面的列,它会显示值的格式sasl.jaas.config
财产是(=)*
。这意味着什么?
应如何传递“sasl.jaas.config”的值来动态更新 jaas 配置?
虽然可以动态更新sasl.jaas.config
为了添加更多用户,默认的普通登录模块不打算在生产中使用。
相反,您应该定义回调处理程序来处理用户身份验证。这在Kafka Sasl 普通文档 http://kafka.apache.org/documentation/#security_sasl_plain_production.
另一个需要更多工作(但提供更多灵活性)的选项是创建您自己的登录模块。该过程描述于Kafka可以提供自定义LoginModule来支持LDAP吗? https://stackoverflow.com/questions/47295512/can-kafka-be-provided-with-custom-loginmodule-to-support-ldap/47295711#47295711
关于您收到的错误消息,这似乎是一个问题kafka-config.sh
工具。它不期望配置值包含=
。您应该能够使用 AdminClient API 更新该配置。
我在 JIRA 中找不到现有问题,因此创建了一个新问题:https://issues.apache.org/jira/browse/KAFKA-8010 https://issues.apache.org/jira/browse/KAFKA-8010
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)