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:
parent
ac19ffb340
commit
181266d7d4
5 changed files with 70 additions and 26 deletions
|
|
@ -1,16 +1,32 @@
|
|||
#!/usr/sbin/nft -f
|
||||
# Internal (WireGuard-only) gateway listeners: TCP 8081 (Grafana), 8084
|
||||
# (Hubble UI), 8085 (Metabase) and 8086/8087 (Customer 1 lab replica: Odoo,
|
||||
# Metabase).
|
||||
# Gateway listener host firewall on siriussec: the listeners that must answer
|
||||
# the WireGuard mesh and the pod network only, never the LAN.
|
||||
#
|
||||
# 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.
|
||||
# Ports and who they serve:
|
||||
# 8080 public — Cloudflare tunnel origin (cloudflared runs on rpi)
|
||||
# 8081 internal — Grafana
|
||||
# 8084 internal — Hubble UI
|
||||
# 8085 internal — Metabase
|
||||
# 8086 internal — Customer 1 lab Odoo
|
||||
# 8087 internal — Customer 1 lab Metabase
|
||||
#
|
||||
# Adding an internal service: add its listener port to the set in all three
|
||||
# rules below, reinstall this file, then
|
||||
# Cilium's hostNetwork Envoy binds every Gateway listener on 0.0.0.0, so every
|
||||
# listener is 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.
|
||||
#
|
||||
# 8080 is in this set on purpose. `gateway-system/public` serves the public
|
||||
# hostnames and used to answer 192.168.1.0/24 over plain HTTP; a spoofed
|
||||
# `Host:` header then served Forgejo and every public site without Cloudflare's
|
||||
# TLS, WAF, rate limits or bot protection, and put credentials on the wire
|
||||
# inside the LAN. The only legitimate client of :8080 is the tunnel origin —
|
||||
# cloudflared on rpi (10.10.0.1), which connects to 10.10.0.2:8080 over the
|
||||
# WireGuard mesh — so the saddr rule below covers it. Nothing may reach :8080
|
||||
# from the LAN.
|
||||
#
|
||||
# Adding a listener: add its 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).
|
||||
#
|
||||
|
|
@ -23,13 +39,14 @@ table inet internal_gw {
|
|||
type filter hook input priority filter; policy accept;
|
||||
|
||||
# local process / kubelet probes
|
||||
tcp dport { 8081, 8084, 8085, 8086, 8087 } iifname "lo" counter accept
|
||||
tcp dport { 8080, 8081, 8084, 8085, 8086, 8087 } iifname "lo" counter accept
|
||||
|
||||
# WireGuard mesh (Legion = 10.10.0.3, nodes, remote hub spokes)
|
||||
# and the pod network (in-cluster scrapers, probes)
|
||||
tcp dport { 8081, 8084, 8085, 8086, 8087 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } counter accept
|
||||
# WireGuard mesh (Legion = 10.10.0.3, nodes, remote hub spokes;
|
||||
# 10.10.0.1 = the cloudflared tunnel origin) and the pod network
|
||||
# (in-cluster probes, gateway to service traffic)
|
||||
tcp dport { 8080, 8081, 8084, 8085, 8086, 8087 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } counter accept
|
||||
|
||||
# everything else: LAN, tailscale, public
|
||||
tcp dport { 8081, 8084, 8085, 8086, 8087 } counter drop
|
||||
tcp dport { 8080, 8081, 8084, 8085, 8086, 8087 } counter drop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue