我可以通过使用ssh的克隆项目推送,但它不工作时,我克隆项目与https。
它显示的错误信息是:
server certificate verification failed. CAfile: /etc/ssl/certs/cacertificates.crt CRLfile: none
我可以通过使用ssh的克隆项目推送,但它不工作时,我克隆项目与https。
它显示的错误信息是:
server certificate verification failed. CAfile: /etc/ssl/certs/cacertificates.crt CRLfile: none
当前回答
我尝试了很多解决方法,但没有一个对我有效。我有4个运行在ubuntu 16.04上的服务器,我实际上能够解决这个问题的方法有3个(你应该首先sudo apt update):
更新openssl,因为我安装的版本缺少一个修复程序,可以让一些解决方案在这里工作。Sudo apt install——only-upgrade openssl。Openssl至少需要1.0.2g-1ubuntu4.20版本。 然后我必须对certs做同样的事情:sudo apt install——only-upgrade ca-certificates 然后重新配置certs sudo dpkg-reconfigure ca-certificates(我猜是编辑配置文件)并从列表中删除DST_Root_CA_X3才会带来积极的结果。
其他回答
注意:这具有重大的安全影响。
如果您在专用网络中使用git服务器,并使用自签名证书或IP地址证书;你也可以简单地使用git全局配置来禁用SSL检查:
git config --global http.sslverify "false"
基于VonC给出的非常好的答案,我刚刚创建了一个bash脚本,将缺失的x509证书安装到证书包中。它适用于基于debian的linux发行版。
#!/bin/bash
CERTIFICATE_PEM=certificate.pem
CERTIFICATE_CRT=certificate.crt
# get certificate
echo -n | openssl s_client -showcerts -connect gitlab.sehlat.io:443 \
2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
> $CERTIFICATE_PEM
# format certificate from PEM (human-readable) to CRT
openssl x509 -in $CERTIFICATE_PEM -out $CERTIFICATE_CRT
# move it to ca-certificates folder & update the bundle file
sudo mv ./$CERTIFICATE_CRT /usr/local/share/ca-certificates/
sudo update-ca-certificates
# configuring git
git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
让我们加密2021年9月30日根CA到期
这个错误的另一个来源是一个过期的根CA,如果你使用Let's Encrypt,它昨天发生在其中一个根CA上: https://docs.certifytheweb.com/docs/kb/kb-202109-letsencrypt/
您可以通过运行来确认
openssl s_client -showcerts -connect $hostname:$port -servername $hostname | grep "certificate has expired"
在这种情况下,您需要在/etc/gitlab/ssl/$hostname.crt中编辑gitlab证书
将文件中过期的DST根CA X3块替换为https://letsencrypt.org/certs/isrgrootx1.pem的内容,并重新加载服务器。
我搞砸了我的CA文件,而我设置goagent代理。不能从github拉数据,并得到相同的警告:
服务器证书验证失败。CAfile: /etc/ssl/certs/ca-certificates。crt CRLfile:无
使用Vonc的方法,从github获取证书,并将其放入/etc/ssl/certs/ca-certificates。Crt,问题解决了。
echo -n | openssl s_client -showcerts -connect github.com:443 2>/dev/null | sed -ne '/- begin CERTIFICATE-/,/- end CERTIFICATE-/p'
也有同样的问题。由自己颁发的证书颁发机构引起。 通过在/usr/local/share/ca-certificates/中添加.pem文件解决 和调用
sudo update-ca-certificates
PS:“/share/ca-certificates”文件夹下的pem文件必须有扩展名。crt