its beginning to look alot like christmas
This commit is contained in:
parent
df67864b76
commit
1f43626404
|
@ -2,7 +2,14 @@
|
||||||
with lib;
|
with lib;
|
||||||
let cfg = config.void.server;
|
let cfg = config.void.server;
|
||||||
in {
|
in {
|
||||||
imports = [ ./dns ./nginx.nix ./services ./postgresql.nix ./redis.nix ];
|
imports = [
|
||||||
|
./dns
|
||||||
|
./nginx.nix
|
||||||
|
./services
|
||||||
|
./postgresql.nix
|
||||||
|
./redis.nix
|
||||||
|
./fail2ban.nix
|
||||||
|
];
|
||||||
|
|
||||||
options.void.server = { isServer = mkEnableOption false; };
|
options.void.server = { isServer = mkEnableOption false; };
|
||||||
|
|
||||||
|
|
40
modules/server/fail2ban.nix
Normal file
40
modules/server/fail2ban.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let cfg = config.void.server.fail2ban;
|
||||||
|
in {
|
||||||
|
options.void.server.fail2ban = { enable = mkEnableOption false; };
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# again thank you notashelf (again)
|
||||||
|
services.fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
ignoreIP = [
|
||||||
|
"127.0.0.1/8" # localhost
|
||||||
|
"100.64.0.0/16"
|
||||||
|
"192.168.0.0/16"
|
||||||
|
];
|
||||||
|
banaction = "iptables-multiport";
|
||||||
|
banaction-allports = lib.mkDefault "iptables-allport";
|
||||||
|
|
||||||
|
maxretry = 7;
|
||||||
|
bantime = "10m";
|
||||||
|
bantime-increment = {
|
||||||
|
enable = true;
|
||||||
|
rndtime = "12m";
|
||||||
|
overalljails = true;
|
||||||
|
multipliers = "4 8 16 32 64 128 256 512 1024 2048";
|
||||||
|
maxtime = "10000h"; # ill see you when nix eval times are fast
|
||||||
|
};
|
||||||
|
daemonSettings = {
|
||||||
|
Definition = {
|
||||||
|
loglevel = "INFO";
|
||||||
|
logtarget = "/var/log/fail2ban/fail2ban.log";
|
||||||
|
socket = "/run/fail2ban/fail2ban.sock";
|
||||||
|
pidfile = "/run/fail2ban/fail2ban.pid";
|
||||||
|
dbfile = "/var/lib/fail2ban/fail2ban.sqlite3";
|
||||||
|
dbpurageage = "1d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -63,7 +63,7 @@ in {
|
||||||
services.fail2ban.jails.forgejo = {
|
services.fail2ban.jails.forgejo = {
|
||||||
settings = {
|
settings = {
|
||||||
filter = "forgejo";
|
filter = "forgejo";
|
||||||
action = "nftables-multiport";
|
action = "iptables-multiport";
|
||||||
mode = "aggressive";
|
mode = "aggressive";
|
||||||
maxretry = 5;
|
maxretry = 5;
|
||||||
findtime = 3600;
|
findtime = 3600;
|
||||||
|
|
Loading…
Reference in a new issue