经过几次基于各种教程的尝试,我终于确定我的Apache配置正常,但浏览器不会接受我生成的客户端证书 . 具体来说,Windows和OSX似乎都不认为它是客户端证书;它成功导入,但在提示时未包含在证书列表中 . 例如,Chrome只提供了神秘的“ERR_SSL_PROTOCOL_ERR”并说服务器发送了无效的响应 .

我将省略设置基本SSL / HTTPS的步骤 . 以下是我为添加客户端身份验证所做的事情:

服务器Cfg:

cd /var/www-auth/ca
openssl genrsa -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
 // Note: CN to "myth", matching the name of the server on my LAN.
Edit Apache's default-ssl.conf to set SSLACACertificateFile to /var/www-auth/ca/ca.crt and SSLVerifyClient require

客户证书生成:

openssl genrsa -out client.key 4096
openssl req -new -key client.key -out client.csr
openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt
cat client.crt client.key > client.pem

有效的命令行测试:

curl --insecure --cert-type pem --cert client.pem https:// myth

在浏览器中导入相同的“.pem”文件(.crt或.pem)不会产生明显错误,但浏览器不会发送证书 . 在安装了其他客户端证书的系统上,提示符列出了我的其他证书,但省略了这个新证书 .

我究竟做错了什么?