SSL证书和cURL:证书包还是不受信任的证书?

时间:2016-02-19 14:59:32

标签: security ssl curl https

我们有一个webapp,它提取XML文件以验证XML模式。该应用程序运行在几年前设置的Ubuntu服务器上。

存在一个问题,即某个给定域失败,因为无法验证证书。如果问题出在我们身边,或者我们应该联系客户解决这个问题,我听到了相互矛盾的事情。

例如,使用cURL给出:

(pyenv)vagrant@precise64:~$ curl "https://example.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.

我试图研究可能出错的地方This SSL checker说某些浏览器可能不信任证书颁发机构(CA):

  

所有网络浏览器都不信任该证书。你可能需要   安装中间/链证书以将其链接到受信任的根   证书。

然后我尝试使用browserstack在几个浏览器中使用预测的混合结果的URL - 请求适用于某些浏览器,而其他浏览器则失败。

基本上我不确定我们是否应该......

  1. 找一些更新我们的'证书包'的方法 服务器。如果这是最佳做法?
  2. 在example.com上告诉人们问题所在 他们的结局,他们需要获得完全可信的证书
  3. 折扣选项:

    1. 仅为example.com安装证书< - 折扣,因为这不是 如果其他网站有同样的问题,似乎是可持续的
    2. 关闭应用上的SSL验证< - 已打折 因为这是不安全的而不是好的做法 - 即使对于XML模式也是如此 验证

2 个答案:

答案 0 :(得分:2)

查看ngoaidmap.org的the report from SSLLabs显示:

  

连锁店问题不完整

这意味着服务器设置不正确,因为它没有提供必要的中间证书。桌面浏览器通常可以通过下载丢失的证书或使用缓存的证书来解决此问题,但在浏览器之外,验证将失败。这主要意味着选项2:

  

告诉example.com上的人们问题在他们的最后,他们需要获得完全可信的证书

告诉人们修理他们的服务器是正确的。但问题不在于他们需要获得另一个证书,而是他们的服务器也必须提供缺少的中间证书。最好将他们指向SSLLabs report,因为他们最好还应该修复本报告中提到的所有不安全因素。

答案 1 :(得分:-1)

我不知道curl在linux环境中的表现如何。 在windows下提供带有根CA的相关子集的ca-bundle解决了这个问题 - 你可以通过使用建议的--cacert选项提供bundle来尝试这个。

这里有一个有用的包: https://curl.haxx.se/docs/caextract.html

修改 根据steffen ulrich的回答,我开始使用openssl。 你可以自己检查一下

openssl s_client -showcerts -connect ngoaidmap.org:443

响应表明交付的证书包含实际的服务器证书,但缺少中间ca的证书(这是证书链完全脱机验证所必需的)。

证书链  0 s:/ CN = * .ngoaidmap.org    i:/ C = US / O = GeoTrust Inc./CN=RapidSSL SHA256 CA - G3  < =这里应该是中间ca的证书(不是ca-bundle的一部分)

在服务器端,这可以通过组合交付的证书轻松实现。