vps: crowdsec firewall bouncer, drop the traefik bait and catchall routers #307
No reviewers
Labels
No labels
audit-work
bug
docs
general-admin
major-upgrade
needs-vps-sync
new-service
on-hold
outside-work
post-podman
renovate
upstream
vps
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mysticalsoap/docker!307
Loading…
Reference in a new issue
No description provided.
Delete branch "vps-firewall-bouncer"
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?
Problem
#102. Bans decided at home were enforced only by the Traefik plugin, so the git-over-SSH port (27341) had no per-IP enforcement at all, and a banned scanner still completed TCP and TLS handshakes to home before getting a 403. The bait router, the catchall router and
addInternalsexisted only to make that L7 plugin see unrouted traffic.Fix
crowdsec-firewall-bouncer-nftablesfrom CrowdSec's apt repo (anysuite, signing key inline in a deb822 sources file), installed byinstall.sh. Config is a committed.yaml.localoverlay plus an api key that lives only on the box; without the key file the bouncer stays down. Bouncer only, no agent (commit body has the reasoning).lapilistener on the tunnel HAProxy (8081 tocrowdsec:8080, tunnel peer only), thewireguardcontainer joins thecrowdsecnetwork, and a secondBOUNCER_KEY_*secret registers the VPS bouncer at container start.addInternalsremoved. Traefik logs unrouted requests regardless (the rotated access logs from before the routers existed carry thousands of unrouted 404s) and the bait scenario keys on the path, so detection is unchanged; enforcing those bans is now the VPS's job. The self-response whitelist parser stays (geoblock 451, AppSec 403, plugin 403 inside the pull window).Verification
Static:
_helper/ci/check-compose.shpasses for every stack,haproxy -con the edited home config passes inside the runninghaproxycontainer,bash -noninstall.sh.Live:
just up infraon the branch: the entrypoint loggedRegistered bouncer for vps;wireguardis on thecrowdsecnetwork.just vps-deploy: the package installed from theanysuite and the bouncer came up with the key. At homecscli bouncers listshowsvps(typecrowdsec-firewall-bouncer) from 172.18.4.3, the tunnel end's crowdsec-network address, pulling/v1/decisions/streamevery 10s with 200s in the LAPI log.newarray only): 23,742 CAPI decisions and 34 local ones, deduplicated by the LAPI to the longest decision per IP, which is why most local bans travel as CAPI. go-cs-bouncer never setscommunity_pull, so the request carriescommunity_pull=false; this LAPI serves the same set with or without it, so the community blocklist is enforced at the edge too.crowdsec-blacklists-CAPI,-crowdsec,-cscli); the basecrowdsec-blacklistsset stays empty. The bouncer's usage metrics at home show 23.74k active CAPI IPs and packets already dropped. Itsactive_decisionsgauge is reported for one origin only (collectActiveBannedIPsreturns inside its loop, v0.0.36), so the missing rows for the other origins mean nothing; their per-origin drop counters exist, so their rules do.23784 decisions addedon the startup sync with sets and rules created for originsCAPI(v4 and v6) andcrowdsec, thencsclion the first manual test ban. Set sizes at 06:2x:crowdsec-blacklists-CAPI23,229,-crowdsec34,-cscli1,crowdsec6-blacklists-CAPI513. Test ban203.0.113.8(added at home 06:22:13) was in thecscliset by 06:22:22; the earlier 30m one appeared at 05:49:42 and left at 06:19:42 on expiry.Not exercised: a bait-path probe from outside against the raw VPS IP. Detection is unchanged by this PR: unrouted 404s were in the access log before the routers existed.
6099e8c29976b95db20aWIP: vps: crowdsec firewall bouncer, drop the traefik bait and catchall routersto vps: crowdsec firewall bouncer, drop the traefik bait and catchall routers76b95db20a114c3c0679