2010-11-05 183 views
33

我遇到問題並嘗試進行調試。我們購買了Verisign證書。當我們使用:SSL握手失敗,帶有 - verisign鏈證書 - 包含兩個CA簽名證書和一個自簽名證書

openssl> s_client -connect myweb.com:443 -showcerts 

SSL握手永遠不會完成,並在年底,我們看到的錯誤:

Verify return code: 19 (self signed certificate in certificate chain) 

這表明3個---BEGIN/END CERTIFICATE---標籤。鏈中的兩個證書是Verisign簽名的,但一個是自簽名的。

  1. 如果有人能解釋這個自簽名證書是如何出現在CA簽名證書中的?

  2. 這是錯誤19 (self signed certificate in certificate chain)良性?如果不是,可能是什麼原因造成的?

  3. 客戶端在可信存儲區中擁有CA證書,但自簽名證書沒有任何內容。你認爲這可能導致問題?如果是,我如何:

    1. 我該如何擺脫鏈證書中的自簽名證書,而僅留下鏈中的2個CA簽名證書?
    2. 在客戶端可信存儲上添加此自簽名證書?
+0

謝謝佈雷特茨基。我會檢查中級證書。我想添加更多信息:當客戶端發送上述openssl命令時,「client hello」到達服務器,但我們從未在客戶端收到「server hello」。如果缺少中間證書,您是否期望這種行爲?設備是一個Windows移動設備,服務器是Apache Web服務器。 – curiousone 2010-11-05 04:10:13

+0

什麼類型的服務器/設備是加載的證書? – Brettski 2010-11-05 04:11:47

+0

您可以通過OpenSSL從其他設備/計算機連接嗎?哪個版本的Windows Mobile,我有Windows Mobile和安全證書的噩夢體驗。 – Brettski 2010-11-05 04:17:13

回答

7

聽起來像中間證書丟失。 截至2006年4月,威瑞信頒發的所有SSL證書都要求安裝中級CA證書。

這可能是因爲您沒有在服務器上加載完整的證書鏈。有些企業不允許他們的計算機下載其他證書,導致無法完成SSL握手。

這裏是中間鏈的一些信息:由CA頒發
https://knowledge.verisign.com/support/ssl-certificates-support/index?page=content&id=AR657
https://knowledge.verisign.com/support/ssl-certificates-support/index?page=content&id=AD146

Intermediate CA Certificates

+0

太棒了。真的很好的信息。非常感謝你。我會加一次我的評論(明天)我嘗試這些事情,讓你知道這確實是問題。 – curiousone 2010-11-05 04:20:34

64

根證書只是自簽名證書(這又可以被用來發放中間CA證書)。除了在許多瀏覽器或操作系統信任錨中默認導入它們之外,它們對它們沒有太多特別之處。

雖然瀏覽器和一些工具被配置爲在默認情況下在位置上查找可信CA證書(其中一些可能是自簽名的),但據我所知openssl命令不是。因此,任何從其最終實體證書(服務器證書)到根CA證書(可能具有中間CA證書)呈現完整證書鏈的服務器將在鏈中具有自簽名證書:根CA.

openssl s_client -connect myweb.com:443 -showcerts沒有任何特別的理由相信Verisign的根CA證書,因爲它是自簽名的,你會得到「的證書鏈自簽名證書」。

如果您的系統在默認情況下可信證書捆綁的位置(我想/etc/pki/tls/certs在RedHat/Fedora和/etc/ssl/certs在Ubuntu/Debian的),你可以配置OpenSSL的將它們作爲信任錨,例如像這樣:

openssl s_client -connect myweb.com:443 -showcerts -CApath /etc/ssl/certs 
+1

-CApath對於OS X會是什麼? – Jonathan 2012-02-01 21:00:13

+5

我不認爲OSX默認有一個,因爲它依賴於此Keychain。您可以進入鑰匙串訪問,選擇「系統根目錄」中的所有證書(除去劃掉的那些證書),右鍵單擊並將所有項目導出爲PEM文件,然後使用'-CAfile'(而不是'-CApath ')指向那個文件。 – Bruno 2012-02-02 00:10:59

+0

很酷,非常感謝! – Jonathan 2012-02-02 19:02:30

1

當您看到「Verify return code: 19 (self signed certificate in certificate chain)」時,那麼服務器確實試圖使用自簽名證書(客戶端永遠無法驗證),或者OpenSSL無法訪問必要的證書但是服務器試圖自己提供它(它不應該這樣做,因爲它毫無意義 - 客戶端永遠不能相信服務器提供與服務器自己的證書相對應的根目錄)。

同樣,添加-showcerts將幫助您診斷哪個。

2

關於服務器可以提供給客戶端的根證書與否,從RFC-5246「傳輸層安全(TLS)協議1.2版」的文檔,它說提取:

certificate_list
This is a sequence (chain) of certificates. The sender's certificate MUST come first in the list. Each following certificate MUST directly certify the one preceding it. Because certificate validation requires that root keys be distributed independently, the self-signed certificate that specifies the root certificate authority MAY be omitted from the chain, under the
assumption that the remote end must already possess it in order to validate it in any case.

關於術語「五一」,從RFC-2119中提取「當前最佳實踐」說:

5.MAY
This word, or the adjective "OPTIONAL", mean that an item is truly optional. One vendor may choose to include the item because a
particular marketplace requires it or because the vendor feels that
it enhances the product while another vendor may omit the same item.
An implementation which does not include a particular option MUST be
prepared to interoperate with another implementation which does
include the option, though perhaps with reduced functionality. In the same vein an implementation which does include a particular option
MUST be prepared to interoperate with another implementation which
does not include the option (except, of course, for the feature the
option provides.)

總之,根可以是由服務器在握手提供的證書路徑。

實際使用。
想一想,不是以導航用戶的角度來考慮,而是考慮在互聯網接入有限的軍事化區域的服務器上的傳輸工具。
在傳輸中扮演客戶端角色的服務器接收來自服務器的所有證書路徑。
鏈中的所有證書應該被檢查爲可信,包括根。
檢查此問題的唯一方法是在傳輸時將根包含在certs路徑中,並與之前聲明爲「受信任」的本地副本進行匹配。