Ssl – Apache SERVER variable set up SSL_CLIENT_VERIFY

apache-2.2ssl

I have fresh installed WHM/cPanel and my scripts requires SSL_CLIENT_VERIFY variable, which is not on my current $_SERVER variable list. How can I have this variable set in the CGI script's environment?

Best Answer

This is a CGI variable which apache (or nginx or whatever https server) will set when a client connects with a client SSL certificate.

For it to be set ever, the web server needs to request and accept client certificates. In apache, you can do this by adding the SSLVerifyClient directive to your configuration (do this in the virtual host configuration for the vhost which will be running your script). This variable should be set as long as SSLVerifyClient is set to something other than none, but its contents are not terribly useful unless it is optional_no_ca or optional (as require implies that the certificate is valid if the connection was allowed).

You may also want to specify a CA certificate against which certificates are to be validated (this is the CA certificate which will act as a trust root for your client certificates, and probably directly sign them). For this, specify the SSLCACertificateFile or SSLCACertificatePath directive.

Keep in mind that after changing this configuration you will have to reload your apache configuration.

To test, browse to the site with a browser containing a client certificate, and try presenting the certificate or not. In both cases, the variable should be set. However, if you are not asked for a client certificate, the variable will be unset and you can also infer that the configuration directive didn't take effect (double-check your configuration; the directive should be in the same scope as SSLEngine On and can only be usefully specified where SSLEngine On is set).

Related Topic