feat: Add crowdsec to replace fail2ban

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

View file

@ -18,6 +18,7 @@
./services/backups.nix
./services/battery-manager.nix
./services/conduit.nix
./services/crowdsec.nix
./services/foundryvtt.nix
./services/gitea.nix
./services/metrics

View file

@ -0,0 +1,27 @@
{ pkgs, ... }:
{
security.crowdsec = {
enable = true;
remediationComponents.firewallBouncer.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
---
'';
};
}

View file

@ -10,6 +10,7 @@
extraSettings.authorization.credentials_file = config.sops.secrets."forgejo/metrics-token".path;
};
coturn.targets = [ "127.0.0.1:9641" ];
crowdsec.targets = [ "127.0.0.1:6060" ];
};
};
}