简体   繁体   English

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

[英]SSL certificates and cURL: certificate bundle or untrusted certificate?

We have a webapp which fetches XML files to validate against an XML schema. 我们有一个webapp可以获取XML文件以针对XML模式进行验证。 The app runs on an Ubuntu server which was set up some years ago. 该应用程序在几年前设置的Ubuntu服务器上运行。

There is an issue where cURL-ing a given domain fails because it was the certificate cannot be verified. 存在一个问题,即无法对给定域进行URL验证,因为无法验证证书。 I'm hearing conflicting things about if the problem is on our side, or if it is an issue that we should contact the client to resolve. 我听到有关问题是否在我们这边,或者是否应该与客户联系以解决问题的矛盾事情。

For example, using cURL gives: 例如,使用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.

I have tried to research what could be wrong This SSL checker says that the certificate authority (CA) may not be trusted in some browsers: 我试图研究可能出什么问题此SSL检查器说,某些浏览器可能不信任证书颁发机构(CA):

The certificate is not trusted in all web browsers. 并非所有Web浏览器都信任该证书。 You may need to install an Intermediate/chain certificate to link it to a trusted root certificate. 您可能需要安装中间/链证书以将其链接到受信任的根证书。

I then tried the URL in several browsers using browserstack with the predicted mixed results - the request works on some browsers, fails on others. 然后,我使用浏览器堆栈在几种浏览器中尝试了URL,并获得了预期的混合结果-请求在某些浏览器上有效,而在其他浏览器上失败。

Basically I'm not sure if we should... 基本上我不确定我们是否应该...

  1. Find some way of updating the 'certificate bundles' on our server. 在我们的服务器上找到一些更新“证书捆绑包”的方法。 If this is even best practice? 如果这是最佳做法?
  2. Telling the people at example.com that the problem is at their end and they need to get a fully trusted certificate 在example.com上告诉人们问题已经到了尽头,他们需要获得完全受信任的证书

The discounted options: 折扣选项:

  1. Installing the certificate for example.com only <- Discounted as this does not seem sustainable if other sites have the same issue 仅安装example.com证书<-已折扣,因为如果其他站点存在相同问题,这似乎无法承受
  2. Turning off SSL verification on the app <- Discounted as this is insecure and not good practice - even for an XML schema validator 关闭应用程序上的SSL验证<-折扣,因为这是不安全的,也不是很好的做法-即使对于XML模式验证器

Looking at the report from SSLLabs for ngoaidmap.org shows: 查看SSLLabs针对ngoaidmap.org 的报告 ,结果显示:

Chain issues Incomplete 连锁问题不完整

This means that the server is not setup properly because it is not providing the necessary intermediate certificate. 这意味着服务器未正确设置,因为它没有提供必要的中间证书。 Desktop browsers often can work around this problem by downloading missing certificates or using cached certificates, but outside of the browsers the validation will fail. 桌面浏览器通常可以通过下载丢失的证书或使用缓存的证书来解决此问题,但是在浏览器之外,验证将失败。 Which means mostly option 2: 这主要意味着选项2:

Telling the people at example.com that the problem is at their end and they need to get a fully trusted certificate 在example.com上告诉人们问题已经到了尽头,他们需要获得完全受信任的证书

Telling the people to fix their server is correct. 告诉人们修复服务器是正确的。 But the problem is not that they need to get another certificate but that their server must provide the missing intermediate certificate too. 但是问题不是他们需要获得另一个证书,而是他们的服务器也必须提供丢失的中间证书。 Best point them to the SSLLabs report because they better should also fix all the insecure things noted in this report. 最好将它们指向SSLLabs报告,因为它们最好还应解决此报告中提到的所有不安全的问题。

i cannot tell how curl behaves within a linux environment here. 我在这里不能告诉我curl在Linux环境中的表现。 under windows providing a ca-bundle with the relevant subset of root CAs solves this issue - you may try this by providing the bundle using the suggested --cacert option. 在Windows下提供与根CA的相关子集的ca-bundle可以解决此问题-您可以通过使用建议的--cacert选项提供bundle来尝试此操作。

a usefull bundle is available here: https://curl.haxx.se/docs/caextract.html 一个有用的捆绑包可以在这里找到: https : //curl.haxx.se/docs/caextract.html

edit: according to the answer from steffen ulrich i digged into using openssl. 编辑:根据斯蒂芬·乌尔里希我回答使用openssl的答案。 you may check this yourself 您可以自己检查一下

openssl s_client -showcerts -connect ngoaidmap.org:443

the response indicates that the delivered certificate contains the actual server certificate but is missing the cert of the intermediate ca (which is required for full offline validation of the certificate chain). 该响应表明所传递的证书包含实际的服务器证书,但缺少中间ca的证书(证书链的完全脱机验证所需的证书)。

Certificate chain 0 s:/CN=*.ngoaidmap.org i:/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA - G3 <= here should be the cert for the intermediate ca (which is not part of ca-bundle) 证书链0 s:/ CN = *。ngoaidmap.org i:/ C = US / O = GeoTrust Inc./CN=RapidSSL SHA256 CA-G3 <=这里应该是中间ca的证书(不属于CA-束)

on the server side this can be easily achieved by combining the delivered cert. 在服务器端,可以通过组合提供的证书轻松实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM