【问题标题】:Kafka SSL handshake failed issueKafka SSL 握手失败问题
【发布时间】:2019-05-05 23:14:27
【问题描述】:

我正在尝试在我的 Kafka 服务器上启用 SSL 身份验证。我正在关注7.2 section in the Kafka documentation

遵循所有步骤,但在调用 producer.bat 文件将数据发送到主题时,我得到以下错误。

错误 [Producer clientId=console-producer] 连接到节点 -1 身份验证失败,原因是:SSL 握手失败 (org.apache.kafka.clients.NetworkClient)

原因: java.security.cert.CertificateException:找不到与本地主机匹配的名称

我确实使用CN=localhost 创建了证书。

【问题讨论】:

    标签: ssl apache-kafka certificate jks


    【解决方案1】:

    可以通过在客户端将ssl.endpoint.identification.algorithm 设置为空字符串来禁用服务器主机名验证。

    【讨论】:

    • 我遇到了同样的问题,并将 ssl.endpoint.identification.algorithm 和 listener.name.internal.ssl.endpoint.identification.algorithm 设置为 server.properties 文件中的空字符串“自定义” Ambari 的 kafka-broker 部分。我在所有 3 个节点上重新启动了 Kafka,但此错误仍然存​​在。有什么想法吗?
    【解决方案2】:

    刚刚设置 ssl.endpoint.identification.algorithm= 它可以帮助你。

    即具有空值:

    ssl.endpoint.identification.algorithm=
    

    【讨论】:

    • 一行是 "ssl.endpoint.identification.algorithm=" ,不要在=之后添加任何内容
    • 其实这就是解决方案。您需要将归档的内容留空以跳过验证。请注意,这样做被认为是一种不好的做法,绝不应该在生产中使用,因为它会禁用 ssl 验证并引发一系列攻击。
    【解决方案3】:

    对我来说,输入 Keytool 的名字和姓氏是个问题

    【讨论】:

      【解决方案4】:

      一般java.security.cert.CertificateException: No name matching localhost found表示证书中的主机名与服务器的主机名不匹配。

      这里对这个错误有很好的解释:CertificateException: No name matching ssl.someUrl.de found

      【讨论】:

        【解决方案5】:

        我们遇到以下错误,这可能是因为 Kafka 的版本从 1.x 升级到 2.x。

        javax.net.ssl.SSLHandshakeException: 一般 SSLEngine 问题 ... javax.net.ssl.SSLHandshakeException: 一般 SSLEngine 问题 ... java.security.cert.CertificateException: 找不到名称匹配 ***

        [Producer clientId=producer-1] 连接到节点 -2 身份验证失败,原因是:SSL 握手失败

        ssl.endpoint.identification.algorithm 的默认值已更改为 https,它执行主机名验证(否则可能发生中间人攻击)。将 ssl.endpoint.identification.algorithm 设置为空字符串以恢复之前的行为。 Apache Kafka Notable changes in 2.0.0

        解决方案: SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG, ""

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2022-11-18
          • 1970-01-01
          • 1970-01-01
          • 2021-07-03
          • 2018-07-28
          • 1970-01-01
          • 2019-07-21
          相关资源
          最近更新 更多