From c753ffb11d8ad81c03a89398892b0e1870e8707f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 24 Sep 2019 15:01:58 +0200 Subject: [PATCH] combine nftables actions to single action: - nftables-common is removed - nftables-allports is obsolete, replaced by nftables[type=allports] - nftables-multiport is obsolete, replaced by nftables[type=multiport] --- config/action.d/nftables-allports.conf | 11 +++------- config/action.d/nftables-multiport.conf | 11 +++------- .../{nftables-common.conf => nftables.conf} | 22 ++++++++++++++----- 3 files changed, 22 insertions(+), 22 deletions(-) rename config/action.d/{nftables-common.conf => nftables.conf} (89%) diff --git a/config/action.d/nftables-allports.conf b/config/action.d/nftables-allports.conf index fad5273a..908abe40 100644 --- a/config/action.d/nftables-allports.conf +++ b/config/action.d/nftables-allports.conf @@ -6,17 +6,12 @@ # Modified: Alexander Belykh # adapted for nftables # +# Obsolete: superseded by nftables[type=allports] [INCLUDES] -before = nftables-common.conf +before = nftables.conf [Definition] -# Option: match -# Notes.: additional matches for nftables filter rule -# Values: nftables matches -# -match = meta l4proto \{ \} - -[Init] +type = allports diff --git a/config/action.d/nftables-multiport.conf b/config/action.d/nftables-multiport.conf index 6e3775ae..ba3ec92c 100644 --- a/config/action.d/nftables-multiport.conf +++ b/config/action.d/nftables-multiport.conf @@ -6,17 +6,12 @@ # Modified: Alexander Belykh # adapted for nftables # +# Obsolete: superseded by nftables[type=multiport] [INCLUDES] -before = nftables-common.conf +before = nftables.conf [Definition] -# Option: match -# Notes.: additional matches for nftables filter rule -# Values: nftables matches -# -match = dport \{ \} - -[Init] +type = multiport \ No newline at end of file diff --git a/config/action.d/nftables-common.conf b/config/action.d/nftables.conf similarity index 89% rename from config/action.d/nftables-common.conf rename to config/action.d/nftables.conf index 6765fbb3..79efbde2 100644 --- a/config/action.d/nftables-common.conf +++ b/config/action.d/nftables.conf @@ -26,12 +26,22 @@ after = nftables-common.local [Definition] -# Option: match -# Notes.: additional matches for nftables filter rule. -# leaving it empty will block all. (include udp and icmp) -# Values: nftables matches +# Option: type +# Notes.: type of the action. +# Values: [ multiport | allports ] Default: multiport # -match = dport \{ \} +type = multiport + +rule_match-allports = meta l4proto \{ \} +rule_match-multiport = dport \{ \} +match = > + +# Option: rule_stat +# Notes.: statement for nftables filter rule. +# leaving it empty will block all (include udp and icmp) +# Values: nftables statement +# +rule_stat = %(match)s saddr @ # Option: actionstart # Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false). @@ -40,7 +50,7 @@ match = dport \{ \} actionstart = add table f2b-table -- add chain f2b-table f2b-chain \{ type hook priority \; \} add set f2b-table \{ type \; \} - add rule f2b-table f2b-chain %(match)s saddr @ + add rule f2b-table f2b-chain %(rule_stat)s _nft_list = -a list chain f2b-table f2b-chain _nft_get_handle_id = grep -m1 '@ ' | grep -oe ' handle [0-9]*'