mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 16:57:55 +00:00
41 lines
833 B
Nix
41 lines
833 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
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";
|
|
journalctl_filter = [
|
|
"_SYSTEMD_UNIT=ssh.service"
|
|
];
|
|
labels.type = "syslog";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|