Repository navigation
Egress proxy: the ClientHello must name the CONNECT host (#1595) - #1618
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Nov 13, 2026
Contributor
Author
|
Live check (dev, 2026-11-13). The proxy was brought up by this branch's CLI, then this branch's spored was swapped onto it. The probe sat in the proxy's client group.
Not exercised: a full stock-Ubuntu Teardown: |
The allowlisted HTTPS hosts are CloudFront-fronted, and an edge serves whatever distribution the ClientHello's server_name asks for, so a client could CONNECT to awscli.amazonaws.com and reach any distribution. The tunnel now parses the client's ClientHello (crypto/tls, stopped at GetConfigForClient, nothing answered or decrypted) and refuses it unless its SNI is the CONNECT host; no SNI, encrypted_client_hello, or no TLS at all are refused. The hello is forwarded unchanged; a tunnel that sends none is closed at the header timeout.
scttfrdmn
marked this pull request as ready for review
November 13, 2026 23:53
scttfrdmn
force-pushed
the
fix/1595-egress-proxy-sni
branch
from
November 13, 2026 23:53
c58ff04 to
0c0639f
Compare
Merged
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.
Fixes #1595
What
The egress proxy checked only the CONNECT authority against the allowlist and then tunnelled opaque bytes.
awscli.amazonaws.comandefa-installer.amazonaws.comare CloudFront-fronted, and an edge serves whichever distribution the ClientHello'sserver_namenames. SoCONNECT awscli.amazonaws.com:443followed by a ClientHello for<anything>.cloudfront.netreached an arbitrary distribution from a subnet with no internet route.tunnel()now reads the client's first flight before forwarding any of it (newsni.go):crypto/tlsparses the ClientHello as a server whoseGetConfigForClientcapturesServerNameandExtensions, then aborts. The proxy answers nothing, decrypts nothing, and still never terminates TLS. Every byte read, which is at most 64 KiB, is forwarded unchanged ahead of the rest of the stream.normalizeHost)encrypted_client_hello(0xfe0d), whose outer name is only a coverHeaderTimeout, so a tunnel that sends no hello holds its slot no longer than a client that sends no request.Acceptedis now counted only after the check passes, and the refusal is logged with its reason.Plain-HTTP forwards were already consistent:
forward()overwritesHostwith the vetted target.Tests
TestConnectRefusesAClientHelloForAnotherHostcovers a fronted name, no SNI, ECH, not-TLS, and another allowlisted host. In each case zero bytes come back and the request counts as refused. I watched all five fail with the check disabled.TestConnectWithNoClientHelloTimesOut,TestReadClientHello,TestHelloRefusal.There is no IAM or user-data change. This is a spored change, because
spored egress-proxyruns it. There is nosporedPolicySchemachange.Live checks needed before merge (owner)
Run in 435415984226. Build spored from this branch and put it on a proxy, either with
spawn egress-proxy upgradeonce released, or a dev spored on a test proxy.spawn launch --no-public-ip --bootstrap-egress proxy --ttl 30mon stock Ubuntu (it installs the AWS CLI through the proxy). The member's bootstrap should finish, which shows the AWS CLI zip (awscli.amazonaws.com) and, with--efa, the EFA tarball still come through.curl -sS -x http://<proxy>:<port> https://awscli.amazonaws.com/ -o /dev/null -w '%{http_code}\n'. Expect an HTTP status.openssl s_client -proxy <proxy>:<port> -connect awscli.amazonaws.com:443 -servername d111111abcdef8.cloudfront.net </dev/null. Expect the handshake to fail. The proxy log should showverdict=refusedwith "names d111111abcdef8.cloudfront.net, not the CONNECT host". This is the issue's deployed-state check.