Curl 无法验证 Verisign 颁发的通配符 SSL 证书
Curl cannot verify wildcard SSL certificate issued by Verisign
我有一个脚本需要使用 cURL 来安全地连接到一个网站,foo.bar.com 它被 *.bar.com.
的通配符 SSL 证书所涵盖
通配符证书由威瑞信颁发,所有浏览器都信任它,没有任何问题。但是,我无法获得 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.
我一直在谷歌搜索并在 post 之后阅读 post 关于此错误的信息,但似乎无处可去。
如果我尝试任何正常的非通配符证书域,它似乎工作得很好,所以它似乎局限于这个特定的通配符证书问题。我什至手动导出了信任链中的所有证书并手动将它们添加到 cacert.pem 文件中(只是为了查看 CA 捆绑包是否缺少某些东西),但仍然没有。
最终,我想让它在 PHP cURL 中工作,但我想如果我能确定命令行 cURL 的问题,解决方案可能适用于 PHP 脚本,还有。
问题可能不是 curl,而是由于缺少链证书而导致信任链不完整。桌面浏览器在这方面的问题较少,因为它们在访问其他站点时会缓存此类证书,有些浏览器甚至会下载丢失的证书。
转到 SSLLabs 并检查站点。注意 "Chain Issues".
如果我的回答有误,请添加相关的URL以及您使用的curl版本,以便仔细查看。
我有一个脚本需要使用 cURL 来安全地连接到一个网站,foo.bar.com 它被 *.bar.com.
的通配符 SSL 证书所涵盖通配符证书由威瑞信颁发,所有浏览器都信任它,没有任何问题。但是,我无法获得 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.
我一直在谷歌搜索并在 post 之后阅读 post 关于此错误的信息,但似乎无处可去。
如果我尝试任何正常的非通配符证书域,它似乎工作得很好,所以它似乎局限于这个特定的通配符证书问题。我什至手动导出了信任链中的所有证书并手动将它们添加到 cacert.pem 文件中(只是为了查看 CA 捆绑包是否缺少某些东西),但仍然没有。
最终,我想让它在 PHP cURL 中工作,但我想如果我能确定命令行 cURL 的问题,解决方案可能适用于 PHP 脚本,还有。
问题可能不是 curl,而是由于缺少链证书而导致信任链不完整。桌面浏览器在这方面的问题较少,因为它们在访问其他站点时会缓存此类证书,有些浏览器甚至会下载丢失的证书。
转到 SSLLabs 并检查站点。注意 "Chain Issues".
如果我的回答有误,请添加相关的URL以及您使用的curl版本,以便仔细查看。