homek8s/infrastructure/networking/internal/host-firewall/README.md
Lance Walters a287dc8dfa hubble: move the UI listener to 8084 — 8082 is taken on rpi
Cilium binds every Gateway listener on 0.0.0.0 on EVERY gateway node, and the Pi
still runs leftover Docker site containers: handyman-site holds 127.0.0.1:8082
and its nginx holds 127.0.0.1:8083 (a 127.0.0.1 bind still blocks a 0.0.0.0
one). Binding 8082 there made xDS reject the listener on rpi
("cannot bind '0.0.0.0:8082': Address already in use" at ~2/s) and restarted
cilium-envoy on the node that fronts the public ingress — the UI worked or not
depending on which node answered.

8084 measured free on both gateway nodes (rpi, siriussec) before the change.
Firewall moved with it: siriussec nft dport set { 8081, 8084 }, rpi ufw trio for
8084 inserted above the LAN catch-all and the 8082 rules deleted.

URL: http://10.10.0.2:8084/ (bare IP, no /etc/hosts) — same as Grafana on 8081.
2026-10-27 00:44:36 -04:00

53 lines
2.2 KiB
Markdown

# Internal Gateway host firewall
Cilium programs every Gateway listener on **all** nodes carrying
`node-role.kubernetes.io/gateway=true` (`rpi` = 10.10.0.1, `siriussec` =
10.10.0.2) and its Envoy binds `0.0.0.0:<listener port>` in the host network
namespace. So `gateway-system/public` on 8080 and `internal/internal` on 8081
are *both* listening on the LAN interfaces; the Gateway API object cannot say
"WireGuard only". The host firewall is the enforcement point:
| Host | Mechanism | Artifact |
|------|-----------|----------|
| siriussec (10.10.0.2) | nftables table `inet internal_gw`, loaded by a oneshot unit (same pattern as `k8s-api-firewall.service`) | `siriussec-internal-gw.nft`, `internal-gw-firewall.service` |
| rpi (10.10.0.1) | ufw rules inserted above the `allow from 192.168.1.0/24` catch-all | `rpi-ufw-internal-gw.sh` |
Effective policy for `:8081` (Grafana) and `:8084` (Hubble UI) on both hosts:
**accept from 10.10.0.0/24 and 10.244.0.0/16, accept on lo, drop everything
else** (LAN, tailscale, public). Envoy binds every listener on `0.0.0.0`, so a
new internal listener port is a LAN exposure until it is added here.
These are host units, not Flux objects — a node reinstall has to re-apply them.
Install:
```bash
# siriussec, as root
install -m 0644 siriussec-internal-gw.nft /etc/nftables.d/internal-gw.nft
install -m 0644 internal-gw-firewall.service /etc/systemd/system/
systemctl daemon-reload && systemctl enable --now internal-gw-firewall.service
# rpi, as root
bash rpi-ufw-internal-gw.sh
```
Verify:
```bash
# siriussec
nft list table inet internal_gw
# rpi
ufw status | grep -E '8081|8084'
```
Negative test from the LAN must be a timeout (DROP), never 200:
```bash
curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.179:8081/ # empty/000
curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.125:8081/ # empty/000
```
When a new internal listener port is added, add it to the `tcp dport { … }` set
in `siriussec-internal-gw.nft` and to `PORTS` in `rpi-ufw-internal-gw.sh` (which
inserts one deny for the port plus mesh and pod-CIDR allows above the LAN
catch-all), then reinstall both and re-run the two negative tests above with the
new port.