我希望 Apache 在授权用户访问网站之前验证客户端的证书。
在 Chrome 中我的错误是:
192.168.2.57 didn’t accept your login certificate, or one may not have been provided.
Try contacting the system admin.
ERR_BAD_SSL_CLIENT_AUTH_CERT`
在 Firefox 中我的错误是:
An error occurred during a connection to 192.168.2.57. SSL peer was unable to negotiate an acceptable set of security parameters.
Error code: SSL_ERROR_HANDSHAKE_FAILURE_ALERT`
我认为问题在于我甚至没有收到提供客户端证书的提示。如何在两个浏览器中启用此功能?
其他一些信息:我的根 CA 和中间 CA 存储在 Apache 上。他们签署了我的站点证书和客户端证书,这些证书也存储在 Apache 上。所有这些证书(根 CA、中间 CA、服务器和客户端)都已加载到我的浏览器中。
我的 Apache 配置:
<IfModule mod_ssl.c>
<VirtualHost 192.168.2.57:443>
ServerName 192.168.2.57:443
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
SSLCertificateFile "/etc/apache2/ssl/ca/intermediate/certs/AlexSite.cert.pem"
SSLCertificateKeyFile "/etc/apache2/ssl/ca/intermediate/private/AlexSite.key.pem"
SSLProtocol TLSv1 TLSv1.1
SSLCACertificateFile "/etc/apache2/ssl/ca/intermediate/certs/intermediate.cert.pem"
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex /cgi-bin/index.html
AllowOverride None
Order allow,deny
Allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
SSLVerifyClient require
SSLVerifyDepth 1
</Directory>
Alias "/mysql-files/" "/var/lib/mysql-files/"
<Directory "/var/lib/mysql-files/">
Require all granted
Options +Indexes
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory /var/www/cgi-bin>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AddHandler cgi-script .cgi .py
</Directory>
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>`
答案1
我找到了答案。在我的 Apache 设置中,我更改了:
SSLCACertificatePath
到~~~~~~/ca/certs/ca.cert.pem
SSLVerifyDepth 1
到SSLVerifyDepth 10
我所做的最重要的改变是将客户端证书从 pem 转换为 pfx