我得到以下错误使用卷曲:

curl: (77) error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none

如何设置证书验证位置?


当前回答

如果有人仍然有问题,试试这个,它对我很有效。 删除/etc/ssl/certs/目录下的文件 然后重新安装ca-certificates:

sudo apt install ca-certificates --reinstall

当我尝试安装Linuxbrew时,我这样做了。

其他回答

我使用MobaXterm,实习生使用Cygwin,所以即使在安装ca-certificates后使用apt-cyg安装ca-certificates问题也没有解决。

我仍然得到以下错误:

curl:(77)错误设置证书验证位置:CAfile: /etc/ssl/certs/ca-certificates. confcrt CApath: none

然后我试着列出文件/etc/ssl/certs/ca-certificates。crt和我都找不到。但是我可以找到/usr/ssl/certs/ca-bundle.因此,我复制了文件/usr/ssl/certs/ca-bundle. crtCRT为/etc/ssl/certs/ca-certificates。CRT和问题得到了解决。

把这个放到你的。bashrc中

# fix CURL certificates path
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt

(见罗伯特的评论)

我在Ubuntu 20.04 localhost上试图访问运行在docker容器中的elasticsearch时遇到了这个curl 77问题。集装箱启动后:

Check curl without ssl: curl --cacert http_ca.crt -u elastic https://localhost:9200 -k lowercase -k for insecure connection. Check curl configs: curl-config --configure, noticed what is ca-bundle: --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt. Copy http_ca.crt file from container to:/usr/local/share/ca-certificates/, original command is here. Run update on ca-certificates: sudo update-ca-certificates. Run curl: curl -u elastic:<password> https://localhost:9201. Finally got response with "tagline" : "You Know, for Search".

将<password>修改为运行Docker Image时生成的密码。 还要注意,在我的机器上,弹性是在端口9201上启动的(不知道为什么:sudo ss -tlpn | grep 9200给我什么都没有),我已经找到了端口:sudo netstat -ntlp和程序名称是docker-proxy。

视窗:-

证书从https://curl.se/docs/caextract.html下载 重命名cacert。Pem到curl-ca-bundle.crt 将文件添加到以下任何位置

查看详情https://curl.se/docs/sslcerts.html

似乎您的卷曲指向一个不存在的文件与CA证书或类似。

有关CA certs与curl的主要参考,请参见:https://curl.haxx.se/docs/sslcerts.html