mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-19 11:19:36 +00:00
Do not resume sessions on an OpenSSL context with a verify callback
A resumed handshake does not show the client certificate again, so since OpenSSL mTLS servers resume sessions, a verify callback, such as one checking a deny list, was skipped for as long as the ticket was good (7200 s by default). Turn off session tickets, TLS 1.3 ones included, and the session cache on a context with a callback, as on wolfSSL.
This commit is contained in:
1 parent
8ca46a4db5
commit
a09e00b03d
2 files changed
+100
-52
No files matched your search
@@ -20550,6 +20550,16 @@ inline bool set_verify_callback(ctx_t ctx, VerifyCallback callback) {
|
||||
// A handshake running the previous callback keeps it until it returns.
|
||||
delete previous;
|
||||
|
||||
// A resumed handshake shows no certificate to run the callback on.
|
||||
if (stored) {
|
||||
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TICKET);
|
||||
SSL_CTX_set_session_cache_mode(ssl_ctx, SSL_SESS_CACHE_OFF);
|
||||
#if !defined(OPENSSL_IS_BORINGSSL) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
// TLS 1.3 tickets, which SSL_OP_NO_TICKET leaves on
|
||||
SSL_CTX_set_num_tickets(ssl_ctx, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Keeps the other mode bits, so a server that requires a client
|
||||
// certificate goes on requiring one.
|
||||
SSL_CTX_set_verify(ssl_ctx,
|
||||
|
||||
Reference in new issue
Block a user