Skip to content

tlsContext interferes with filterChainMatch and TLS inspector #4076

@vadimeisenbergibm

Description

@vadimeisenbergibm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestions that are neither investigations, bugs, nor enhancementsstalestalebot believes this issue/PR has not been touched recently

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions