blob: a42aab3c09944c016e49e368f92734644f45ec94 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{
config,
lib,
this,
...
}:
with lib; let
cfg = config.nixfiles.modules.fail2ban;
in {
options.nixfiles.modules.fail2ban.enable =
mkEnableOption "fail2ban";
config = mkIf cfg.enable {
ark.directories = ["/var/lib/fail2ban"];
services.fail2ban = {
enable = true;
bantime-increment = {
enable = true;
maxtime = "24h";
rndtime = "8m";
};
ignoreIP =
optionals (hasAttr "wireguard" this)
(with config.nixfiles.modules.wireguard; [ipv4.subnet ipv6.subnet]);
jails.DEFAULT = ''
blocktype = DROP
'';
};
};
}
|