Is there a comprehensive explanation how exactly does certificate chain verification work in apache httpd and how exactly does the SSLVerifyDepth parameter affect it? Possibly as pseudo-code.
Most references just casually mention it.
Is there a comprehensive explanation how exactly does certificate chain verification work in apache httpd and how exactly does the SSLVerifyDepth parameter affect it? Possibly as pseudo-code.
Most references just casually mention it.
https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslverifydepth
A depth of 2 means that certificates signed by a (single level of) intermediate CA are accepted i.e. by an intermediate CA, whose CA certificate is signed by a CA directly known to the server.
As per my tests (see this comment) and this answer, the certificate chain verification in apache works like this:
In words:
The final root certificate must be in the SSLCACertificateFile (or alternatively in SSLCACertificatePath) otherwise the client certificate is not accepted valid. The SSLVerifyDepth parameter limits how far the chain will apache look. If the limit is reached, the certificate is rejected.
The intermediate certificates listed in SSLCACertificateFile only affect building the chain (for example when the client does not send the full chain, so without those listed on the SSLCACertificateFile apache httpd would not have a way to reach the root certificate), but the validity depends only on the presence of the root certificate in SSLCACertificateFile.