Compare commits

...

3 Commits

View File

@@ -316,7 +316,6 @@
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowPing = true; allowPing = true;
defaultAllow = false;
# Only essential ports exposed to internet # Only essential ports exposed to internet
allowedTCPPorts = [ allowedTCPPorts = [
@@ -356,50 +355,55 @@
# Fail2ban - automatic IP banning # Fail2ban - automatic IP banning
services.fail2ban = { services.fail2ban = {
enable = true; enable = true;
maxRetry = 3; maxretry = 3;
findtime = 600; bantime = "1h";
bantime = 3600;
banaction = "iptables-multiport"; banaction = "iptables-multiport";
# Ban repeat offenders for 1 week
recidive = {
enabled = true;
filter = "recidive";
logpath = "/var/log/fail2ban.log";
bantime = 604800;
findtime = 86400;
maxretry = 3;
};
jails = { jails = {
# Ban repeat offenders for 1 week
recidive = {
enabled = true;
filter = "recidive";
settings = {
logpath = "/var/log/fail2ban.log";
bantime = "1w";
findtime = "1d";
maxretry = 3;
};
};
# SSH brute force protection # SSH brute force protection
sshd = { sshd = {
enabled = true; enabled = true;
filter = "sshd"; settings = {
port = "2424"; port = "2424";
logpath = "/var/log/auth.log"; maxretry = 3;
maxretry = 3; bantime = "1h";
bantime = 3600; };
}; };
# HTTP authentication failures # HTTP authentication failures
http-auth = { http-auth = {
enabled = true; enabled = true;
filter = "apache-auth"; filter = "apache-auth";
port = "80,443"; settings = {
logpath = "/var/log/traefik/access.log"; port = "80,443";
maxretry = 5; logpath = "/var/log/traefik/access.log";
bantime = 3600; maxretry = 5;
bantime = "1h";
};
}; };
# HTTP scanning/attacks # HTTP scanning/attacks
http-botsearch = { http-botsearch = {
enabled = true; enabled = true;
filter = "apache-botsearch"; filter = "apache-botsearch";
port = "80,443"; settings = {
logpath = [ "/var/log/traefik/access.log" ]; port = "80,443";
maxretry = 2; logpath = "/var/log/traefik/access.log";
bantime = 7200; maxretry = 2;
bantime = "2h";
};
}; };
}; };
}; };
@@ -470,7 +474,7 @@
}; };
# Audit logging # Audit logging
services.auditd.enable = true; security.audit.enable = true;
# Fail2ban log directory # Fail2ban log directory
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [