Repository navigation
feat(agent): upstream cluster mTLS via transport-socket matcher - #80
Merged
Merged
Conversation
Outbound traffic to service clusters was plaintext, so it could not complete the mutual-TLS handshake required by destination pods' inbound listeners. Each pod's outbound listener already publishes its network namespace into the aether.network.network_namespace filter state (shared with the upstream connection), but no cluster acted on it. Attach to every regular (non-local) service cluster: - a transport_socket_matcher keyed on the aether.network.network_namespace filter state, mapping each local pod's netns to a named transport socket, and - one transport_socket_match per unique local-pod SPIFFE ID, each presenting that pod's client certificate over SPIRE-served SDS. So the upstream connection presents the originating pod's identity, selected per connection by which pod's outbound listener received it. - New proxy helpers UpstreamTransportSocketMatcher / UpstreamTransportSocketMatches (match name = SPIFFE ID, deduped across pods sharing a service account). - UpstreamTransportSocket now advertises ALPN h2 (clusters are HTTP/2). - The cache tracks local pods' netns -> SPIFFE ID (maintained alongside listeners in AddPod/RemovePod/LoadListenersFromStorage) and clones each regular cluster at snapshot assembly to inject the matcher — no extra rebuild on pod or registry changes. local_ clusters are excluded; with no local pods, clusters stay plaintext. - Promote github.com/cncf/xds/go to a direct dependency (xds matcher types). Co-Authored-By: Claude Opus 4.8 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Jun 8, 2026
Round 2 (PR 4/6): add the proven HBONE-style tunnel-client generators as reusable proxy functions, ahead of wiring them into the outbound <C> cluster: - NewTunnelInternalListener: the internal listener whose tcp_proxy encapsulates a stream into a CONNECT tunnel, setting the CONNECT :authority from the destination pod address carried in the passed-through tunnel metadata (%DYNAMIC_METADATA(tunnel:authority)%). - NewTunnelOriginateCluster: the ORIGINAL_DST cluster the tunnel dials, reading the destination node address per-endpoint from tunnel.node (metadata_key). connection_pool_per_downstream_connection guarantees a source pod's tunnel connection is never reused for another source, so the per-source client cert (selected by the #80 transport-socket matcher on the source netns filter state, on-no-match -> node identity) cannot leak across identities — the leak-free path validated in the identity spike. - InternalUpstreamTransportSocket: passes the selected endpoint's tunnel metadata across the internal-listener boundary. - TunnelEndpointMetadata: builds endpoint metadata (envoy.lb subset keys + tunnel.authority/node). Pure generators with unit tests; not yet wired into cluster/EDS generation, so no behavior change. The <C> rewire + node_ip plumbing follows in the next stacked PR. Co-Authored-By: Claude Opus 4.8 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Jun 8, 2026
…#86) Round 2 (PR 4/6): add the proven HBONE-style tunnel-client generators as reusable proxy functions, ahead of wiring them into the outbound <C> cluster: - NewTunnelInternalListener: the internal listener whose tcp_proxy encapsulates a stream into a CONNECT tunnel, setting the CONNECT :authority from the destination pod address carried in the passed-through tunnel metadata (%DYNAMIC_METADATA(tunnel:authority)%). - NewTunnelOriginateCluster: the ORIGINAL_DST cluster the tunnel dials, reading the destination node address per-endpoint from tunnel.node (metadata_key). connection_pool_per_downstream_connection guarantees a source pod's tunnel connection is never reused for another source, so the per-source client cert (selected by the #80 transport-socket matcher on the source netns filter state, on-no-match -> node identity) cannot leak across identities — the leak-free path validated in the identity spike. - InternalUpstreamTransportSocket: passes the selected endpoint's tunnel metadata across the internal-listener boundary. - TunnelEndpointMetadata: builds endpoint metadata (envoy.lb subset keys + tunnel.authority/node). Pure generators with unit tests; not yet wired into cluster/EDS generation, so no behavior change. The <C> rewire + node_ip plumbing follows in the next stacked PR. Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the upstream cluster mTLS proposal — the final piece of the workload-mTLS data path.
Problem
Outbound traffic to service clusters was plaintext, so it could not complete the mutual-TLS handshake that destination pods' inbound listeners require (
RequireClientCertificate: true). Live symptom:tls_inspector.tls_not_found,ssl.connection_error, upstream503 connection termination.Each pod's outbound listener already publishes its netns into the
aether.network.network_namespacefilter state (set_filter_state,shared_with_upstream: ONCE), but no cluster read it.Change
Attach to every regular (non-
local_) service cluster:transport_socket_matcherkeyed on theaether.network.network_namespacefilter state, mapping each local pod's netns → a named transport socket;transport_socket_matchper unique local-pod SPIFFE ID, each presenting that pod's client cert over SPIRE-served SDS.The upstream connection thus presents the originating pod's identity, selected per connection by which pod's outbound listener received it (mirrors
e2e/config/envoy-a.yaml).Details
proxy.UpstreamTransportSocketMatcher/UpstreamTransportSocketMatches(match name = SPIFFE ID, deduped across pods sharing a service account; matcher uses the existingnetworkNamespaceFilterStateKeyso the set/read keys can't drift).UpstreamTransportSocketnow advertises ALPNh2(clusters are HTTP/2).netns → SPIFFE ID(maintained inAddPod/RemovePod/LoadListenersFromStorage, same lifecycle as the listeners that emit the filter state) and clones each regular cluster at snapshot assembly (clustersEndpointsAndVhosts) to inject the matcher — no extra rebuild on pod or registry changes.local_clusters excluded; with no local pods, clusters stay plaintext (safe no-op).github.com/cncf/xds/goto a direct dependency for the xds matcher types.Tests
aether.network.network_namespace, netns→action name.h2on the upstream socket.local_excluded; no matcher before any local pod.Open questions (from the proposal)
on_no_matchis currently unset (fail-closed-ish: no fallback cleartext socket). Local-cluster mTLS is deferred. Both noted for follow-up.