cloudflare / cloudflare/go

How to properly deploy ECH in transparent proxy mode

Open
#110 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
370
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I have a TLS transparent proxy which works like this:

```
Client ==|TLS request|==> Proxy ==|HTTP Connect|==> Target
```
I use https://github.com/inconshreveable/go-vhost to sniff SNI and construct the HTTP Connect request to the target site.

Now I want to add ECH support to my transparent proxy. But I stuck after getting the inner SNI:

```
tlsConn, _ := vhost.TLS(conn)
sconn := tls.Server(tlsConn, &tls.Config{
ECHEnabled: true,
ServerECHProvider: echProvider,
Certificates: []tls.Certificate{cert},
})
sconn.Handshake()
sconn.ConnectionState().Servername // This is the inner SNI
```

IIUC, the proxy must tell the client to construct the new inner ClientHello, how can I archive that with the current crypto/tls API?

cc @cjpatton

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.