diff --git a/modules/server/core/fail2ban.nix b/modules/server/core/fail2ban.nix index 301c819..e6cd8e7 100644 --- a/modules/server/core/fail2ban.nix +++ b/modules/server/core/fail2ban.nix @@ -1,7 +1,7 @@ -{ pkgs, lib, config, ... }: +{ lib, config, ... }: let inherit (builtins) concatStringsSep; - inherit (lib) mkIf mkOption types optionalString; + inherit (lib) mkIf mkOption types; cfg = config.modules.server; notificationsEnabled = cfg.ntfyChannel != null; @@ -24,20 +24,12 @@ in { jails.DEFAULT.settings = { action = concatStringsSep "\n " [ "%(action_)s[blocktype=DROP]" - (optionalString notificationsEnabled "ntfy") ]; findtime = "4h"; }; }; - # TODO: norestored does not work - environment.etc."fail2ban/action.d/ntfy.local".text = optionalString notificationsEnabled '' - [Definition] - norestored = true # Needed to avoid receiving a new notification after every restart - actionban = ${pkgs.curl}/bin/curl -H "Title: New ban! : " -d ": (x)" ntfy.sh/${cfg.ntfyChannel} - ''; - # TODO: Auto restart # FIXME: https://github.com/NixOS/nixpkgs/issues/288436 # systemd.services."fail2ban".restartTriggers = [ ];