Skip to content

epic: Replace iptables Traffic Interception with Enforceable Proxy Routing #1429

Closed
9 of 9 issues completed
Closed

Description

@mrsabath

Executive summary. AuthBridge's iptables-based interception is hard to debug — engineers must trace netfilter chains, NAT rules, and Envoy ext_proc — and it requires privileged mode that strict production policies (e.g. OpenShift restricted SCC) reject. This epic replaces it with HTTP_PROXY-based proxy routing made enforceable by Kubernetes NetworkPolicy that blocks direct egress, closing the bypass gap that otherwise makes proxy routing merely advisory, while retaining iptables/Envoy as an opt-in advanced mode. The outcome is a default deployment with no privileged containers and no iptables, debuggable with standard HTTP proxy logs, without weakening the security guarantee.

Problem

The iptables-based traffic interception model used by AuthBridge's envoy-sidecar mode is difficult to debug and support. When issues arise, engineers must trace through netfilter chains, NAT rules, and Envoy ext_proc gRPC serialization — a steep debugging surface that is impractical for most operations teams to troubleshoot.

The iptables init container also requires privileged mode, which is rejected by many production security policies (e.g., OpenShift restricted SCC).

Alternatives Evaluated

HTTP_PROXY env vars (Klaviger approach): Route traffic through the proxy using standard HTTP_PROXY/HTTPS_PROXY environment variables. Simpler to debug (standard HTTP proxy logs), no privileged mode required. However, this is advisory, not enforced — the agent process can bypass the proxy by making direct connections, undermining the security model.

Go-native iptables (no Envoy): Replace Envoy with a Go-based transparent proxy that still uses iptables for interception but removes the Envoy binary and ext_proc complexity. Reduces image size and debugging surface but retains the privileged mode requirement.

Solution Direction

A layered approach:

  1. Shared library: Build a modular token exchange library (kagenti-extensions#279) that all interception modes (envoy-sidecar, proxy-sidecar, waypoint) import. This decouples security logic from the interception mechanism, allowing each mode to evolve independently.

  2. HTTP_PROXY as default interception: Use proxy-sidecar mode with HTTP_PROXY/HTTPS_PROXY env var injection as the default (tracked in #1428).

  3. Enforcement via NetworkPolicy: Complement the advisory HTTP_PROXY routing with Kubernetes NetworkPolicy that restricts direct egress from agent containers, closing the bypass gap. Only the proxy sidecar is allowed to make outbound connections.

  4. iptables as opt-in advanced mode: Retain the envoy-sidecar and transparent-proxy modes for environments that require protocol-level transparent interception.


Progress Tracker

Shared Foundation

Item Status Reference
Modular token exchange library (shared core) DONE kagenti-extensions#279 (closed) · tracked by #1937
Unified binary with four listener modes DONE kagenti-extensions#312 (merged) · tracked by #1938
Mode-aware entrypoint DONE kagenti-extensions#317 (closed) · tracked by #1939

Enforcement

Item Status Reference
NetworkPolicy to prevent proxy bypass in proxy-sidecar mode OPEN #1940
Webhook: auto-generate NetworkPolicy when injecting proxy sidecar OPEN #1941

iptables Improvements (advanced mode)

Item Status Reference
Go-native iptables without Envoy OPEN kagenti-extensions#330 · tracked by #1916 under epic #1187 (shared; not re-tracked here)
Reduce init container privileges from privileged to capabilities-only CLOSED kagenti-extensions#111

Historical / Evaluated

Item Status Reference
Per-namespace gateway proxy (alternative approach) CLOSED kagenti-extensions#145
Shared Envoy sidecar proposal CLOSED kagenti-extensions#141

Sub-Issues

GitHub native sub-issues cannot span repositories, so the cross-repo kagenti-extensions work is tracked via track: stub issues in kagenti/kagenti (closed stubs reflect completed upstream work and roll up into this epic's progress).

Sub-issue Tracks Status
#1937 rossoctl/cortex#279 — modular token exchange library (shared core) ✅ done
#1938 rossoctl/cortex#312 — unified binary, four listener modes ✅ done
#1939 rossoctl/cortex#317 — mode-aware entrypoint ✅ done
#1940 NetworkPolicy to prevent proxy bypass (proxy-sidecar mode) open
#1941 Webhook auto-generates NetworkPolicy on proxy-sidecar injection open

Not re-tracked here (referenced): rossoctl/cortex#330 (Go-native iptables) is tracked by #1916 under epic #1187 — it's shared advanced-mode work. Privilege reduction (rossoctl/cortex#111) and the historical proposals (rossoctl/cortex#145, rossoctl/cortex#141) are closed and listed in the Progress Tracker above.

Related enforcement machinery in the operator: rossoctl/operator#345 (merged), rossoctl/operator#224 (closed), rossoctl/operator#385 (open).


Relationship to Other Epics

Success Criteria

  • Shared token exchange library used by all interception modes
  • NetworkPolicy enforcement prevents agent containers from bypassing the proxy
  • Default deployment requires no iptables and no privileged mode
  • iptables-based modes retained as documented opt-in for advanced use cases
  • Operations teams can debug auth issues using standard HTTP proxy logs

Sub-issues

Sub-issues

9 of 9 Issues completed
Loading 9 sub-issues

Activity

  1. added
    epic
    Identity
    on May 2, 2026
  2. moved this from Backlog to In progress in Rossoctl Issue Prioritizationon May 11, 2026
  3. moved this from In progress to Epics in Rossoctl Issue Prioritizationon May 21, 2026
  4. mrsabath commented on Jun 12, 2026

    @mrsabath
    MemberAuthor

    📊 Status sync — 2026-06-12 (automated rollup, please verify before acting)

    5 of 8 linked items closed/merged. A few statuses are stale:

    • kagenti-extensions#279 (modular token exchange library) — body says OPEN, now CLOSED.
    • kagenti-extensions#317 (mode-aware entrypoint) — body says OPEN, now CLOSED.
    • kagenti-extensions#141 (shared Envoy sidecar) — body says "OPEN (stale)", now actually CLOSED 2026-05-10.

    The epic's distinctive contribution — NetworkPolicy enforcement to close the HTTP_PROXY bypass gap (the two "NetworkPolicy" tasks) — has no issues filed and no work started. ext#330 (Go-native iptables) remains OPEN.

    🔗 Suggestion: ext#431 (language-runtime HTTPS interception via Node/Python hooks, OPEN) is a complementary interception mechanism worth cross-linking. Consider filing the two NetworkPolicy tasks as real issues so the core work is trackable.

  5. mrsabath commented on Sep 8, 2026

    @mrsabath
    MemberAuthor

    All sub-issues are complete (9/9 closed). Closing this epic as completed. Reopen if any follow-up work should be tracked here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Identityepic

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions