You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "bneradt (via GitHub)" <gi...@apache.org> on 2026/03/31 16:20:52 UTC

[PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

bneradt opened a new pull request, #13044:
URL: https://github.com/apache/trafficserver/pull/13044

   Add ssl_ticket_enabled and ssl_ticket_number as sni.yaml overrides, apply them during SNI handling so they affect TLS 1.2 resumption and TLS 1.3 ticket issuance, and add unit and AuTest coverage plus docs and sample config updates.
   
   Fixes #12953
   
   (cherry picked from commit 8d75849e0e3574748f25fd682001e0566d75bd18)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen merged PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#discussion_r3018766475


##########
src/iocore/net/SSLUtils.cc:
##########
@@ -401,13 +407,9 @@ ssl_cert_callback(SSL *ssl, [[maybe_unused]] void *arg)
       setClientCertCACerts(ssl, sslnetvc->get_ca_cert_file(), sslnetvc->get_ca_cert_dir());
     }
 
-    // Reset the ticket callback if needed
-    SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
-#ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
-    SSL_CTX_set_tlsext_ticket_key_evp_cb(ctx, ssl_callback_session_ticket);
-#else
-    SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket);
-#endif
+    if (!ssl_apply_sni_session_ticket_properties(ssl)) {
+      retval = 0;
+    }

Review Comment:
   Thanks for checking into this. The logic has changed slightly, I think for the better. Now the callback is set (along with other callbacks) in the `SSLMultiCertConfigLoader::init_server_ssl_ctx` below. You can see the `ssl_context_enable_ticket_callback` in that function further down in this file in this patch. Currently line 1347.
   
   I'm honestly not sure why the callback was set here in the first place. If you look at the other stuff in this `ssl_cert_callback`, it's all cert related, not "add a callback" functionality. It had to go out of its way to reach into the SSL and get the SSL_CTX to set the callback on it. `init_server_ssl_ctx` is the appropriate place to configure the ticket callback.
   
   This discussion also applies to the master patch, btw. (In case that's helpful.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#discussion_r3018515025


##########
src/iocore/net/SSLUtils.cc:
##########
@@ -401,13 +407,9 @@ ssl_cert_callback(SSL *ssl, [[maybe_unused]] void *arg)
       setClientCertCACerts(ssl, sslnetvc->get_ca_cert_file(), sslnetvc->get_ca_cert_dir());
     }
 
-    // Reset the ticket callback if needed
-    SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
-#ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
-    SSL_CTX_set_tlsext_ticket_key_evp_cb(ctx, ssl_callback_session_ticket);
-#else
-    SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket);
-#endif
+    if (!ssl_apply_sni_session_ticket_properties(ssl)) {
+      retval = 0;
+    }

Review Comment:
   This is where I was confused trying to resolve conflicts.  The old code calls `set_tlsext_ticket_key...` but the new code path doesn't seem to call that.  So I worry this isn't compatible, but maybe the same thing is accomplished?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#discussion_r3018661442


##########
src/iocore/net/SSLUtils.cc:
##########
@@ -401,13 +407,9 @@ ssl_cert_callback(SSL *ssl, [[maybe_unused]] void *arg)
       setClientCertCACerts(ssl, sslnetvc->get_ca_cert_file(), sslnetvc->get_ca_cert_dir());
     }
 
-    // Reset the ticket callback if needed
-    SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
-#ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
-    SSL_CTX_set_tlsext_ticket_key_evp_cb(ctx, ssl_callback_session_ticket);
-#else
-    SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket);
-#endif
+    if (!ssl_apply_sni_session_ticket_properties(ssl)) {
+      retval = 0;
+    }

Review Comment:
   Thanks, I traced this through both the backport and the original master patch. The explicit `SSL_CTX_set_tlsext_ticket_key...` call no longer happens in `ssl_cert_callback()`, but the functionality is still covered elsewhere.
   
   In this backport, the selected server `SSL_CTX` now gets the ticket callback during `SSLMultiCertConfigLoader::init_server_ssl_ctx()` via `ssl_context_enable_ticket_callback(ctx)`. Later, after SNI/cert selection, `ssl_cert_callback()` calls `ssl_apply_sni_session_ticket_properties(ssl)`, which just applies the per-connection SNI override (`SSL_OP_NO_TICKET` and the TLS 1.3 ticket count). `TLSCertSwitchSupport::selectCertificate()` switches the connection to the already-initialized context with `SSL_set_SSL_CTX()`, so the ticket callback is already present on the new context.
   
   The original master commit (`8d75849e0e3574748f25fd682001e0566d75bd18`) has the same structure, so this is not a backport-only difference. The added `tls_sni_ticket` AuTest also covers the risky case here: global tickets off, then `sni.yaml` turning them back on for the matched SNI.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#issuecomment-4805007254

   10.1.x PR: https://github.com/apache/trafficserver/pull/13297


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#issuecomment-4165046346

   [approve ci autest 1]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#discussion_r3018786935


##########
src/iocore/net/SSLUtils.cc:
##########
@@ -401,13 +407,9 @@ ssl_cert_callback(SSL *ssl, [[maybe_unused]] void *arg)
       setClientCertCACerts(ssl, sslnetvc->get_ca_cert_file(), sslnetvc->get_ca_cert_dir());
     }
 
-    // Reset the ticket callback if needed
-    SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
-#ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
-    SSL_CTX_set_tlsext_ticket_key_evp_cb(ctx, ssl_callback_session_ticket);
-#else
-    SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket);
-#endif
+    if (!ssl_apply_sni_session_ticket_properties(ssl)) {
+      retval = 0;
+    }

Review Comment:
   Thank you for the extra info!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add sni.yaml session ticket overrides (#13006) [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #13044:
URL: https://github.com/apache/trafficserver/pull/13044#discussion_r3018661442


##########
src/iocore/net/SSLUtils.cc:
##########
@@ -401,13 +407,9 @@ ssl_cert_callback(SSL *ssl, [[maybe_unused]] void *arg)
       setClientCertCACerts(ssl, sslnetvc->get_ca_cert_file(), sslnetvc->get_ca_cert_dir());
     }
 
-    // Reset the ticket callback if needed
-    SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
-#ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB
-    SSL_CTX_set_tlsext_ticket_key_evp_cb(ctx, ssl_callback_session_ticket);
-#else
-    SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket);
-#endif
+    if (!ssl_apply_sni_session_ticket_properties(ssl)) {
+      retval = 0;
+    }

Review Comment:
   Thanks, I traced this through both the backport and the original master patch. The explicit `SSL_CTX_set_tlsext_ticket_key...` call no longer happens in `ssl_cert_callback()`, but the functionality is still covered elsewhere.
   
   In this backport, the selected server `SSL_CTX` now gets the ticket callback during `SSLMultiCertConfigLoader::init_server_ssl_ctx()` via `ssl_context_enable_ticket_callback(ctx)`. Later, after SNI/cert selection, `ssl_cert_callback()` calls `ssl_apply_sni_session_ticket_properties(ssl)`, which just applies the per-connection SNI override (`SSL_OP_NO_TICKET` and the TLS 1.3 ticket count). `TLSCertSwitchSupport::selectCertificate()` switches the connection to the already-initialized context with `SSL_set_SSL_CTX()`, so the ticket callback is already present on the new context.
   
   The original master commit (`8d75849e0e3574748f25fd682001e0566d75bd18`) has the same structure, so this is not a backport-only difference. The added `tls_sni_ticket` AuTest also covers the risky case here: global tickets off, then `sni.yaml` turning them back on for the matched SNI.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org