asp.net - 如何使用 Co Fluent 库在 Windows 上通过 Kerberos 身份验证连接到 Kafka 集群?

标签 asp.net .net-core apache-kafka kerberos

我正在开发一个项目,该项目需要我使用 dotnet 和 Confluence 库连接到现有的 Kafka 集群。 Kafka集群使用Kerberous/Keytab身份验证。看看一些documentation看起来您可以使用 JAAS 配置传递 keytab 文件,但是当我查看 Confluence 中 ProudcerConfig 的属性时,我没有看到任何有关身份验证的信息。那么如何指定 keytab 文件以便我可以针对 Kafka 集群进行身份验证?

最佳答案

我认为this section of Confluent docs提到如何配置客户端:

在您的 client.properties 文件中,您需要以下配置:

sasl.mechanism=GSSAPI
# Configure SASL_SSL if SSL encryption is enabled, otherwise configure SASL_PLAINTEXT
security.protocol=SASL_SSL

sasl.kerberos.service.name=kafka

sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required \
    useKeyTab=true \
    storeKey=true \
    keyTab="/etc/security/keytabs/kafka_client.keytab" \
    principal="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="553e34333e3436393c303b216415100d14180519107b161a18" rel="noreferrer noopener nofollow">[email protected]</a>";

# optionally - kafka-console-consumer or kafka-console-producer, kinit can be used along with useTicketCache=true
sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required \
   useTicketCache=true;

为了将 client.properties 传递给例如kafka-console-consumer 您还需要提供 --consumer.config 参数:

对于 Linux:

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test  --consumer.config client.properties --from-beginning

对于 Windows:

bin/kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --consumer.config client.properties --from-beginning

关于asp.net - 如何使用 Co Fluent 库在 Windows 上通过 Kerberos 身份验证连接到 Kafka 集群?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56395729/

相关文章:

c# - ASP Net Core - 如何进行多级路由继承?

elasticsearch - 在 kafka elasticsearch 连接器中使用 elasticsearch 生成的 ID

apache-kafka - Zookeeper中的Kafka消费者路径为空?

javascript - 必填字段验证器不适用于 JQuery 选择的下拉列表

c# - 信号R : Access Hub class from another project

c# - 离开页面时记住 Cascading Dropdown 值

c# - 尝试路由到特定 URL 时找不到目录错误

c# - 我在 Azure Function Monitor 日志屏幕中看到条目。如何在 Application Insights 中找到它们?

angular - dotnet core + Angular Universal + docker => 由于错误 : Error: Cannot find module,预渲染失败

apache-kafka - 使用命令行在kafka中使用消息时如何设置组名?