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

问题描述:

我们有一个Web应用程序,它可以获取XML文件以根据XML模式进行验证。该应用程序运行在几年前建立的Ubuntu服务器上。SSL证书和cURL:证书包或不受信任的证书?

有一个问题,即给定域的cURL失败,因为它是证书无法验证。如果问题出在我们身边,或者如果我们应该联系客户解决问题,我会听到相互冲突的情况。

例如,使用卷曲给出:

(pyenv)[email protected]:~$ 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.

然后,我在几个使用浏览器的浏览器中尝试了URL,预测的混合结果 - 请求在某些浏览器上运行,但在其他浏览器上运行失败。

基本上我不知道我们是否应该...

  1. 查找更新我们的 服务器上的“证书捆绑”的办法。如果这是最佳实践?
  2. 告诉人们在example.com的问题是在 他们的结束,他们需要得到一个完全受信任的证书

贴现选项:

  1. 安装example.com的证书只< - 贴现,因为这不 似乎可持续,如果其他网站有同样的问题
  2. 关闭SSL验证的应用程序< - 贴现 因为这是INSEC URE而不是好的做法 - 即使对于XML架构 验证
开始=“3”>

我不能告诉如何卷曲的行为中的Linux环境在这里。 在windows下提供ca-bundle与根CA的相关子集可解决此问题 - 您可以通过使用建议的--cacert选项提供该软件包来尝试此操作。

一个有用的包,请访问: https://curl.haxx.se/docs/caextract.html

编辑: 根据从斯特芬·乌尔里希答案我挖成使用OpenSSL的。 你可以检查这个自己

openssl s_client -showcerts -connect ngoaidmap.org:443 

响应指示交付证书包含实际的服务器证书,但缺少中间CA的证书(这是必需的证书链的完整的离线验证)。证书链 0 s:/ CN = *。ngoaidmap.org i:/ C = US/O =/ CN =的RapidSSL SHA256 CA - G3 < =此处应为中间CA的证书(其不是CA-束的一部分)在服务器端,这可以通过组合所递送的证书可以容易地实现

+0

谢谢你。我已经试过'curl“https://example.com”--cacert cacert.pem'但是仍然导致错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败' – user2761030

+0

你能分享到目的地的链接吗?将更容易能够检查目的地证书 –

+0

确定它是https://ngoaidmap.org/iati/organizations/33 – user2761030

看着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,因为他们最好还应该修复此报告中提到的所有不安全因素。