fix(networking): make the public gateway :8080 WireGuard-only

Finding F2 of the 2026-11-27 cluster netsec audit: cilium-envoy on siriussec
binds gateway-system/public on 0.0.0.0:8080, so anyone on 192.168.1.0/24 could
`curl -H 'Host: forgejo.siriusdevops.com' http://192.168.1.179:8080/` and get
Forgejo (and every public site) over plain HTTP — no Cloudflare TLS, WAF, rate
limits or bot protection, and credentials on the wire inside the LAN. Live:
200 / 14609 B before this change.

The `internal_gw` nft table that already makes 8081/8084-8087 WG-only simply
did not list 8080. Add it to all three rules (lo, mesh+pods, drop), and to the
rpi ufw guard so a future `gateway=true` relabel on the Pi cannot re-open it.

Nothing legitimate needs the LAN path: cloudflared runs on rpi and connects to
10.10.0.2:8080 from 10.10.0.1 over the mesh (`ss` on siriussec shows
`10.10.0.1:* -> 10.10.0.2:8080 ESTABLISHED`), which the 10.10.0.0/24 accept
covers. 10.244.0.0/16 stays accepted for in-cluster probes.

Verified both polarities: LAN 192.168.1.179:8080 -> timeout/DROP (from two
vantage points), mesh 10.10.0.2:8080 -> 200 for all five public hostnames, and
all five public URLs still 200 through Cloudflare.
This commit is contained in:
Lance Walters 2026-11-27 00:09:11 -05:00
commit 181266d7d4
5 changed files with 70 additions and 26 deletions

View file

@ -52,7 +52,10 @@ only". Consequences:
Public traffic has no path here: the only public ingress is the cloudflared
tunnel, whose ingress list is an explicit allow-list of hostnames pointing at
`http://10.10.0.2:8080` (the `public` gateway). Nothing points at 8081, and
`*.lab.internal` resolves nowhere publicly.
`*.lab.internal` resolves nowhere publicly. `:8080` itself is in the
`internal_gw` WG-only set as well (since 2026-11-27): the tunnel origin reaches
it from `10.10.0.1` over the mesh, so the LAN has no plain-HTTP path to the
public hostnames.
## 2. The pieces
@ -61,7 +64,7 @@ tunnel, whose ingress list is an explicit allow-list of hostnames pointing at
| `Gateway internal/internal` | `infrastructure/networking/internal/gateway.yaml` (Flux: `infrastructure`) | listener `http-internal`, **port 8081**, `allowedRoutes: All` so any namespace can attach. **One bare-IP service only** (Grafana) — see the merge gotcha above |
| `Gateway internal/hubble-ui` | `infrastructure/networking/internal/gateway-hubble-ui.yaml` | listener `http-internal`, **port 8084**, its own RouteConfiguration, so its hostname-less route cannot merge with Grafana's |
| `HTTPRoute <svc>` | the app's own tree (e.g. `monitoring/controllers/home/httproute.yaml`, `infrastructure/networking/cilium/hubble-ui-httproute.yaml`) | `parentRefs: <gateway>/internal#http-internal`, **no `hostnames`** |
| `table inet internal_gw` + `internal-gw-firewall.service` | siriussec host (`/etc/nftables.d/internal-gw.nft`) | drop `:8081`+`:8084` from everything but `10.10.0.0/24`, `10.244.0.0/16`, `lo`; the accept rules carry `counter`s so "traffic arrived and was allowed" is provable, not inferred from a 200 |
| `table inet internal_gw` + `internal-gw-firewall.service` | siriussec host (`/etc/nftables.d/internal-gw.nft`) | drop `:8080` (the `public` gateway — Cloudflare tunnel origin only), `:8081`, `:8084`–`:8087` from everything but `10.10.0.0/24`, `10.244.0.0/16`, `lo`; the accept rules carry `counter`s so "traffic arrived and was allowed" is provable, not inferred from a 200. `:8080` is WG-only because the only legitimate client is `cloudflared` on rpi, which connects to `10.10.0.2:8080` over the mesh — a LAN client could otherwise spoof a `Host:` header and get Forgejo and every public site over plain HTTP, bypassing Cloudflare TLS/WAF/rate limits |
| ufw rules (inserted above the LAN catch-all) | rpi host | **inert since 2026-10-27** — left in place as a belt-and-braces guard in case the Pi is ever relabelled `gateway=true`, but nothing binds those ports on rpi any more, so they just make stale `10.10.0.1:8081` clients time out instead of being refused |
| `infrastructure/networking/internal/host-firewall/` | repo | the host artifacts + install/verify instructions |