Curl无法验证Verisign发出的通配符SSL证书

时间:2015-03-10 16:52:00

标签: php ssl curl https

我有一个脚本需要使用cURL来安全地连接到* .bar.com的通配符SSL证书所覆​​盖的网站foo.bar.com。

通配符证书由Verisign颁发,所有浏览器都信任它,没有任何问题。但是,我无法连接PHP / cURL(至少在没有禁用证书验证的情况下)。

为了隔离问题,我尝试使用命令行cURL(版本7.21.1)进行连接。我从Mozilla下载了一个更新的CA包(保存为cacert.pem),然后运行:

curl --cacert /path/to/cacert.pem "https://foo.bar.com"

结果是:

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

我已经谷歌搜索并在帖子后阅读有关此错误的帖子,但似乎无法到达任何地方。

如果我尝试任何普通的非通配符证书域,它似乎工作正常,所以它似乎本地化到这个特定的通配符证书问题。我甚至手动导出了信任链中的所有证书,并手动将它们添加到cacert.pem文件中(只是为了查看CA捆绑包是否缺少某些内容),而且仍然没有。

最终,我想在PHP cURL中使用它,但我想如果我能用命令行cURL确定问题,那么该解决方案也可能适用于PHP脚本。

1 个答案:

答案 0 :(得分:4)

由于缺少链证书,问题可能不是卷曲而是不完整的信任链。桌面浏览器的问题较少,因为他们在访问其他网站时会缓存此类证书,而某些浏览器甚至会下载丢失的证书。

标题为SSLLabs并检查网站。留意“连锁问题”。

如果我的回答有误,请添加相关网址以及您使用的curl版本,以便人们仔细查看。

相关问题