homek8s/infrastructure/networking/internal/host-firewall/rpi-ufw-8081.sh
Lance Walters d3741df619 monitoring: kube-prometheus-stack + WireGuard-only Grafana via the internal gateway
- clusters/homek8s/monitoring.yaml: the 'monitoring' Flux Kustomization was
  declared only under clusters/home, which the bootstrapped flux-system
  Kustomization never reads (its path is ./clusters/homek8s), so it had never
  been created. Declare it in the tree that actually reconciles.
- monitoring/controllers/home: HelmRepository + HelmRelease (chart pinned
  92.14.0), values.yaml via configMapGenerator, Grafana admin from the
  monitoring/grafana-admin Secret (out of band, never in git).
- Everything pinned to siriussec, Prometheus on a 10Gi local-path PVC with
  7d AND 8GB retention caps; alertmanager off; no remote write.
- internal gateway listener now accepts routes from any namespace; the security
  boundary is the host firewall, not the namespace.
- host-firewall/: nft table + oneshot unit for siriussec and the ufw script for
  rpi that close :8081 to everything but 10.10.0.0/24 and 10.244.0.0/16.
2026-10-27 00:12:38 -04:00

22 lines
878 B
Shell

#!/bin/bash
# rpi: restrict the internal Gateway listener (TCP 8081) to WireGuard + pods.
#
# ufw on rpi already has `allow from 192.168.1.0/24` (any port), so the deny has
# to sit ABOVE it — hence `ufw insert`, not `ufw allow/deny` (which appends).
# Final order for 8081: allow 10.10.0.0/24, allow 10.244.0.0/16, deny the rest.
#
# Idempotent: re-running after the rules exist is a no-op.
# Run as root on rpi (192.168.1.125).
set -euo pipefail
if ufw status | grep -q '8081'; then
echo "8081 rules already present:"
ufw status | grep '8081'
exit 0
fi
ufw insert 1 deny to any port 8081 proto tcp comment 'internal gateway: wg only'
ufw insert 1 allow from 10.10.0.0/24 to any port 8081 proto tcp comment 'internal gateway (wg mesh)'
ufw insert 2 allow from 10.244.0.0/16 to any port 8081 proto tcp comment 'internal gateway (pods)'
ufw status | grep '8081'