Apache-2.2

在 Centos 6.5+ 伺服器上通過 SSLVerifyCilent 在 Apache 網路伺服器中設置客戶端證書驗證

  • October 8, 2014

目標:

我的目標是在 Centos 機器上設置一個 Apache Web 伺服器,其 SSL 和客戶端證書驗證類似於以下 Apache 虛擬主機(http://hstuart.dk/2010/04/09/x-509-certificates-and-水銀/):

<VirtualHost *:443>
 SSLEngine on
 SSLCertificateFile /path/to/myserver.pem
 SSLCertificateKeyFile /path/to/myserver.key
 SSLCACertificateFile /path/to/ca.pem
 SSLCACertificatePath /path/to
 SSLVerifyClient require

 <Location />
   SSLRequireSSL
   SSLOptions +FakeBasicAuth
   AuthName "FakeBasicAuth"
   AuthType Basic
   AuthUserFile /path/to/httpd.passwd
   require valid-user
 </Location>

 ScriptAliasMatch ^(.*) /path/to/hgwebdir.cgi$1
</VirtualHost>

目前解決方案:

截至目前,我有一個基於自簽名 CA 證書的有效 Apache 解決方案,該證書用於創建中間 CA,該證書再次用於創建 Web 伺服器證書(https://jamielinux.com/articles/2013/ 08/act-as-your-own-certificate-authority/)。

CA、中間 CA 和 Web 伺服器證書在 Apache 虛擬主機文件中用於設置 SSL 通信。當我不使用 SSLVerifyClient 時,該解決方案在 Web 伺服器本身和已添加 CA 證書的 Windows 框中都按預期工作。沒有嘮叨的螢幕,一切都很好。

問題:

但是,一旦我添加 SSLVerifyClient,我就會'ssl_error_handshake_failure_alert'在 Windows 框和'sslv3 alert handshake failure'centos 伺服器上獲得 Firefox,然後使用該'openssl s_client -connect [ip]:[port]'命令。

此失敗肯定是因為我缺少客戶端證書,但是**如何創建和使用此客戶端證書?**我看不到此客戶端證書適合的位置。

我曾嘗試玩膩子 Pageant,但似乎這僅適用於 ssh 協議,而不是安全的 http。我正在尋找一種安全的 http 解決方案,其中客戶端證書安裝在 windows 框上,允許開發人員訪問 web 伺服器。

您需要將客戶端證書作為 p12/pfx(包括私鑰)文件導入您的 Firefox。

客戶端證書需要是 Web 伺服器信任的客戶端證書。即客戶端證書應由您的 CA 註冊/簽名。

引用自:https://serverfault.com/questions/634288