我得到以下错误使用卷曲:
curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none
如何设置证书验证位置?
我得到以下错误使用卷曲:
curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none
如何设置证书验证位置?
当前回答
把这个放到你的。bashrc中
# fix CURL certificates path
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
(见罗伯特的评论)
其他回答
如果有人仍然有问题,试试这个,它对我很有效。 删除/etc/ssl/certs/目录下的文件 然后重新安装ca-certificates:
sudo apt install ca-certificates --reinstall
当我尝试安装Linuxbrew时,我这样做了。
对于在XAMPP上运行的PHP代码,我发现我需要编辑PHP .ini以包括以下内容
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = curl-ca-bundle.crt
然后复制到一个文件https://curl.haxx.se/ca/cacert.pem并重命名为curl-ca-bundle。crt并将其放置在\xampp路径下(我无法获得curl。卡帕特工作)。我还发现cURL站点上的CAbundle对于我正在连接的远程站点来说是不够的,所以使用了http://winampplugins.co.uk/curl/上列出的预编译的Windows版本的cURL 7.47.1
从$ man curl:
--cert-type <type>
(SSL) Tells curl what certificate type the provided certificate
is in. PEM, DER and ENG are recognized types. If not specified,
PEM is assumed.
If this option is used several times, the last one will be used.
--cacert <CA certificate>
(SSL) Tells curl to use the specified certificate file to verify
the peer. The file may contain multiple CA certificates. The
certificate(s) must be in PEM format. Normally curl is built to
use a default file for this, so this option is typically used to
alter that default file.
我在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。
我还安装了最新版本的ca-certificates,但仍然出现错误:
curl: (77) error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
问题是curl希望证书位于/etc/pki/tls/certs/ca-bundle.路径下但是无法找到它,因为它位于/etc/ssl/certs/ca-certificates.crt路径下。
通过运行将我的证书复制到预期的目的地
sudo cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
为我工作。如果目标目的地不存在文件夹,则需要运行命令为其创建文件夹
sudo mkdir -p /etc/pki/tls/certs
如果需要,修改上面的命令,使目标文件名与curl期望的路径匹配,即替换/etc/pki/tls/certs/ca-bundle.在错误消息中使用“CAfile:”后面的路径。