firewall: 80/443 DROP unreachable on the old node (RETURN first); git DNS-only conflicts with Cloudflare-only rule (cutover blocker) #233
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found 2026-10-16 while checking the old production node after the firewall deploy (#230). Read-only checks only.
1. The 80/443 Cloudflare-only DROP is dead on the old production node
iptables -L DOCKER-USER --line-numbers:RETURNis rule 82 (268K packets), the twomultiport 80,443 DROPrules are 83 and 84 with 0 packets.Rules after RETURN are never reached. The same on IPv6 (RETURN 50 of 52).
curl --resolve git.jfraeys.com:443:172.105.107.95returns 200 over IPv4 and over IPv6.auth,vaultandjfraeys.comare proxied by Cloudflare, so this bypasses Cloudflare (WAF, bot rules, rate limits) for them.Authelia and Vaultwarden still authenticate; this removes a layer, it is not an auth bypass. The origin IP is public anyway (git's A record).
(3041 packets dropped on port 22).
docker-user-firewall.sh.j2appends the DROPs with-Aand adds RETURN only|| -Aif absent. If Docker's own RETURN exists first, the DROPs land behind it.Whether the order is right depends on whether Docker or the script created the chain first. The new OVH node got it right (DROP 83-84, RETURN 85;
a direct request to 51.79.103.235:443 times out); the old node got it wrong. My earlier old/new comparison sorted the rules and could not show order.
2. The intended rule contradicts DNS for git
Cloudflare DNS (read-only API check):
git.jfraeys.comA/AAAA are proxied=false (DNS only);auth,vault,jfraeys.comare proxied=true.With the DROP effective, git.jfraeys.com would be unreachable for everyone except Cloudflare addresses.
Consequence for the OVH cutover
The new node enforces the DROP. If git's DNS-only record points at it, HTTPS git (clone, push, API, web UI) stops working for the public at cutover.
Do not
Do not deploy a fix that makes RETURN last to the old node before this is decided: it would activate the DROP and take git.jfraeys.com down.
To decide
Options for exposing git with a working Cloudflare-only 80/443 rule (2026-10-16)
Facts these rest on: the DROP matches by port and source address, never by hostname, so it cannot treat
gitdifferently fromauth/vault.firewall_restrict_web_to_cloudflareis derived, not set per host: true whenevertraefik_certresolver == cloudflareand the host is not staging.git.jfraeys.comandvpn.jfraeys.comare DNS-only because Cloudflare's Bot Fight Mode (Free plan, zone-wide, no per-hostname exemption)challenges non-browser clients (git, CI, API tokens); see docs/incidents.md. Nothing in terraform or roles/traefik today uses
Authenticated Origin Pulls or a Traefik IP allowlist.
firewall_restrict_web_to_cloudflare: false)Recommendation
It also removes the Cloudflare ACCEPT list from the chain (smaller, and the ordering bug no longer matters for 80/443). No outage risk; verify with a direct request to the new node after deploy.
Not recommended: A, B, C.
Decision 2026-10-16: option E now (rule off for all hosts, RETURN-last fix and check in the script), PR opened. The planned move from Cloudflare to deSEC makes E the end state: deSEC does not proxy, so no name is proxied and the Cloudflare-only rule has no purpose. Option D (Authenticated Origin Pulls with a per-router Traefik tlsOption) is NOT built; it is recorded in FUTURE_IMPROVEMENTS.md as the way to restrict the origin per host if Cloudflare proxying returns. Cutover note: with the rule off, direct 443 on the new OVH node is open, as on the old node, so git keeps working when DNS moves.
Deployed to services 2026-10-16 (PR #235). Verified: DOCKER-USER 85/53 -> 22/22 rules (v4/v6), RETURN last and unique, no 80/443 or 2222 rules, 22/25/17170 DROPs and tailnet ACCEPTs intact, ports 25/17170 closed publicly, 15 containers healthy, git/auth/vault/jfraeys.com 200. Remaining for this issue: run the firewall tag on the OVH rehearsal node (it still has the old rule set; direct 443 is blocked there), and keep the cutover note that git needs direct 443 open.
Update 2026-10-16: PR #235 (RETURN last + Cloudflare-only rule off) is merged and deployed to services. Verified: DOCKER-USER 85/53 -> 22/22 rules, RETURN last, no 80/443 or 2222 rules, 22/25/17170 protections intact, sites 200. Remaining: run --tags firewall on the OVH rehearsal node (it still has the old rule set, direct 443 blocked), then close. Related: tailnet and admin-tool access hardening is tracked in #251.
Done 2026-10-17: the firewall tag was run on the OVH rehearsal node and verified. DOCKER-USER on ovh-services: 22/22 rules (v4/v6), RETURN last and unique, no 80/443 and no 2222 rules, 22/25/17170 DROPs and tailnet ACCEPTs intact, docker-user-firewall.service active, 15 containers healthy. Direct 443 now answers 200 on the new node as on the old one (git.jfraeys.com stays reachable at cutover); ports 17170, 25, 2222, 3000, 9093 stay closed publicly. Both nodes now have identical chains. Fixed in #235 (RETURN last, rule off), documented in docs/incidents.md. Closing.