【问题标题】:SSL certificates and cURL: certificate bundle or untrusted certificate?SSL 证书和 cURL:证书包还是不受信任的证书?
【发布时间】:2016-06-01 04:50:41
【问题描述】:

我们有一个 web 应用程序,它获取 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 上的人问题出在 他们的结局,他们需要获得完全受信任的证书

折扣选项:

  1. 仅安装 example.com 的证书
  2. 在应用程序上关闭 SSL 验证

【问题讨论】:

    标签: security ssl curl https


    【解决方案1】:

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

    链问题不完整

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

    在 example.com 上告诉人们问题已解决,他们需要获得完全受信任的证书

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

    【讨论】:

      【解决方案2】:

      我无法判断 curl 在 linux 环境中的行为。 在 Windows 下,提供带有相关根 CA 子集的 ca-bundle 可以解决此问题 - 您可以通过使用建议的 --cacert 选项提供包来尝试此操作。

      这里有一个有用的捆绑包: 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

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

      【讨论】:

      • 谢谢。我试过curl "https://example.com" --cacert cacert.pem,但这仍然会导致error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
      • 你能分享到目的地的链接吗?能够更容易地检查目标证书
      • 提供的证书似乎是供客户端和服务器使用的,openssl 在此处显示错误(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)。我检查了证书链,没有发现违规。
      猜你喜欢
      • 2016-01-15
      • 1970-01-01
      • 2011-10-31
      • 1970-01-01
      • 1970-01-01
      • 2016-01-17
      • 2015-02-14
      • 1970-01-01
      • 2017-04-21
      相关资源
      最近更新 更多