CrowdSec
CrowdSec from Debian: detects attacks in the logs (SSH from the journal, nginx, Apache) and blocks the addresses with nftables (own tables). Shares signals with the CrowdSec community and uses its blocklist; private networks are never blocked. Manage with cscli
Add to a guest
In the guest as root – container and VM alike:
update --add-modules crowdsecRuns a normal update and installs the module on the way.
From the Proxmox node, without logging in:
pct exec <ID> -- update --add-modules crowdsec # container
ssh root@<IP> update --add-modules crowdsecChoose when creating a guest
Without a dialog, on the Proxmox node:
IAC_NONINTERACTIVE=1 var_modules=auto-update,crowdsec \
bash -c "$(curl -fsSL https://haypack.dev/<app>/ct.sh)"var_modules replaces the app's preselection – keep auto-update in the list if you want it. Interactive: choose “advanced” in the dialog, or tick the module in the generator on the app page.
Remove
update --remove-modules crowdsecRemoves the module's packages, services, firewall rules and configuration again. Data stays.
Details
CrowdSec from Debian detects attacks in the logs – SSH from the
journal, plus nginx and Apache – and blocks the addresses with nftables in tables of its own
(ip crowdsec, ip6 crowdsec6); the iac firewall stays untouched. CrowdSec reports detected
attacks to CrowdSec’s Central API and in return receives the community blocklist. Addresses from
private networks are never blocked.
cscli decisions list # local bans (with -a also the community's)
cscli decisions delete --ip 192.0.2.10 # lift a ban
cscli metrics # what was read and detected
The local API of CrowdSec only listens on 127.0.0.1:6880, because port 8080 is taken by many
apps. In a VM the module is installed on the first boot, not in the image – so every instance has
its own credentials. When the module is removed, all bans disappear as well. For SSH one of the
two is enough: crowdsec or fail2ban.
CrowdSec aus Debian erkennt Angriffe in den Logs – SSH aus dem
Journal, dazu nginx und Apache – und sperrt die Adressen mit nftables in eigenen Tabellen
(ip crowdsec, ip6 crowdsec6); die Firewall von iac bleibt unberührt. CrowdSec meldet erkannte
Angriffe an die Central API von CrowdSec und erhält dafür die Sperrliste der Community. Adressen
aus privaten Netzen werden nie gesperrt.
cscli decisions list # lokale Sperren (mit -a auch die der Community)
cscli decisions delete --ip 192.0.2.10 # eine Sperre aufheben
cscli metrics # was gelesen und erkannt wurde
Die lokale API von CrowdSec lauscht nur auf 127.0.0.1:6880, weil Port 8080 bei vielen Apps
belegt ist. In einer VM wird das Modul beim ersten Start installiert, nicht im Image – so hat jede
Instanz eigene Zugangsdaten. Wird das Modul entfernt, verschwinden auch alle Sperren. Für SSH
genügt eines von beiden: crowdsec oder fail2ban.