]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix peek-and-splice mode: certificate validation for domain mismatched errors
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 19 Dec 2014 17:54:32 +0000 (19:54 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 19 Dec 2014 17:54:32 +0000 (19:54 +0200)
Currently squid does not check for domain mismatched errors while validates the
server certificate on peek and splice mode, even if the server hostname is known
from SNI info or from CONNECT request string.

This is a Measurement Factory project

src/ssl/PeerConnector.cc

index 1ca6f853ec3db6a6629e79f3bc97f207808fa1d5..d0b7fd68f46926ff77c20bc92531638fd60eafef 100644 (file)
@@ -163,6 +163,13 @@ Ssl::PeerConnector::initializeSsl()
                 srvBio->recordInput(true);
                 srvBio->mode(request->clientConnectionManager->sslBumpMode);
             }
+
+            const bool isConnectRequest = request->clientConnectionManager.valid() &&
+                                          !request->clientConnectionManager->port->flags.isIntercepted();
+            if (isConnectRequest)
+                SSL_set_ex_data(ssl, ssl_ex_index_server, (void*)request->GetHost());
+            else if (!features.serverName.isEmpty())
+                SSL_set_ex_data(ssl, ssl_ex_index_server, (void*)features.serverName.c_str());
         }
     } else {
         // While we are peeking at the certificate, we may not know the server