Ingress: switch to Traefik (cf-only middleware), trust Cloudflare ranges as proxies

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-02 12:16:12 +01:00
co-authored by Claude Opus 5.5
parent 8cafb48c83
commit 55c6614bfc
2 changed files with 32 additions and 8 deletions
+3 -2
View File
@@ -8,8 +8,9 @@ URL: https://homeassistant.smokyzone.de - **public**, like git: the DNS record i
Cloudflare-proxied CNAME to `git.smokyzone.de` (public IP kept current by the ddns Cloudflare-proxied CNAME to `git.smokyzone.de` (public IP kept current by the ddns
CronJob), the router forwards 443 to the ingress. The companion app works without VPN. CronJob), the router forwards 443 to the ingress. The companion app works without VPN.
Protection is HA itself: every user needs MFA (TOTP), and the HTTP settings ban an IP after Protection is HA itself: every user needs MFA (TOTP), and the HTTP settings ban an IP after
5 failed logins (ingress-nginx passes the real client IP from Cloudflare's 5 failed logins (Traefik keeps Cloudflare's X-Forwarded-For, HA trusts the pod network and
`CF-Connecting-IP`). Certificate from `letsencrypt-dns-cloudflare` (DNS-01). the Cloudflare ranges as proxies). The ingress only accepts connections from Cloudflare
(Middleware `traefik/cf-only`). Certificate from `letsencrypt-dns-cloudflare` (DNS-01).
## Design ## Design
+29 -6
View File
@@ -18,14 +18,38 @@ persistence:
size: 5Gi size: 5Gi
storageClassName: "" storageClassName: ""
# Lets HA accept requests from ingress-nginx (pod network 10.1.0.0/16); without it HA # Lets HA accept requests from Traefik (pod network 10.1.0.0/16); without it HA
# answers 400 Bad Request to proxied requests. Since 2026.10 HA keeps the HTTP settings # answers 400 Bad Request to proxied requests. Since 2026.10 HA keeps the HTTP settings
# in /config/.storage/http (UI-managed); an `http:` block in configuration.yaml is only # in /config/.storage/http (UI-managed); an `http:` block in configuration.yaml is only
# imported as an unconfirmed trial and reverted after 5 minutes. So the chart seeds the # imported as an unconfirmed trial and reverted after 5 minutes. So the chart seeds the
# store directly - on first start only, never overwriting an existing one. # store directly - on first start only, never overwriting an existing one.
# Cloudflare ranges too: Traefik keeps Cloudflare's X-Forwarded-For (client IP) and appends
# the Cloudflare edge, so HA has to skip that hop to find the real client (for ip_ban).
trustedProxies: trustedProxies:
- 10.1.0.0/16 - 10.1.0.0/16
- 127.0.0.1/32 - 127.0.0.1/32
- 173.245.48.0/20
- 103.21.244.0/22
- 103.22.200.0/22
- 103.31.4.0/22
- 141.101.64.0/18
- 108.162.192.0/18
- 190.93.240.0/20
- 188.114.96.0/20
- 197.234.240.0/22
- 198.41.128.0/17
- 162.158.0.0/15
- 104.16.0.0/13
- 104.24.0.0/14
- 172.64.0.0/13
- 131.0.72.0/22
- 2400:cb00::/32
- 2606:4700::/32
- 2803:f800::/32
- 2405:b500::/32
- 2405:8100::/32
- 2a06:98c0::/29
- 2c0f:f248::/32
# Written to /config/configuration.yaml on first start only (when the file does not # Written to /config/configuration.yaml on first start only (when the file does not
# exist yet). Afterwards the file belongs to you; the chart never overwrites it. # exist yet). Afterwards the file belongs to you; the chart never overwrites it.
@@ -42,7 +66,7 @@ seedConfiguration: |
ingress: ingress:
enabled: true enabled: true
className: nginx className: traefik
# Public like git (user decision 2026-10-18): the DNS record is a Cloudflare-proxied # Public like git (user decision 2026-10-18): the DNS record is a Cloudflare-proxied
# CNAME to git.smokyzone.de (kept current by the ddns CronJob), the router forwards 443 # CNAME to git.smokyzone.de (kept current by the ddns CronJob), the router forwards 443
# to the ingress. So the companion app works without Tailscale. No source allow-list on # to the ingress. So the companion app works without Tailscale. No source allow-list on
@@ -50,10 +74,9 @@ ingress:
host: homeassistant.smokyzone.de host: homeassistant.smokyzone.de
clusterIssuer: letsencrypt-dns-cloudflare clusterIssuer: letsencrypt-dns-cloudflare
annotations: annotations:
# Websocket connection of the frontend / companion app stays open. # Only reachable through Cloudflare (not directly via the home IP that tv.* reveals).
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" # Traefik has no proxy timeouts/body limit by default (websockets stay open).
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" traefik.ingress.kubernetes.io/router.middlewares: traefik-cf-only@kubernetescrd
nginx.ingress.kubernetes.io/proxy-body-size: 100m
# USB radios (Zigbee/Z-Wave sticks), e.g. /dev/serial/by-id/usb-...; needs privileged. # USB radios (Zigbee/Z-Wave sticks), e.g. /dev/serial/by-id/usb-...; needs privileged.
devices: [] devices: []