otp icon indicating copy to clipboard operation
otp copied to clipboard

`ssl:connection_information(Socket, [session_resumption])` always returns `false` for TLS 1.2

Open zmstone opened this issue 1 month ago • 1 comments

Cannot find much documentation about session_resumption, presumably it should return true for both TLS 1.2 and 1.3 after session is resumed. However, per my tests, it is only telling the truth for TLS 1.3.

zmstone avatar Dec 12 '25 12:12 zmstone

Well I believe that the session_resumption was added for the purpose of testing TLS-1.3 session resumption that is a totally different how session reuse in TLS-1.2 works, where this is easier to observe. Although maybe we could let this option have a value for TLS-1.2 too, or maybe it should be omitted. We will think about it.

IngelaAndin avatar Dec 15 '25 15:12 IngelaAndin

Hi @IngelaAndin

Could you let us know how to observe reuse of TLS 1.2 session? Thanks you.

The reason we want it is to bump a counter after TLS handshake so we gain observability for the session resumption success rate (or cache hit rate for tls 1.2)

zmstone avatar Dec 16 '25 18:12 zmstone

If the server sends back the same session id as the client suggests it is a session resumption. But for your use case it probably would be easier if connection_information would report it through this item. I think it would be fairly easy to make it do that. I think this item of connection_information probably was not documented when first introduced and then became documented without any proper explanation via spec. I think the session_resumption part of hs_env should be updated in tls_dtls_client_connection:handle_session/7 and in abbreviated gen_staem-state callback of tls_dtls_server_connection. If you like to PR that, I think this is an acceptable addition.

IngelaAndin avatar Dec 17 '25 08:12 IngelaAndin