2016-02-19 670 views
1

我們有一個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的問題是在 他們的結束,他們需要得到一個完全受信任的證書

貼現選項:

  • 安裝example.com的證書只< - 貼現,因爲這不 似乎可持續,如果其他網站有同樣的問題
  • 關閉SSL驗證的應用程序< - 貼現 因爲這是INSEC URE而不是好的做法 - 即使對於XML架構 驗證
  • 回答

    -1

    我不能告訴如何捲曲的行爲中的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

    2

    看着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,因爲他們最好還應該修復此報告中提到的所有不安全因素。