fail2ban/fail2ban-0.11.2-ufw-0.36-ipv6-2.patch

38 lines
1.4 KiB
Diff

From 5debaa4cac2723fa863ede9ed32c19cc82c71786 Mon Sep 17 00:00:00 2001
From: "Sergey G. Brester" <serg.brester@sebres.de>
Date: Thu, 6 May 2021 20:23:58 +0200
Subject: [PATCH] option "add", can be set to "insert <num>" instead of prepend
(customization or backwards compat)
---
config/action.d/ufw.conf | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/config/action.d/ufw.conf b/config/action.d/ufw.conf
index b47fa7e77..bf06fe679 100644
--- a/config/action.d/ufw.conf
+++ b/config/action.d/ufw.conf
@@ -19,9 +19,9 @@ actioncheck =
actionban = if [ -n "<application>" ] && ufw app info "<application>"
then
- ufw prepend <blocktype> from <ip> to <destination> app "<application>" comment "<comment>"
+ ufw <add> <blocktype> from <ip> to <destination> app "<application>" comment "<comment>"
else
- ufw prepend <blocktype> from <ip> to <destination> comment "<comment>"
+ ufw <add> <blocktype> from <ip> to <destination> comment "<comment>"
fi
ss -K dst [<ip>]
@@ -33,6 +33,10 @@ actionunban = if [ -n "<application>" ] && ufw app info "<application>"
fi
[Init]
+# Option: add
+# Notes.: can be set to "insert 1" to insert a rule at certain position (here 1):
+add = prepend
+
# Option: blocktype
# Notes.: reject or deny
blocktype = reject