ingress-nginx: git/homeassistant nur über Cloudflare erreichbar (Direktzugriff 403)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 10:51:09 +01:00
co-authored by Claude Opus 5.5
parent 42fa5b0ad8
commit ef1fd33531
+26
View File
@@ -191,6 +191,11 @@ applications:
geoip2-autoreload-in-minutes: "1440"
# Geo restriction for publicly exposed hosts: everything not from DE gets 403
# (also unknown/private IPs - LAN/Tailscale use the internal hostnames instead).
# Cloudflare-only hosts: since tv.smokyzone.de (DNS-only) reveals the home IP, the
# proxied hosts could be reached directly, bypassing Cloudflare. They only accept
# connections whose TCP peer ($realip_remote_addr, i.e. before real-ip rewriting)
# is a Cloudflare range - same ranges as proxy-real-ip-cidr above.
# ArgoCD/Mac reach git.smokyzone.de via public DNS = via Cloudflare, so they are fine.
http-snippet: |
map $host $geo_restricted_host {
default 0;
@@ -200,10 +205,31 @@ applications:
default 0;
"~^1:(?!DE$)" 1;
}
map $host $cf_only_host {
default 0;
git.smokyzone.de 1;
homeassistant.smokyzone.de 1;
}
geo $realip_remote_addr $from_cloudflare {
default 0;
173.245.48.0/20 1; 103.21.244.0/22 1; 103.22.200.0/22 1; 103.31.4.0/22 1;
141.101.64.0/18 1; 108.162.192.0/18 1; 190.93.240.0/20 1; 188.114.96.0/20 1;
197.234.240.0/22 1; 198.41.128.0/17 1; 162.158.0.0/15 1; 104.16.0.0/13 1;
104.24.0.0/14 1; 172.64.0.0/13 1; 131.0.72.0/22 1;
2400:cb00::/32 1; 2606:4700::/32 1; 2803:f800::/32 1; 2405:b500::/32 1;
2405:8100::/32 1; 2a06:98c0::/29 1; 2c0f:f248::/32 1;
}
map "$cf_only_host:$from_cloudflare" $cf_block {
default 0;
"1:0" 1;
}
server-snippet: |
if ($geo_block) {
return 403;
}
if ($cf_block) {
return 403;
}
extraVolumes:
- name: geoip
hostPath: