2011-08-31 45 views
1

我已經配置的Apache2使用使用客戶證書驗證:顯示自定義的ErrorDocument當SSL連接失敗(SSLVerifyClient)

SSLVerifyClient require 

它的工作原理,我可以用一個有效的客戶端證書訪問我的網站。 但是,當用戶沒有安裝ClientCertificate而連接到它時,它們會從瀏覽器中看到一個令人困惑的錯誤。

器(Chrome說「ERR_SSL_PROTOCOL_ERROR」,火狐說:「ssl_error_handshake_failure_alert」時,Internet Explorer只是說「Internet Explorer無法顯示該網頁」。

我想顯示用戶自定義的ErrorDocument當他們試圖訪問未經有效的客戶端證書。

的問題是,該網站不返回HTTP錯誤代碼,而是將中止請求,所以我不能用阿帕奇的ErrorDocument「。

ssl_error_log的最後一部分是這個:

[Wed Aug 31 11:11:57 2011] [info] [client 192.168.2.156] SSL library error 1 in handshake (server url:443) 
[Wed Aug 31 11:11:57 2011] [info] SSL Library Error: 336105671 error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not return a certificate No CAs known to server for verification? 
[Wed Aug 31 11:11:57 2011] [info] [client 192.168.2.156] Connection closed to child 1 with abortive shutdown (server url:443) 

如何爲此返回一個有效的ErrorDocument?

+0

在kclement的請求下遷移到SF。 – DMA57361

+0

我開始認爲我不能用apache配置修復這個問題,因爲請求永遠不會到達Apache服務器。 (連接在到達Apache之前被ssl中止)。 – kclement

回答

4
SSLVerifyClient optional 
RewriteCond %{SSL:SSL_CLIENT_VERIFY} !=SUCCESS 
RewriteRule ^/ http://localhost:8080/missing_cert.html [P,L] 
+1

It Works!謝謝。 我不敢相信花了這麼長時間才弄清楚這麼簡單的事情。 此後也發現了一些更多的資源: http://ryandlane.com/blog/2010/07/29/requiring-ssl-client-authentication-in-a-user-friendly-way-in-阿帕奇/ – kclement