homek8s/infrastructure/networking/internal/host-firewall/siriussec-internal-gw.nft
Lance Walters 7ca85669b2 hubble: bare-IP listener (8082) for the UI + WireGuard-only firewall on both gateway nodes
Operator addendum: internal services must be reachable by bare IP+port, because
a phone cannot edit /etc/hosts. A hostname-scoped route does not match
`Host: 10.10.0.2:8081` (Envoy 404), and a hostname-less `PathPrefix /` cannot
share a listener with it — so hubble-ui gets its own listener (`hubble-ui`, port
8082) with a route that sets no hostnames. http://10.10.0.2:8082/ and
http://hubble.lab.internal:8082/ both hit the UI.

Firewall: siriussec nft table now matches `dport { 8081, 8082 }` and starts with
`destroy table` so re-running the unit replaces (not appends) the rules; the rpi
ufw script is generalised to a PORTS list and inserts each port above the LAN
catch-all. Both hosts applied and verified before the listener was programmed.

docs: internal gateway section, host-firewall README.
2026-10-27 00:35:16 -04:00

34 lines
1.4 KiB
Text

#!/usr/sbin/nft -f
# Internal (WireGuard-only) gateway listeners: TCP 8081 (Grafana) and 8082
# (Hubble UI).
#
# Cilium's hostNetwork Envoy binds every Gateway listener on 0.0.0.0, so the
# internal listeners are open on the LAN interface the moment the Gateway is
# programmed. This table makes them answer only from the WireGuard mesh and the
# pod network. DROP (not reject) so a LAN scan sees a timeout, not a port that
# tells you something is listening.
#
# Adding an internal service: add its listener port to the set in all three
# rules below, reinstall this file, then
# `systemctl reload-or-restart internal-gw-firewall.service`. The same list
# must also be added to the rpi ufw rules (rpi-ufw-internal-gw.sh).
#
# Loaded by internal-gw-firewall.service on siriussec. `destroy` (not `delete`)
# so re-running the unit REPLACES the table instead of appending a second copy
# of the rules, and does not fail when the table does not exist yet.
destroy table inet internal_gw
table inet internal_gw {
chain input {
type filter hook input priority filter; policy accept;
# local process / kubelet probes
tcp dport { 8081, 8082 } iifname "lo" accept
# WireGuard mesh (Legion = 10.10.0.3, nodes, remote hub spokes)
# and the pod network (in-cluster scrapers, probes)
tcp dport { 8081, 8082 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } accept
# everything else: LAN, tailscale, public
tcp dport { 8081, 8082 } counter drop
}
}