diff --git a/config/action.d/nftables-common.conf b/config/action.d/nftables-common.conf index 26e35892..80657c5c 100644 --- a/config/action.d/nftables-common.conf +++ b/config/action.d/nftables-common.conf @@ -31,11 +31,15 @@ nftables_mode = dport \{ \} actionstart = add set f2b- \{ type \; \} insert rule %(nftables_mode)s ip saddr @f2b- +_nft_list = --handle --numeric list chain +_nft_get_handle_id = grep -m1 'ip saddr @f2b- # handle' | grep -oe ' handle [0-9]*' + # Option: actionstop # Notes.: command executed once at the end of Fail2Ban # Values: CMD # -actionstop = HANDLE_ID=$( --handle --numeric list chain | grep -m1 'ip saddr @f2b- # handle' | grep -oe ' handle [0-9]*'); delete rule $HANDLE_ID +actionstop = HANDLE_ID=$(%(_nft_list)s | %(_nft_get_handle_id)s) + delete rule $HANDLE_ID delete set f2b- # Option: actioncheck