mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
services/{fail2ban,postgres}: Split up from athame
This commit is contained in:
parent
8a4e5992bb
commit
9b1602ec36
2 changed files with 42 additions and 0 deletions
37
services/fail2ban.nix
Normal file
37
services/fail2ban.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
jails = {
|
||||||
|
DEFAULT = ''
|
||||||
|
bantime = 1d
|
||||||
|
blocktype = DROP
|
||||||
|
logpath = /var/log/auth.log
|
||||||
|
'';
|
||||||
|
ssh = ''
|
||||||
|
enabled = true
|
||||||
|
filter = sshd
|
||||||
|
maxretry = 4
|
||||||
|
action = iptables[name=SSH, port=ssh, protocol=tcp]
|
||||||
|
'';
|
||||||
|
sshd-ddos = ''
|
||||||
|
enabled = true
|
||||||
|
filter = sshd-ddos
|
||||||
|
maxretry = 4
|
||||||
|
action = iptables[name=ssh, port=ssh, protocol=tcp]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."fail2ban/filter.d/sshd-ddos.conf" = {
|
||||||
|
enable = true;
|
||||||
|
text = ''
|
||||||
|
[Definition]
|
||||||
|
failregex = sshd(?:\[\d+\])?: Did not receive identification string from <HOST>$
|
||||||
|
ignoreregex =
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.fail2ban.serviceConfig.LimitSTACK = 128 * 1024;
|
||||||
|
}
|
||||||
5
services/postgres.nix
Normal file
5
services/postgres.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.postgresql.enable = true;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue