feat: Add crowdsec to replace fail2ban

This commit is contained in:
Tristan Daniël Maat 2025-01-30 03:50:08 +08:00
parent d0c6f2bcbe
commit 40187d4b2d
Signed by: tlater
GPG key ID: 49670FD774E43268
3 changed files with 52 additions and 0 deletions
configuration/services

View file

@ -0,0 +1,35 @@
{ pkgs, ... }:
{
security.crowdsec = {
enable = true;
parserWhitelist = [
"1.64.239.213"
];
settings.crowdsec_service.acquisition_path = pkgs.writeText "crowdsec-acquisitions.yaml" ''
---
source: journalctl
journalctl_filter:
- "SYSLOG_IDENTIFIER=Nextcloud"
labels:
type: syslog
---
source: journalctl
journalctl_filter:
- "SYSLOG_IDENTIFIER=sshd-session"
labels:
type: syslog
---
'';
remediationComponents.firewallBouncer = {
enable = true;
settings.prometheus = {
enabled = true;
listen_addr = "127.0.0.1";
listen_port = "60601";
};
};
};
}