SSL 连接失败时显示自定义 ErrorDocument (SSLVerifyClient)

发布于 2024-12-02 00:55:54 字数 938 浏览 1 评论 0原文

我已将 Apache2 配置为使用客户端证书身份验证:

SSLVerifyClient require

它有效,我可以使用有效的客户端证书访问我的站点。 但是,当用户在未安装 ClientCertificate 的情况下连接到它时,他们会从浏览器中收到令人困惑的错误。

(Chrome 说“ERR_SSL_PROTOCOL_ERROR”,Firefox 说“ssl_error_handshake_failure_alert”,Internet Explorer 仅说“Internet Explorer 无法显示网页”。

当用户尝试在没有有效客户端证书的情况下尝试访问时,我想向用户显示自定义 ErrorDocument。

问题是该网站不会返回 http 错误代码,但会中止请求,因此我无法使用 Apache 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?

I have configured Apache2 to use Client Certificate AUthentication using:

SSLVerifyClient require

It works, I can access my site with a valid Client Certificate.
However, when users connect to it without having a ClientCertificate installed, they get a confusing error from the browser.

(Chrome says 'ERR_SSL_PROTOCOL_ERROR', Firefox says 'ssl_error_handshake_failure_alert', Internet explorer only says 'Internet Explorer cannot display the Webpage'.

I want to show the users a custom ErrorDocument when they try to access without a valid Client Certificate.

The problem is that the site doesn't return a http error code, but aborts the request, so I can't use Apaches' 'ErrorDocument'.

last part of ssl_error_log is this:

[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)

How do I return a valid ErrorDocument for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走走停停 2024-12-09 00:55:54
SSLVerifyClient optional
RewriteCond %{SSL:SSL_CLIENT_VERIFY} !=SUCCESS
RewriteRule ^/ http://localhost:8080/missing_cert.html [P,L]
SSLVerifyClient optional
RewriteCond %{SSL:SSL_CLIENT_VERIFY} !=SUCCESS
RewriteRule ^/ http://localhost:8080/missing_cert.html [P,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文