SSL: no alternative certificate subject name matches target host name '127.0.0.1’

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SSL: no alternative certificate subject name matches target host name '127.0.0.1’相关的知识,希望对你有一定的参考价值。

参考技术A 安装git后---获取项目内容:

报错内容:SSL: no alternative certificate subject name matches target host name '127.0.0.1’

解决方法:git config --global http.sslVerify false

不要感觉不像就不试用,找了好久才找到的,亲测有效

为 Nexus 容器启用 HTTPS 后,CURL 上传/下载错误并显示以下错误: curl: 51 SSL: no alternative certificate

【中文标题】为 Nexus 容器启用 HTTPS 后,CURL 上传/下载错误并显示以下错误: curl: 51 SSL: no alternative certificate【英文标题】:After enabling HTTPS for a Nexus Container, CURL upload/downloads error out with the following error: curl: 51 SSL: no alternative certificate 【发布时间】:2022-01-06 15:00:19 【问题描述】:

当我为 Nexus 容器 (v3:3.30.0) 启用 HTTPS 时遇到问题,我不再能够通过 Curl 上传/下载工件,但是 Web UI 确实通过 HTTPS 出现。尝试 curl 时出现以下错误: curl: (51) SSL: no alternative certificate subject matches target host name

我正在使用 keytool 来生成 .jks 和 .pem 文件。然后将 .pem 导入到内部 Active Directory 证书服务。生成证书链后,我将它们重新导入到容器上的密钥库中,并遵循 Sonatype 在其他配置上的最佳实践。

https://help.sonatype.com/repomanager3/system-configuration/configuring-ssl

我重新启动容器并可以通过 HTTPS 访问 UI,但 curl 现在显示以下错误:

[user_a@host_a]$ curl -l -v https://10.88.0.255:8081

Rebuilt URL to: https://10.88.0.255:8081/
  Trying 10.88.0.255...
TCP_NODELAY set
Connected to 10.88.0.255 (10.88.0.255) port 8081 (#0)
ALPN, offering h2
ALPN, offering http/1.1
successfully set certificate verify locations:
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
TLSv1.3 (OUT), TLS handshake, Client hello (1):
TLSv1.3 (IN), TLS handshake, Server hello (2):
TLSv1.2 (IN), TLS handshake, Certificate (11):
TLSv1.2 (IN), TLS handshake, Server key exchange (12):
TLSv1.2 (IN), TLS handshake, Server finished (14):
TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
TLSv1.2 (OUT), TLS handshake, Finished (20):
TLSv1.2 (IN), TLS handshake, Finished (20):
SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
ALPN, server did not agree to a protocol
Server certificate:
 subject: C=XX; ST=XX; L=XXXXXXXX; O=XX-XX; OU=XXX; CN=xxxx-xxxxxxx.xxxxxxxx.com
 start date: Nov 28 19:49:21 2021 GMT
 expire date: Nov 28 19:49:21 2023 GMT
 subjectAltName does not match 10.88.0.255
    SSL: no alternative certificate subject name matches target host name '10.88.0.255'*
Closing connection 0
TLSv1.2 (OUT), TLS alert, close notify (256):
curl: (51) SSL: no alternative certificate subject name matches target host name '10.88.0.255'


Any of the openssl commands that I use against the container

openssl s_client –connect 10.88.1.9:8081 

openssl s_client -connect 10.88.1.9:8081 --showcerts

openssl s_client -connect 10.88.1.9:8081 -tlsextdebug 

openssl s_client -connect 10.88.1.9:8081 -tls1_2

回来


SSL 握手已读取 4590 字节并写入 328 字节 验证:OK

验证返回码:0(ok)

【问题讨论】:

“Web UI”(我假设在浏览器中)是使用地址还是域名?在浏览器中使用的任何名称都应该在 curl 中使用。顺便说一句,它是“替代证书主题 name”——名称可以有替代品,而不是证书;具体来说,证书包含 SubjectAlternativeName 扩展、缩写 SubjectAltName、SubjAltName 或只是 SAN。 【参考方案1】:

所以我让它工作,不确定这是否正确,但它工作......

我用来生成证书请求的 SAN=DNS 条目连同分配给容器的 IP 地址一起放入 /etc/hosts(运行 Podman,容器作为 rootfull)。

一旦这样做,就可以对这些 SAN=DNS 条目使用 curl,同时也可以通过这些条目启动 Nexus Web UI。

【讨论】:

以上是关于SSL: no alternative certificate subject name matches target host name '127.0.0.1’的主要内容,如果未能解决你的问题,请参考以下文章

为 Nexus 容器启用 HTTPS 后,CURL 上传/下载错误并显示以下错误: curl: 51 SSL: no alternative certificate

为啥当我看到通配符条目时出现 javax.net.ssl.SSLHandshakeException: No subject Alternative DNS name matching found 异

使用pip报错:Could not fetch URL https://pypi.org/simple/: There was a problem confirming the ssl certi

使用pip报错:Could not fetch URL https://pypi.org/simple/: There was a problem confirming the ssl certi

使用pip报错:Could not fetch URL https://pypi.org/simple/: There was a problem confirming the ssl certi

There is No Alternative~最小生成树变形