Files
Kubernetes/Cluster_admin/firewall.md
T
gitea_admin 36fbaf171a Add firewall and home LAN access docs, ComfyUI image generation, and backup plan
Document the Hetzner Cloud Firewall posture (inbound from private/home only, outbound allow-all, egress-only IPv6, public IPs on workers) in a new `Cluster_admin/firewall.md` and reference it from `AGENTS.md`, `Environment.md`, and `README.md`. Update the Mailu README to note that SMTP/IMAP ports are not currently exposed.

Add `HomeAccess/` with a privileged DaemonSet and README that give cluster nodes a route to `192.168.8.0/24` via point-to-point GRE tunnels to the master and its WireGuard tunnel.

Wire Open WebUI to ComfyUI on pop-os through a new `openwebui-imagegen` ConfigMap consumed via `envFrom`, with migration notes covering the PersistentConfig DB override.

Bump kube-prometheus-stack to 88.6.1 with an 8GB `retentionSize` cap, grow the postgres PVC to 50Gi, and add a PostgreSQL backup plan for pg_dumpall/rclone streaming to a Hetzner Storage Box.
2026-12-01 12:36:14 +02:00

152 lines
5.8 KiB
Markdown

# Hetzner Cloud Firewall — inbound/outbound model
Operational note for the cluster's public network posture ("Option A"):
**public IPs stay, inbound is locked down, outbound is open**. This is not a
manifest — it is managed in the Hetzner Cloud Console / API.
Last verified: **2026-11-26**.
## Servers
| Server | Private IP | Public IPv4 | Public IPv6 |
|---|---|---|---|
| `master-4gb-hel1-2` | `10.1.0.3` | `46.62.205.103` | `2a01:4f9:c013:68e::/64` |
| `ubuntu-4gb-hel1-docker` (Worker-0) | `10.1.0.2` | `65.108.84.87` | `2a01:4f9:c010:e481::/64` |
| `woker-1-8gb-hel1-1` (Woker-1) | `10.1.0.4` | `95.216.198.61` | `2a01:4f9:c013:68ec::/64` |
## Applied firewalls
All three firewalls are applied to **all three** servers.
| Firewall | ID | Inbound | Outbound |
|---|---|---|---|
| `allow-all-internal` | `10660297` | TCP/UDP/GRE/ICMP/ESP from `10.0.0.0/8` | none |
| `allow-all-home` | `10296229` | TCP/UDP/ICMP/GRE/ESP from `192.168.8.0/24`, `192.168.5.0/24` | none |
| `Home-ip` | `10714705` | TCP/UDP from `78.58.8.250/32` (home WAN) | none |
All sources above are IPv4; there are **no IPv6 inbound rules**.
## Effective posture
Hetzner Cloud Firewalls are stateful:
- Inbound `NEW` traffic: **dropped** unless a rule allows it.
- `ESTABLISHED` / `RELATED`: always allowed (responses to outbound connections
come back without an inbound rule).
- Outbound `NEW` traffic: **allowed** as long as there are no outbound rules.
- **Trap:** as soon as *one* outbound rule exists, outbound switches to
deny-by-default and only matching destinations pass. Do not add a single
outbound rule without the complete allowlist.
Consequences:
- The public IPs are **not reachable from the internet**. Verified on
2026-11-25: from the master (a non-home source) ports 22/80/443/6443 on both
worker public IPs were blocked.
- Home LAN/WG (`192.168.8.0/24`, `192.168.5.0/24`, `78.58.8.250`) can reach the
nodes; the private network (`10.0.0.0/8`) can reach them.
- IPv6 is **egress-only**: no inbound IPv6 rules, so nodes can initiate
connections over IPv6 (used by the `slow` SMB Storage Box mount) but nothing
can initiate in.
- Nodes pull images and packages **directly over Hetzner** (Docker Hub, GHCR,
Quay, Ubuntu archive, `rg.mariushome.lt`). No home/VPN dependency.
- `rg.mariushome.lt` resolves to the home WAN (`78.58.8.250`) and is proxied by
the home edge into the cluster; pulls need the `registry-creds` image pull
secret (one per namespace).
- Mailu is **not deployed** (no pods in `mailu`). Its SMTP/IMAP ports are not
open to the internet under this posture. See `Email/README.md` step 3.4 if it
is ever deployed.
## Operating the firewalls
The Hetzner API token is stored in the cluster (CSI token). Do **not** commit
it or paste it into docs/logs:
```bash
TOKEN=$(kubectl -n kube-system get secret hcloud -o jsonpath='{.data.token}' | base64 -d)
```
Inspect firewalls and the rules applied to each server:
```bash
curl -s -H "Authorization: Bearer $TOKEN" \
https://api.hetzner.cloud/v1/firewalls | jq .
curl -s -H "Authorization: Bearer $TOKEN" \
https://api.hetzner.cloud/v1/servers \
| jq -r '.servers[] | "\(.name) firewalls=\([.public_net.firewalls[]?.id] | join(","))"'
```
Replace a firewall's rules (this **replaces all rules** on that firewall, so
include the full inbound + outbound set):
```bash
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
https://api.hetzner.cloud/v1/firewalls/10296229/actions/set_rules \
-d @rules.json
```
The Console equivalent is **Firewalls → select firewall → Rules**. Changes are
applied within seconds.
## If outbound must be restricted again
Add the complete allowlist in one `set_rules` call. Starting point (merge these
outbound rules with the current inbound rules, or the inbound rules are lost):
```json
{
"rules": [
{ "direction": "out", "protocol": "tcp", "port": "80", "destination_ips": ["0.0.0.0/0", "::/0"] },
{ "direction": "out", "protocol": "tcp", "port": "443", "destination_ips": ["0.0.0.0/0", "::/0"] },
{ "direction": "out", "protocol": "udp", "port": "53", "destination_ips": ["0.0.0.0/0", "::/0"] },
{ "direction": "out", "protocol": "tcp", "port": "53", "destination_ips": ["0.0.0.0/0", "::/0"] },
{ "direction": "out", "protocol": "udp", "port": "123", "destination_ips": ["0.0.0.0/0", "::/0"] },
{ "direction": "out", "protocol": "tcp", "port": "445", "destination_ips": ["91.98.250.141/32", "2a01:4f8:bacc:2:200::180d/128"] },
{ "direction": "out", "protocol": "udp", "port": "51820", "destination_ips": ["78.58.8.250/32"] },
{ "direction": "out", "protocol": "icmp", "destination_ips": ["0.0.0.0/0", "::/0"] }
]
}
```
Notes:
- `91.98.250.141` / `2a01:4f8:bacc:2:200::180d` are the Hetzner Storage Box
(`//u518679.your-storagebox.de`) used by the `slow` SMB StorageClass.
- `78.58.8.250` is the home WAN / WireGuard endpoint.
- Hetzner's own services (DNS `185.12.64.1/2`, `api.hetzner.cloud`, metadata)
are generally exempt from firewall filtering, but the 443/53 rules cover them.
- Test from a node immediately after: `curl` to a registry, `apt update`, and a
throwaway `crictl pull`.
## Validation checklist
From a node:
```bash
curl -s -o /dev/null -w '%{http_code}\n' https://registry-1.docker.io/v2/ # 401
curl -s -o /dev/null -w '%{http_code}\n' http://archive.ubuntu.com/ubuntu/ # 200
```
From a non-home source (e.g. the master, **not** the home network) the worker
public IPs must refuse:
```bash
nc -vz 95.216.198.61 22 # blocked from master
nc -vz 65.108.84.87 443 # blocked from master
```
Real pull test (per node):
```bash
crictl pull docker.io/library/hello-world:latest
crictl rmi docker.io/library/hello-world:latest
```
## Related
- `Environment.md` → "Firewall / egress"
- `AGENTS.md` → "Network / IP layout"
- `Email/README.md` → step 3.4 (Mailu public SMTP/IMAP caveat)