Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CURL:必须指定cacert_Curl_Debian_Ssl Certificate - Fatal编程技术网

CURL:必须指定cacert

CURL:必须指定cacert,curl,debian,ssl-certificate,Curl,Debian,Ssl Certificate,我对curl和https有问题。我必须在每次请求时指定cacert,有人能告诉我怎么做吗?我用debian jessie $ curl -XGET --cacert /etc/ssl/certs/ca-certificates.crt 'https://www.google.com' <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE&

我对curl和https有问题。我必须在每次请求时指定cacert,有人能告诉我怎么做吗?我用debian jessie

$ curl -XGET --cacert /etc/ssl/certs/ca-certificates.crt 'https://www.google.com'
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://www.google.fr/?gfe_rd=cr&amp;ei=M69TWfebI4P_8AeJ1KPACA">here</A>.
</BODY></HTML>
当然我不想忽视认证,我想解决这个问题

我的卷发版本:

$ curl --version
curl 7.38.0 (x86_64-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.2k zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP

从-v输出看,它似乎正在进入正确的文件夹,但无法获取证书

尝试执行此操作以更新当前CA列表

cd /etc/ssl/certs
sudo wget http://curl.haxx.se/ca/cacert.pem

我认为curl查看的是.pem文件而不是.crt文件。另请参见此线程

您是否可以添加更多详细信息,如CURL的版本以及当前的cacert路径设置为什么?@KaushalKumarPanday这里您很抱歉延迟。cacert路径如curl-vI所示,它决定卸载并重新安装ca证书包,并解决了这个问题。rm/etc/ca-certificates.conf apt get clean apt get install-REPLAY ca certificates尝试此操作后,我遇到了相同的错误。我决定卸载并重新安装软件包ca证书,现在它可以工作了!非常感谢您的帮助:
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
cd /etc/ssl/certs
sudo wget http://curl.haxx.se/ca/cacert.pem