如何解决【curl:(60)SSL证书问题:证书链中的自签名证书】

问题描述 投票:0回答:2

我想在我的 Linux 计算机上安装 nvm。 (我的Debian版本是10,Git版本是2.27。OPENSSL版本是1.1.1d 10 Sep 2019)

我阅读了此文档https://github.com/nvm-sh/nvm#install--update-script 我输入这个脚本。

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

这就是结果。

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

我阅读了此文档https://curl.haxx.se/docs/sslcerts.html但我不明白该怎么做。于是上网查了一下,发现需要配置代理。

export http_proxy="http://webfilter.**********.com:8000/"
export https_proxy="http://webfilter.**********.com:8000/"

我在终端中输入了这些命令并再次尝试了此脚本。

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

然后我得到相同的结果。

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

接下来,我将此命令放入我的终端中

curl -Is http://www.google.com | head -1 | grep 200

我明白了

HTTP/1.1 200 OK

这意味着我不需要代理。

接下来,我尝试了这个解决方案。

github:服务器证书验证失败

sudo apt-get install --reinstall ca-certificates
sudo mkdir /usr/local/share/ca-certificates/cacert.org
sudo wget -P /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt
sudo update-ca-certificates
git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt

我已经完成了所有这些命令并再次尝试,但收到了相同的错误消息。

如何解决这个问题?

git ssl github curl
2个回答
1
投票

这个方法你试过吗?

curl -k https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh

为了清楚起见,请阅读 mancurl


0
投票

要解决 cURL 60: SSL 证书问题:自签名证书问题,您有两个主要选择:

选项 1:忽略 SSL 验证

在 cURL 命令中,添加 -k 或 --insecure

选项 2:使用特定的 SSL 证书

如果您有权访问自签名证书,则可以配置 cURL 来使用它。首先,确保您拥有证书文件(例如 my-cert.pem)。

对于卷曲:curl --cacert /path/to/my-cert.pem https://example.com

© www.soinside.com 2019 - 2024. All rights reserved.