Skip to content

Commit

Permalink
TLS Client auth: Check server verify mode if unset for dir
Browse files Browse the repository at this point in the history
The authentication hook (mgs_hook_authz) failed to consider the server's
client verify mode, even if the verify mode was unset in the directory
configuration. As a result, invalid certificates were ignored and
clients could connect and receive data as long as they presented any
certificate whatsoever. Logs showed that authorization was granted
despite the certificate being invalid (timestamps removed for
readability):

[:debug] [pid 10806:tid 140242057148160] gnutls_hooks.c(1198): [client ::1:40992] GnuTLS: Verifying list of 1 certificate(s) via method 'cartel'
[:info] [pid 10806:tid 140242057148160] [client ::1:40992] GnuTLS: Could not find Signer for Peer Certificate
[:info] [pid 10806:tid 140242057148160] [client ::1:40992] GnuTLS: Peer Certificate is invalid.
[authz_core:debug] [pid 10806:tid 140242057148160] mod_authz_core.c(835): [client ::1:40992] AH01628: authorization result: granted (no directives)

This commit adds a check for undefined verify mode in the directory
configuration and applies the server wide configuration in that case.
  • Loading branch information
airtower-luna committed Feb 5, 2015
1 parent c4ba972 commit 5a8a32b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/gnutls_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,9 +898,12 @@ int mgs_hook_authz(request_rec * r) {
return DECLINED;
}
rv = mgs_cert_verify(r, ctxt);
if (rv != DECLINED &&
(rv != HTTP_FORBIDDEN ||
dc->client_verify_mode == GNUTLS_CERT_REQUIRE)) {
if (rv != DECLINED
&& (rv != HTTP_FORBIDDEN
|| dc->client_verify_mode == GNUTLS_CERT_REQUIRE
|| (dc->client_verify_mode == -1
&& ctxt->sc->client_verify_mode == GNUTLS_CERT_REQUIRE)))
{
return rv;
}
}
Expand Down

0 comments on commit 5a8a32b

Please sign in to comment.