You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enforce-drop existed only because, before the transparent listener, a
REDIRECT had no receiver so DROP was the only fail-closed option. Now that
every proxy-sidecar/lite image ships the transparent listener,
enforce-redirect captures bypass egress instead of dropping it, and the
operator only emits enforce-redirect. enforce-drop is dead.
Remove the enforce-drop MODE (setup_enforce_drop + AB_EGRESS chain + the
dispatch + the mode-table/env-var/injection docs) and test-enforce-drop.sh.
The init script now accepts only redirect | enforce-redirect.
Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Hai Huang <huang195@gmail.com>
Copy file name to clipboardExpand all lines: authbridge/proxy-init/README.md
+19-62Lines changed: 19 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,13 @@
2
2
3
3
The `proxy-init` container programs iptables rules for an
4
4
AuthBridge-injected pod. It runs once at pod startup as a Kubernetes
5
-
init container, then exits. It has three modes, selected by the `MODE`
5
+
init container, then exits. It has two modes, selected by the `MODE`
6
6
env var:
7
7
8
8
|`MODE`| Used by | What it does |
9
9
|---|---|---|
10
10
|`redirect` (default) |`envoy-sidecar`| Transparently **REDIRECT**s pod traffic to the Envoy listeners. |
11
11
|`enforce-redirect`|`proxy-sidecar`, `lite`| Fail-closed egress guard that **captures**: REDIRECTs external TCP that bypasses the forward proxy to AuthBridge's transparent listener; DROPs non-TCP external egress. |
12
-
|`enforce-drop`|`proxy-sidecar`, `lite`| Fail-closed egress guard that **DROP**s any egress that bypasses the forward proxy. Predates `enforce-redirect`; retained as a no-transparent-listener fallback. |
13
12
14
13
## `redirect` mode (envoy-sidecar)
15
14
@@ -66,58 +65,22 @@ the Envoy path. IPv6 mirrors apply the same rules. See
66
65
[`test-enforce-redirect.sh`](./test-enforce-redirect.sh), which proves
67
66
the capture, the preemption, and the non-TCP drop via packet counters.
68
67
69
-
`CLUSTER_CIDRS` has the same Kind-shaped default and OCP/EKS override
70
-
requirement as documented under `enforce-drop` below.
71
-
72
-
## `enforce-drop` mode (proxy-sidecar)
73
-
74
-
In `proxy-sidecar` mode the workload is configured with `HTTP_PROXY`
75
-
pointing at AuthBridge's forward proxy. On its own that is purely
76
-
cooperative — an app that ignores `HTTP_PROXY` (or sets `NO_PROXY`)
77
-
egresses directly and bypasses AuthBridge. `enforce-drop` closes that
78
-
gap **without** transparently redirecting (you cannot REDIRECT raw
79
-
traffic into a CONNECT forward proxy): it installs a fail-closed guard
80
-
that DROPs any direct egress, forcing all external traffic through the
81
-
proxy regardless of whether the app honors `HTTP_PROXY`.
82
-
83
-
`init-iptables.sh` builds a dedicated `AB_EGRESS` chain hooked from
84
-
**`mangle` OUTPUT at position 1**, with this order:
85
-
86
-
1.`RETURN` ztunnel's own sockets (fwmark `0x539`) — keeps the mesh path working; a no-op when ambient is absent.
87
-
2.`RETURN` the proxy's own re-originated egress (`--uid-owner $PROXY_UID`, default 1337).
88
-
3.`RETURN` loopback (the app → proxy hop) and in-cluster CIDRs (`CLUSTER_CIDRS`, mesh/DNS).
89
-
4.`DROP` everything else — direct external egress, including UDP (QUIC/HTTP-3).
90
-
91
-
An IPv6 mirror drops external v6 egress (allowing loopback, link-local,
92
-
the proxy UID, and `CLUSTER_CIDRS6`).
93
-
94
68
> **`CLUSTER_CIDRS` is Kind-shaped by default.** The `10.0.0.0/8` default
95
69
> covers Kind (pods `10.244.0.0/16` + services `10.96.0.0/16`). Other
96
70
> distros differ — **OpenShift** uses services `172.30.0.0/16` and pods
97
71
> `10.128.0.0/14`, and `172.30.0.0/16` is **outside**`10/8`, so the
98
72
> default would drop in-cluster service traffic. On OCP/EKS/etc. you
99
73
> **must** override `CLUSTER_CIDRS` with the cluster's real pod+service
100
74
> ranges. The script logs the resolved value at startup, and the
101
-
> operator wiring (follow-up PR) sets it from the cluster's CIDRs.
75
+
> operator sets it from the cluster's CIDRs.
102
76
103
-
> **`enforce-drop` intentionally ignores `OUTBOUND_PORTS_EXCLUDE`** (a
77
+
> **`enforce-redirect` intentionally ignores `OUTBOUND_PORTS_EXCLUDE`** (a
104
78
> `redirect`-mode knob). Any destination previously bypassed that way —
105
79
> e.g. a direct LLM endpoint at `host.docker.internal:11434` — is now
106
-
> dropped unless it goes through the forward proxy or falls within
107
-
> `CLUSTER_CIDRS`. That is the point: `enforce-drop` closes direct-egress
108
-
> holes. Operators relying on a bypass must route it through the proxy
109
-
> (or, for in-cluster targets, include it in `CLUSTER_CIDRS`).
110
-
111
-
**Why `mangle` OUTPUT, not `filter`:** when Istio ambient is active it
112
-
installs an in-pod `nat OUTPUT` REDIRECT (`ISTIO_OUTPUT` → ztunnel
113
-
`:15001`). The netfilter OUTPUT hook order is `raw → mangle → nat →
114
-
filter`, so a DROP in `mangle` evaluates the original destination and
115
-
fires **before** ambient's nat redirect can rewrite it; a DROP in
116
-
`filter` would run after nat and be defeated. `-I 1` also places the
117
-
chain ahead of Istio's appended (`-A`) mangle chain. This makes the
118
-
guard robust with no ambient, in-pod ambient, or node-level ambient.
119
-
See [`test-enforce-drop.sh`](./test-enforce-drop.sh), which proves the
120
-
preemption via packet counters.
80
+
> captured (external TCP) or dropped (external non-TCP) unless it falls
81
+
> within `CLUSTER_CIDRS`. That is the point: `enforce-redirect` closes
82
+
> direct-egress holes. Operators relying on a bypass for an in-cluster
83
+
> target must include it in `CLUSTER_CIDRS`.
121
84
122
85
## iptables backend
123
86
@@ -129,18 +92,18 @@ whichever the host kernel exposes. Override with `IPTABLES_CMD` (and
129
92
130
93
| Variable | Default | Mode | Purpose |
131
94
|---|---|---|---|
132
-
|`MODE`|`redirect`| all |`redirect` (envoy-sidecar), `enforce-redirect`or `enforce-drop` (proxy-sidecar) |
133
-
|`PROXY_UID`|`1337`| all | UID of the AuthBridge sidecar process; exempted from redirect / drop |
95
+
|`MODE`|`redirect`| all |`redirect` (envoy-sidecar)or `enforce-redirect` (proxy-sidecar / lite) |
96
+
|`PROXY_UID`|`1337`| all | UID of the AuthBridge sidecar process; exempted from redirect |
134
97
|`PROXY_PORT`|`15123`| redirect | AuthBridge outbound listener port |
135
98
|`INBOUND_PROXY_PORT`|`15124`| redirect | AuthBridge inbound listener port |
0 commit comments