How does Openssl's s_server validate session tickets? I started up an s_server and stored the session ticket in a file, and then shutdown the s_server and started up a new server with the same command. This new server won't accept the old ticket, even though I started up both servers with the same certificates and key files.

To be specific, if I startup a server with this command:

openssl s_server -accept 8000 -cert test_cert.pem -key test_key.pem localhost

And connect to the server with a client:

 openssl s_client -sess_out session_ticket localhost:8000

Shutdown the server and then restart it again with the same command and then try to use the old session ticket with the new server:

 openssl s_client -sess_in session_ticket localhost:8000

The result is that the connection does a full handshake and not a resumption handshake. So why is the old session ticket not valid if both servers are using the same certificate credentials?

  • 2
    Tickets are encrypted under a symmetric key held by the server, and OpenSSL s_server creates this key ephemerally so you don't have to manage it manually, but this means each time you run the program the key is different and old tickets don't work. (Also note s_client -sess_out/in only saves a ticket if the server provides one, which s_server does but other servers often don't; otherwise it saves and restores a client-side session object -- basically session-id and master-secret -- which must match a server session object to work.) Dec 8 '21 at 9:03
  • FWIW if you configure both server and client with the same PSK secret, and enable PSK-based ciphersuite(s) at least for 1.2 and below (for 1.3 it might be automatic?), that should work over multiple program executions. Dec 8 '21 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.