Bug 64124 - TLS1.3 sessions not resumable after graceful restart
Summary: TLS1.3 sessions not resumable after graceful restart
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_ssl (show other bugs)
Version: 2.4.39
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-07 10:10 UTC by Dominik Stillhard
Modified: 2020-02-13 10:31 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Stillhard 2020-02-07 10:10:18 UTC
TLSv1.3 session are lost after a graceful restart, which isn't the case with TLSv1.2.

Steps to reproduce:
- Configure shared-memory session cache:
    SSLSessionCache shmcb:/path/to/datafile[(size)] 

- connect with openssl s_client with the -sess_out <file> parameter so that we get a session file.

- gracefully restart apache

- connect again with openssl s_client, this time with the -sess_in <file> parameter so we use that session from before.

- see the full-handshake happening...

now to see the difference just do the same steps but don't gracefully restart apache.

i have had a look in the sources at ssl_scache.c and the killing respectively the re-initialization of the cache is skipped correctly:

at the top of ssl_scache_init: 
    if (ap_is_graceful()) {
        return APR_SUCCESS;
    }

and also at the beginning of ssl_scache_kill:
    if (mc->sesscache && !ap_is_graceful()) {
        mc->sesscache->destroy(mc->sesscache_context, s);
    }


but still something must be wrong because the graceful obviously somehow destroys the session...

for more details also see my question on stackoverflow:
https://stackoverflow.com/questions/60080365/apaches-sslsessioncache-not-working-correctly-with-tlsv1-3-and-graceful-restart
Comment 1 Dominik Stillhard 2020-02-13 08:11:49 UTC
after some investigations i have an update on this. it is related to the 
SSLSessionTickets directive. 

- With "SSLSessionTickets off" resumption works after a graceful restart.

- With "SSLSessionTickets on" this doesn't work...
Comment 2 Ruediger Pluem 2020-02-13 10:31:37 UTC
(In reply to Dominik Stillhard from comment #1)
> after some investigations i have an update on this. it is related to the 
> SSLSessionTickets directive. 
> 
> - With "SSLSessionTickets off" resumption works after a graceful restart.
> 
> - With "SSLSessionTickets on" this doesn't work...

This makes sense. During restart the key to encrypt the session will very likely be recreated. Hence old sessiontickets can no longer be decrypted after the restart.