2011-02-22 233 views
4

我最近在Namecheap上獲得了PositiveSSL證書,並將其安裝在我的服務器上。從Firefox訪問網站工作正常,但從Ruby的net/https庫訪問它不起作用:即使我已經指定了證書的路徑,但我已檢查該文件是否可讀,但無法驗證連接證書。捲曲也失敗:SSL證書驗證失敗,如何找出導致它的原因?

curl --cacert /path/to/cert https://mysite.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. 

「證書驗證失敗」是不是一個非常有用的錯誤消息。我如何知道證書究竟有什麼問題以及如何處理?我發現它讓人困惑,它在瀏覽器中工作,但不在其他地方。

回答

2

它看起來像curl要求CA證書文件包含鏈中的所有證書。我已經下載了所有這些文件並將它們合併爲一個文件,現在Curl和Ruby都很開心。

+1

你可以給你的步驟嗎? – 2012-09-09 06:32:15

+1

@ccyoung首先從您處下載CA供應商:1.證書,我們稱之爲「cert.crt」,以及2.一個證書鏈,我們稱之爲「bundle.crt」。然後使用'cat cert.crt bundle.crt> cert.chained.crt'將它們連接起來,並在使用'cert.crt'的任何地方使用'cert.chained.crt'。這是有效的,因爲客戶現在將遵循證書鏈直到驗證的授權。 – 2013-05-29 04:34:10

相關問題