maskit commented on code in PR #14068:
URL: https://github.com/apache/trafficserver/pull/14068#discussion_r4566984271


##########
src/iocore/net/SSLUtils.cc:
##########
@@ -544,8 +544,25 @@ ssl_client_hello_callback(const SSL_CLIENT_HELLO 
*client_hello)
     // Renegotiation carries a new ClientHello, whose SNI actions must still 
run.
     TLSBasicSupport *tbs = TLSBasicSupport::getInstance(s);
     if (tbs == nullptr || !tbs->is_tls_handshake_complete()) {
+      // The ClientHello after a HelloRetryRequest also arrives here. The SNI 
actions ran for the first
+      // ClientHello, so the second must name the same server (RFC 8446 
section 4.1.2).
+      TLSSNISupport *snis = TLSSNISupport::getInstance(s);
+
+      if (snis == nullptr) {
+        Dbg(dbg_ctl_ssl_error, "ssl_client_hello_callback was called 
unexpectedly");
+        return CLIENT_HELLO_ERROR;
+      }
+      if (auto const servername = ch.getServerName(); servername != 
std::string_view{snis->get_sni_server_name()}) {
+        Dbg(dbg_ctl_ssl_error, "Rejecting a ClientHello for '%.*s' after one 
for '%s'", static_cast<int>(servername.size()),

Review Comment:
   Agreed. Any client can trigger this, so `bb1848c69b` makes it a throttled 
warning, using the same `LogMessage{IS_THROTTLED}` pattern as the other 
client-triggered TLS rejections here (the client RPK mismatch, and rejecting a 
resumed session that doesn't satisfy verify_client).
   
   The warning leaves out the server names because both are client-supplied 
bytes. OpenSSL's server_name check rejects NUL but not other control 
characters, and it hasn't run on the second ClientHello yet at this point. Both 
names stay in the debug log. The test now checks that the warning is emitted on 
OpenSSL.
   
   I didn't add a metric for it. Happy to add one if you think it's worth it.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to