Skip to content

Add transparent-proxy mode: Go-native iptables interception without Envoy #330

@huang195

Description

@huang195

Summary

Add a new transparent-proxy mode to the authbridge binary that handles iptables-redirected traffic directly in Go, without requiring Envoy. This eliminates the ~87 MB Envoy binary for deployments that only need HTTP auth injection/validation.

Motivation

The envoy-sidecar mode bundles Envoy (~87 MB) inside the authbridge container image. For basic auth use cases (inbound JWT validation, outbound token passthrough/exchange), Envoy is only used as a transparent proxy with ext_proc — its advanced features (custom filters, rate limiting, circuit breaking) are unused.

A Go-native transparent proxy would reduce the authbridge image from ~140 MB to ~25 MB while covering the common case.

What the new mode would do

  • Listen on ports 15123 (outbound) and 15124 (inbound), same as Envoy today
  • Read the original destination from iptables-redirected sockets via SO_ORIGINAL_DST getsockopt
  • Proxy HTTP traffic with inline auth injection/validation (no ext_proc gRPC indirection)
  • TLS passthrough: detect TLS ClientHello, forward via TCP proxy without termination
  • Compatible with the existing proxy-init iptables rules (same ports, same UID exclusion)

What it does NOT replace

  • envoy-sidecar mode remains for users who need Envoy-specific features (custom filters, observability integrations, rate limiting, circuit breaking, HTTP/2 multiplexing)
  • waypoint and proxy-sidecar modes are unchanged

Implementation notes

  • The Go forward proxy (proxy-sidecar mode, originally from klaviger) already handles HTTP proxying with auth. The gap is SO_ORIGINAL_DST socket handling (~50 lines) and TLS passthrough (~50 lines).
  • The operator would select between envoy-sidecar and transparent-proxy via a config option or feature gate.
  • Separate from but complementary to the Envoy decoupling work (running Envoy as a separate container instead of bundled).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions