ECH/SNI Isolation Through a TLS-in-TLS Tunnel My R&D Proxy Attempt
Posted 2025-11-30 20:58:34
0
273
<p>By Jay — Govibe R&D Log</p>
<p>Introduction</p>
<p>In the past weeks, I’ve been experimenting with a concept that sits between cryptography, reverse proxies, and deep network engineering. The idea was simple on paper but extremely complex in practice: to isolate ECH (Encrypted Client Hello) and SNI (Server Name Indication) by using a TLS-in-TLS triple-handshake encrypted tunnel acting as a web server reverse proxy.</p>
<p>This project is not production-ready and not meant to compete with full-scale proxies like Nginx or Caddy.<br>It’s a pure R&D experiment, built to explore what happens when you place a custom encrypted layer before ECH/SNI on port 443.</p>
<p>And the results were fascinating.</p>
<p>Why ECH and SNI Matter</p>
<p>ECH and SNI are both part of the HTTPS/TLS handshake. Normally:</p>
<p>SNI reveals the requested domain name in plaintext</p>
<p>ECH encrypts that domain name so intermediaries cannot see it</p>
<p>But the challenge is this:<br>ECH happens extremely early in the TLS negotiation.</p>
<p>To intercept or modify anything before SNI/ECH, a system must sit before the server handshake and must be able to handle the encrypted layers without breaking the flow.</p>
<p>That’s where the idea of a TLS-in-TLS tunnel came from.</p>
<p>The Concept: A TLS-in-TLS Triple-Handshake Tunnel</p>
<p>The architecture I built is essentially:</p>
<p>Client (Your Web Browser)<br> ↓ TLS1.3 (outer tunnel)<br>Proxy <br> ↓ TLS1.3 (inner handshake)<br>Backend Web Server Reverse Proxy</p>
<p>A triple-handshake occurs:</p>
<p>Outer TLS handshake between client → tunnel</p>
<p>Inner TLS handshake between tunnel → backend</p>
<p>A control-handshake used internally to synchronize metadata (experimental)</p>
<p>This structure forms an encrypted “tunnel web server” that doubles as a reverse proxy.</p>
<p>Its goal:</p>
<p>✔ Protect ECH/SNI<br>✔ Wrap all traffic in another encryption layer<br>✔ Explore behavior of early handshake interception<br>✔ Push low-level TLS research forward</p>
<p>Early Results</p>
<p>My prototype currently handles about 40 elements loading simultaneously — images, scripts, thumbnails, small videos.</p>
<p>After ~40 network requests, the system begins to display:</p>
<p>latency spikes</p>
<p>buffer stalls</p>
<p>freeze conditions</p>
<p>load limits on the event loop</p>
<p>This was expected, because the initial code is not optimized for concurrency.<br>It’s written in C with a simple blocking model, and TLS handshakes are extremely expensive at scale.</p>
<p>But for a first experiment, the results are solid.</p>
<p>Where It Breaks</p>
<p>Once the load becomes heavy, the proxy struggles with:</p>
<p>handshake synchronization</p>
<p>multi-stream concurrency</p>
<p>buffer reuse</p>
<p>socket exhaustion</p>
<p>slow round-trip loops inside the tunnel</p>
<p>The proxy was not designed for mass parallelism.<br>And that’s the entire point of R&D:</p>
<p>Find what breaks.<br>Break it harder.<br>Then rebuild it better.</p>
<p>Why Move to QUIC</p>
<p>After experimenting with TLS-only tunnels, the next step is clear:</p>
<p>QUIC.</p>
<p>QUIC has:</p>
<p>multiplexed streams</p>
<p>no head-of-line blocking</p>
<p>integrated TLS 1.3</p>
<p>cleaner parallelism</p>
<p>Caddy already uses it extremely well</p>
<p>Rewriting the proxy with QUIC-based architecture inspired by Caddy’s internal design should:</p>
<p>✔ eliminate freezes<br>✔ handle load better<br>✔ allow parallel asset loading<br>✔ reduce handshake bottlenecks<br>✔ improve latency under stress</p>
<p>This is not a simple rewrite — it’s a full redesign of the event model.<br>But it’s the right direction.</p>
<p>Why This Experiment Matters</p>
<p>Most people don’t build reverse proxies.<br>Even fewer build encrypted tunnels.<br>And very, very few experiment with handshake-layer manipulation.</p>
<p>This type of work belongs to the R&D side of networking — the same territory occupied by:</p>
<p>CDN engineers</p>
<p>cryptography researchers</p>
<p>protocol developers</p>
<p>enterprise proxy architects</p>
<p>QUIC implementers</p>
<p>This project is simply my contribution to exploring these ideas.</p>
<p>What’s Next</p>
<p>Here’s the plan moving forward:</p>
<p>Rewrite the event loop using QUIC-like patterns</p>
<p>Replace blocking sockets with async multiplexed streams</p>
<p>Reduce handshake overhead</p>
<p>Test concurrent asset loading at scale</p>
<p>Benchmark vs Caddy (just for fun)</p>
<p>Document the internal architecture</p>
<p>Release diagrams and simplified PoC code later</p>
<p>This is not about shipping a product.<br>It’s about pushing the limits of what one person can build in C with enough curiosity, patience, and stubbornness.</p>
<p>Conclusion</p>
<p>This TLS-in-TLS triple-handshake tunnel experiment has already taught me more than I expected about handshake flows, encrypted layers, and the behavior of ECH/SNI under custom proxy conditions. It’s far from perfect, but it’s progressing steadily.</p>
<p>If my next tests with QUIC work out, this could evolve into a fast, lightweight, encrypted reverse proxy unlike anything that exists today.</p>
<p>For now it remains experimental. It’s not officially standardized it’s a project currently built within the R&D lab.</p>
Search
Categories
- Computer
- IT services
- 3d Printing
- Cryptocurrency
- Products
- Services
- NFT
- Art
- Causes
- Business
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Games
- Gardening
- Health
- Home
- Literature
- Music
- Networking
- Other
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness
Read More
Some people are seasonal — they were never meant to grow with you long term.
<p>Some people are seasonal — they were never meant to grow with you long term....
👑 The Solo Architect's Manifesto: Critical Infrastructure Expertise
<p>I am the <strong>Solo Architect</strong> behind Govibe.org, and operating at...