我正在尝试通过 cURL(我可以在几天前访问)访问内部站点。但是,cURL 给出了错误curl: (60) SSL certificate problem: certificate has expired。如果我openssl用来检查证书的开始和结束日期,它会给出一个我很好的时间范围:
echo | openssl s_client -connect internalsite.example.com:443 2>/dev/null | openssl x509 -noout -dates
notBefore=Nov 30 00:00:00 2012 GMT
notAfter=Mar 30 12:00:00 2016 GMT
# For reference, the day I'm posting this is July 30th, 2014
Run Code Online (Sandbox Code Playgroud)
此外,如果我在另一台计算机上使用 cURL,或通过浏览器(Firefox、Chrome 或 IE)进行连接,则可以正常连接。
另外,我无法在自己的计算机上连接任何版本的 cURL;这包括虚拟机内的 Cygwin 中的 cURL 和 Ubuntu 上的 cURL,以及 Windows 版本。
什么可能导致这种行为?
您的证书包可能已过期。
您可以在http://curl.haxx.se/ca/cacert.pem获取由curl 开发人员维护的一个
使用方法:
<?
$ch = curl_init("http://example.com");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, '/path/to/cacert.pem');
$response = curl_exec($ch);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8912 次 |
| 最近记录: |