-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
The scenario: an application sends TLS traffic to https://edition.cnn.com, with SNI. The traffic is intercepted by a sidecar Envoy, which sends the traffic to a gateway Envoy, which, in turn, sends the traffic to edition.cnn.com. The gateway Envoy reports the SNI.
application (SNI = edition.cnn.com) -> sidecar proxy (SNI = edition.cnn.com)-> gateway proxy (SNI = edition.cnn.com) -> edition.cnn.com
Without mTLS between the proxies, the configuration is straightforward: the sidecar proxy has a filter chain with a filter chain match by server_names: edition.cnn.com, a TCP proxy filter that forwards the traffic to the gateway. The gateway has a filter chain with a filter chain match by server_names: edition.cnn.com, with a TCP proxy filter that forwards the traffic to edition.cnn.com. The gateway has also a filter that calls read_callbacks_->connection().requestedServerName() and prints the SNI equal to edition.cnn.com. Everything works as expected.
Now suppose we want to apply mTLS between the sidecar proxy and the gateway proxy (so we will have an mTLS "tunnel" between the proxies, with the original TLS with the original SNI inside the tunnel). The mTLS could be required for verifying the identity of the application (by verifying the identity of the sidecar proxy).
So the picture becomes as follows:
application (SNI = edition.cnn.com) -> sidecar proxy (SNI = gateway.cluster.local)-> gateway proxy (SNI = edition.cnn.com) -> edition.cnn.com
Note that now mTLS interferes with the filterChainMatch and SNI reporting of the gateway proxy. The gateway proxy will have to specify server_names: gateway.cluster.local and it will report SNI as gateway.cluster.local.
As far as I understand, mTLS between the proxies is transparent with regard to the other protocols, e.g. HTTP. The desired operation would be: Envoy will perform TLS termination to terminate mTLS between the proxies, and then will perform the SNI matching by the original SNI and reporting of the original SNI (in this case edition.cnn.com).