nixos-config/modules/nixos/_private/shared-setups/server/crowdsec.nix

37 lines
809 B
Nix
Raw Permalink Normal View History

{ config, lib, pkgs, ... }:
2025-01-29 04:48:19 +00:00
let cfg = config.shared-setups.server.crowdsec;
in {
options.shared-setups.server.crowdsec.enable =
lib.mkEnableOption "typical Crowdsec setup for public-facing servers";
config = lib.mkIf cfg.enable {
services.crowdsec = {
enable = true;
settings = {
common = {
daemonize = false;
log_media = "stdout";
};
};
notificationPlugins = {
http = {
settings = {
type = "http";
log_level = "info";
};
};
};
dataSources = {
ssh = lib.mkIf config.services.sshd.enable {
source = "journalctl";
2025-01-29 04:48:19 +00:00
journalctl_filter = [ "_SYSTEMD_UNIT=ssh.service" ];
labels.type = "syslog";
};
};
};
};
}