summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordatafoo <34766150+datafoo@users.noreply.github.com>2023-04-17 11:22:09 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-04-19 17:19:05 +0000
commit05cdfa49027a05d2862c16986e0924b370fccc0a (patch)
tree2897a5c5a6c7a03a7a7036834fd9e91742b5aa2f
parentMerge pull request #227089 from NixOS/backport-227065-to-release-22.11 (diff)
downloadnixpkgs-origin/backport-226611-to-release-22.11.tar.gz
nixos/fail2ban: add bantime optionorigin/backport-226611-to-release-22.11
(cherry picked from commit 88009a3b19cbb8bf28a11adfbf3334ab763fcdde)
-rw-r--r--nixos/modules/services/security/fail2ban.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/modules/services/security/fail2ban.nix b/nixos/modules/services/security/fail2ban.nix
index e208eed008ae..72582befc509 100644
--- a/nixos/modules/services/security/fail2ban.nix
+++ b/nixos/modules/services/security/fail2ban.nix
@@ -79,6 +79,13 @@ in
'';
};
+ bantime = mkOption {
+ default = null;
+ type = types.nullOr types.str;
+ example = "10m";
+ description = lib.mdDoc "Number of seconds that a host is banned.";
+ };
+
maxretry = mkOption {
default = 3;
type = types.ints.unsigned;
@@ -331,6 +338,9 @@ in
''}
# Miscellaneous options
ignoreip = 127.0.0.1/8 ${optionalString config.networking.enableIPv6 "::1"} ${concatStringsSep " " cfg.ignoreIP}
+ ${optionalString (cfg.bantime != null) ''
+ bantime = ${cfg.bantime}
+ ''}
maxretry = ${toString cfg.maxretry}
backend = systemd
# Actions