curl:(60)SSL 证书问题:无法获取本地颁发者证书

curl:(60)SSL 证书问题:无法获取本地颁发者证书

编辑: 我已经从 curl.haxx.se 更新了我的根 CA 证书。


当我尝试时,结果中curl -Iv https://yahoo.com出现了错误。但是如果我尝试,我会得到没有任何错误的结果。unable to get local issuer certificatecurl -Iv --cacert /etc/ssl/certs/ca-certificates.crt https://yahoo.com

奇怪的是,curl -Iv https://google.com它能正常工作。但curl -Iv https://deb.nodesource.com实际上却不能。

有没有机会解决这个问题?(通过改变 curl 配置等)

root@ip-172-31-40-176:/var# curl -Iv https://yahoo.com
* Rebuilt URL to: https://yahoo.com/
* Hostname was NOT found in DNS cache
*   Trying 206.190.36.45...
* Connected to yahoo.com (206.190.36.45) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

答案1

因为 curl 无法验证服务器提供的证书。

绕过的方法有两种:

1.添加-k选项,允许 curl 建立不安全的连接,不验证证书。

2.添加根卷曲ca(在这里下载) 到/etc/ssl/certs/nodesource-ca.crt

答案2

或者,对我来说,只需这样做:

sudo apt-get install ca-certificates

相关内容