加载中

排查 SSLHandshakeException 和节点连接失败问题

症状

  • SSLHandshakeException 会导致到节点的连接失败,并表明存在配置问题。下面列出了一些常见的异常以及如何解决这些问题的提示。

解决方法

java.security.cert.CertificateException: No name matching node01.example.com found
表示客户端连接到了 node01.example.com,但返回的证书中不包含名称 node01.example.com。在大多数情况下,可以通过确保在创建证书时指定了该名称来解决此问题。有关更多信息,请参阅 使用 TLS 加密节点间通信。另一种情况是环境根本不想在证书中使用 DNS 名称。在这种情况下,elasticsearch.yml 中的所有设置(包括 network.publish_host 设置)都应仅使用 IP 地址。
java.security.cert.CertificateException: No subject alternative names present
表示客户端连接到了一个 IP 地址,但返回的证书不包含任何 SubjectAlternativeName 条目。只有当 IP 地址在创建证书时被指定为 SubjectAlternativeName 时,它们才会被用于主机名验证。如果打算使用 IP 地址进行主机名验证,则需要使用相应的 IP 地址重新生成证书。请参阅 使用 TLS 加密节点间通信
javax.net.ssl.SSLHandshakeException: null cert chainjavax.net.ssl.SSLException: Received fatal alert: bad_certificate
SSLHandshakeException 表示客户端返回了一个不受信任的自签名证书,因为它无法在 truststorekeystore 中找到。此 SSLException 出现在连接的客户端侧。
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetjavax.net.ssl.SSLException: Received fatal alert: certificate_unknown
SunCertPathBuilderException 表示在握手过程中返回了一个不受信任的证书。此消息出现在连接的客户端侧。而 SSLException 出现在连接的服务端侧。签发该返回证书的 CA 证书未在 keystoretruststore 中找到,需要将其添加以信任该证书。
javax.net.ssl.SSLHandshakeException: Invalid ECDH ServerKeyExchange signature

Invalid ECDH ServerKeyExchange signature 可能表明密钥和对应的证书不匹配,从而导致握手失败。请验证您用于配置的证书颁发机构、证书和密钥的每个文件的内容。特别要检查密钥和证书是否属于同一个密钥对。

© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.