I’m trying to set up client authentication using smart cards and be reasonably polite about
auth failures. A typical failure mode is that the user doesn’t have the card inserted; I
should send them to a warning page, then let them retry.
The relevant config file for the top level:
SSLVerifyClient optional
RewriteEngine On
RewriteCond %{SSL:SSL_CLIENT_VERIFY} !^SUCCESS
RewriteRule .* /mistake/index.html [L]
<Directory /var/www/html/mistake>
SSLVerifyClient none
</Directory>
Client auth is optional, but if it fails they see the informational
page telling them to use a smart card, in a directory
without smart card auth required.
This successfully rewrites to the informational page when they
don’t have the smart card inserted. The first time in If client auth fails for
some reason they see the error page, and if they do have
the card and authenticate, they see the expected content.
But if they see the error page, then insert the card, and then
see the error page. It seems as if the HTTPS connection
is not being renegotiated or that the SSL_CLIENT_VERIFY
is not being reset to SUCCESS on retry. Or is there a
better way to do this?