aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2022-01-24 17:18:50 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2022-01-24 17:18:50 +0300
commit0a407d7df825689a47ecdea4ae4cd6b2a894cb53 (patch)
tree10e4f33352cb32e0019a6eeccbfb1ec02e6486a7 /src
parent7ba3063952f53b710d092f00881ccc2996c3b5fc (diff)
downloadnginx-0a407d7df825689a47ecdea4ae4cd6b2a894cb53.tar.gz
nginx-0a407d7df825689a47ecdea4ae4cd6b2a894cb53.zip
SSL: always renewing tickets with TLSv1.3 (ticket #1892).
Chrome only uses TLS session tickets once with TLS 1.3, likely following RFC 8446 Appendix C.4 recommendation. With OpenSSL, this works fine with built-in session tickets, since these are explicitly renewed in case of TLS 1.3 on each session reuse, but results in only two connections being reused after an initial handshake when using ssl_session_ticket_key. Fix is to always renew TLS session tickets in case of TLS 1.3 when using ssl_session_ticket_key, similarly to how it is done by OpenSSL internally.
Diffstat (limited to 'src')
-rw-r--r--src/event/ngx_event_openssl.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index daa28ffe4..1e6fc9614 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -4451,7 +4451,21 @@ ngx_ssl_session_ticket_key_callback(ngx_ssl_conn_t *ssl_conn,
return -1;
}
- return (i == 0) ? 1 : 2 /* renew */;
+ /* renew if TLSv1.3 */
+
+#ifdef TLS1_3_VERSION
+ if (SSL_version(ssl_conn) == TLS1_3_VERSION) {
+ return 2;
+ }
+#endif
+
+ /* renew if non-default key */
+
+ if (i != 0) {
+ return 2;
+ }
+
+ return 1;
}
}