我们有一个网络应用程序,它获取 XML 文件以根据 XML 模式进行验证。该应用程序在几年前设置的 Ubuntu 服务器上运行。
存在一个问题,即对给定域进行 cURL 操作失败,因为无法验证证书。关于问题是出在我们这边,还是我们应该联系客户解决问题,我听到了相互矛盾的说法。
例如,使用 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) 在某些浏览器中可能不受信任:
The certificate is not trusted in all web browsers. You may need to install an Intermediate/chain certificate to link it to a trusted root certificate.
然后,我使用 browserstack 在多个浏览器中尝试了该 URL,并得到了预测的混合结果 - 该请求在某些浏览器上有效,但在其他浏览器上失败。
基本上我不确定我们是否应该...
- 找到一些方法来更新我们的“证书包” 服务器。这是否是最佳实践?
- 告诉 example.com 的人员问题出在 他们的结局,他们需要获得完全信任的证书
折扣选项:
- 仅为 example.com 安装证书 <- 打折,因为这不会 如果其他网站也有同样的问题,则似乎是可持续的
- 关闭应用程序上的 SSL 验证 <- 打折 因为这是不安全的并且不是好的做法 - 即使对于 XML 模式也是如此 验证者
最佳答案
查看the report from SSLLabs对于 ngoaidmap.org 显示:
Chain issues Incomplete
这意味着服务器没有正确设置,因为它没有提供必要的中间证书。桌面浏览器通常可以通过下载丢失的证书或使用缓存的证书来解决此问题,但在浏览器之外验证将失败。这主要意味着选项 2:
Telling the people at example.com that the problem is at their end and they need to get a fully trusted certificate
告诉人们修复他们的服务器是正确的。但问题不在于他们需要获得另一个证书,而是他们的服务器也必须提供丢失的中间证书。最好将他们指向 SSLLabs report因为他们最好还应该解决本报告中提到的所有不安全问题。
关于security - SSL 证书和 cURL : certificate bundle or untrusted certificate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35508281/