简体   繁体   English

在单个节点上使用SSL与Kafka

[英]Using SSL with Kafka on a single node

I want to have SSL running with Kafka to make it more secure. 我希望让SSL与Kafka一起运行,以使其更安全。 I downloaded Kafka and installed it. 我下载了Kafka并安装了它。 I followed the instruction on creating certificates and truststore for SSL with no problem. 我按照关于为SSL创建证书和信任库的说明没有问题。 I added the following into my config/server.properties 我在config / server.properties中添加了以下内容

ssl.enabled.protocols=TLSv1.2,TLSv1.1,TLSv1
ssl.keystore.type=JKS
ssl.truststore.type=JKS

listeners=PLAINTEXT://localhost:9092,SSL://localhost:9093
ssl.endpoint.identification.algorithm=HTTPS
security.inter.broker.protocol=SSL
ssl.secure.random.implementation=SHA1PRNG
ssl.endpoint.identification.algorithm=HTTPS
ssl.keystore.location=/home/ec2-user/workspace/kafka/cert/server.keystore.jks
ssl.key.password=<the password>
ssl.keystore.password=<the password>
ssl.truststore.location=/home/ec2-user/workspace/kafk/cert/server.truststore.jks
ssl.truststore.password=<the password>

After Starting Zookeeper, I am getting this error when I start kafak: [2017-12-07 16:02:52,155] ERROR [Controller id=0, targetBrokerId=0] Connection to node 0 failed authentication due to: SSL handshake failed (org.apache.kafka.clients.NetworkClient). 在启动Zookeeper之后,当我启动kafak时出现此错误:[2017-12-07 16:02:52,155] ERROR [Controller id = 0,targetBrokerId = 0]由于以下原因,与节点0的连接验证失败:SSL握手失败( org.apache.kafka.clients.NetworkClient)。 I have to kill the task to stop this message 我必须杀死任务才能阻止这条消息

looking at logs/controller.log : logs/controller.log

[Controller-0-to-broker-0-send-thread]: Controller 0's connection to broker localhost:9093 (id: 0 rack: null) was unsuccessful (kafka.controller.RequestSendThread)

Do you have to open the firewall on port 9093? 你必须在端口9093上打开防火墙吗?

Thank you 谢谢

Handshake failed usually means that they were able to talk to each other but unable to agree. 握手失败通常意味着他们能够互相交谈但无法达成一致。

You should try without the ssl.endpoint.identification.algorithm=HTTPS line in the config. 您应该尝试在配置中没有ssl.endpoint.identification.algorithm=HTTPS行。 Quite often a hostname mismatch in the certificate check is the cause for stuff like this.. 通常,证书检查中的主机名不匹配是导致此类内容的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM