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


##########
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:
   Is Dbg right for this? Maybe WARNING? Just checking. It seems like this is 
something that might be good to add visibility too. Maybe a throttled warning?
   
   Push back if I'm missing something.



-- 
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