diff --git a/modules/nixos/services/pyload/default.nix b/modules/nixos/services/pyload/default.nix
index 88889bf..7257d0f 100644
--- a/modules/nixos/services/pyload/default.nix
+++ b/modules/nixos/services/pyload/default.nix
@@ -53,6 +53,20 @@ in
};
};
- # FIXME: fail2ban
+ services.fail2ban.jails = {
+ pyload = ''
+ enabled = true
+ filter = pyload
+ port = http,https
+ '';
+ };
+
+ environment.etc = {
+ "fail2ban/filter.d/pyload.conf".text = ''
+ [Definition]
+ failregex = ^.*Login failed for user '.*' \[CLIENT: \]$
+ journalmatch = _SYSTEMD_UNIT=pyload.service
+ '';
+ };
};
}