From 9779eeb986e323608207f9790556d7b9ce6816f1 Mon Sep 17 00:00:00 2001 From: Alexander Belykh Date: Wed, 6 Jan 2016 17:33:14 +0600 Subject: [PATCH] Add nftables_type/family/table parameters --- config/action.d/nftables-common.conf | 32 ++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/config/action.d/nftables-common.conf b/config/action.d/nftables-common.conf index 157f3c77..26e35892 100644 --- a/config/action.d/nftables-common.conf +++ b/config/action.d/nftables-common.conf @@ -28,21 +28,21 @@ nftables_mode = dport \{ \} # Notes.: command executed once at the start of Fail2Ban. # Values: CMD # -actionstart = add set filter f2b- \{ type ipv4_addr\; \} - insert rule filter %(nftables_mode)s ip saddr @f2b- +actionstart = add set f2b- \{ type \; \} + insert rule %(nftables_mode)s ip saddr @f2b- # Option: actionstop # Notes.: command executed once at the end of Fail2Ban # Values: CMD # -actionstop = HANDLE_ID=$( --handle --numeric list chain filter | grep -m1 'ip saddr @f2b- # handle' | grep -oe ' handle [0-9]*'); delete rule filter $HANDLE_ID - delete set filter f2b- +actionstop = HANDLE_ID=$( --handle --numeric list chain | grep -m1 'ip saddr @f2b- # handle' | grep -oe ' handle [0-9]*'); delete rule $HANDLE_ID + delete set f2b- # Option: actioncheck # Notes.: command executed once before each actionban command # Values: CMD # -actioncheck = list chain filter | grep -q '@f2b-[ \t]' +actioncheck = list chain | grep -q '@f2b-[ \t]' # Option: actionban # Notes.: command executed when banning an IP. Take care that the @@ -50,7 +50,7 @@ actioncheck = list chain filter | grep -q '@f2b-[ \t]' # Tags: See jail.conf(5) man page # Values: CMD # -actionban = add element filter f2b- \{ \} +actionban = add element f2b- \{ \} # Option: actionunban # Notes.: command executed when unbanning an IP. Take care that the @@ -58,10 +58,28 @@ actionban = add element filter f2b- \{ \} # Tags: See jail.conf(5) man page # Values: CMD # -actionunban = delete element filter f2b- \{ \} +actionunban = delete element f2b- \{ \} [Init] +# Option: nftables_type +# Notes.: address type to work with +# Values: [ipv4_addr | ipv6_addr] Default: ipv4_addr +# +nftables_type = ipv4_addr + +# Option: nftables_family +# Notes.: address family to work in +# Values: [ip | ip6 | inet] Default: inet +# +nftables_family = inet + +# Option: nftables_table +# Notes.: table in the address family to work in +# Values: STRING Default: filter +# +nftables_table = filter + # Option: chain # Notes specifies the nftables chain to which the Fail2Ban rules should be # added