summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2022-10-12 20:14:34 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2022-10-12 20:14:34 +0300
commit23ce9baf0e9802571eae59f29c83eee18628e568 (patch)
tree0f3907f503b7102079023f9521196185986c5671 /src
parentf27af85016f357048cd097a8779a22517fd62741 (diff)
downloadnginx-23ce9baf0e9802571eae59f29c83eee18628e568.tar.gz
nginx-23ce9baf0e9802571eae59f29c83eee18628e568.tar.bz2
SSL: disabled saving tickets to session cache.
OpenSSL tries to save TLSv1.3 sessions into session cache even when using tickets for stateless session resumption, "because some applications just want to know about the creation of a session". To avoid trashing session cache with useless data, we do not save such sessions now.
Diffstat (limited to 'src')
-rw-r--r--src/event/ngx_event_openssl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 085ec5530..a80f30253 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -3818,6 +3818,23 @@ ngx_ssl_new_session(ngx_ssl_conn_t *ssl_conn, ngx_ssl_session_t *sess)
ngx_ssl_session_cache_t *cache;
u_char buf[NGX_SSL_MAX_SESSION_SIZE];
+#ifdef TLS1_3_VERSION
+
+ /*
+ * OpenSSL tries to save TLSv1.3 sessions into session cache
+ * even when using tickets for stateless session resumption,
+ * "because some applications just want to know about the creation
+ * of a session"; do not cache such sessions
+ */
+
+ if (SSL_version(ssl_conn) == TLS1_3_VERSION
+ && (SSL_get_options(ssl_conn) & SSL_OP_NO_TICKET) == 0)
+ {
+ return 0;
+ }
+
+#endif
+
len = i2d_SSL_SESSION(sess, NULL);
/* do not cache too big session */