summaryrefslogtreecommitdiff
path: root/sys/net/fail2ban.nix
blob: 32197b67cc787807a58842291c743fb33b82b16e (plain)
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
35
36
37
{
  lib,
  config,
  pkgs,
  ...
}:
with lib; let
  cfg = config.local.net.fail2ban;
  inherit (config.local) nets;
in {
  options.local.net.fail2ban = {
    enable = mkEnableOption "fail2ban";
  };

  config = mkIf cfg.enable {
    services.fail2ban = {
      enable = true;

      bantime = "10m";

      bantime-increment = {
        enable = true;

        maxtime = "48h";
        rndtime = "10m";
        overalljails = true;
      };

      ignoreIP = [
        nets.static-vpn.v6.cidr
        nets.gate-srv.v6.cidr
        nets.gate-public.hosts.gate.v4.address
        nets.gate-public.hosts.gate.v6.address
      ];
    };
  };
}