Curl says “requested domain name does not match the server's certificate,” but it appears to match

北战南征 提交于 2020-12-07 07:19:44

问题


I've set up a server on my local network, but I'm stymied troubleshooting HTTPS connections. When I use curl -v to make a request, I'm told, "requested domain name does not match the server's certificate."

But the output itself appears to indicate that the domain does match: "reg.qa"

What's the real issue here?

$ curl -v https://reg.qa/
* Added reg.qa:443:172.18.0.4 to DNS cache
* About to connect() to reg.qa port 443 (#0)
*   Trying 172.18.0.4...
* Connected to reg.qa (172.18.0.4) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* Server certificate:
*   subject: CN=reg.qa,OU=Web Test,O=MYORG,ST=CA,C=US
*   start date: Mar 11 20:53:04 2020 GMT
*   expire date: Mar 10 20:53:04 2025 GMT
*   common name: reg.qa
*   issuer: CN=reg.qa,OU=Web Test,O=MYORG,ST=CA,C=US
* NSS error -12276 (SSL_ERROR_BAD_CERT_DOMAIN)
* Unable to communicate securely with peer: requested domain name does not match the server's certificate.
* Closing connection 0
curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.

回答1:


  • NSS error -12276 (SSL_ERROR_BAD_CERT_DOMAIN)

As far as I know newer versions of NSS require that the certificate uses subject alternative names (SAN) to describe the valid domains. Using the common name (CN) is obsolete for many years and several browsers and TLS stacks started to enforce this a while ago.



来源:https://stackoverflow.com/questions/60644617/curl-says-requested-domain-name-does-not-match-the-servers-certificate-but-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!