mirror of https://github.com/fail2ban/fail2ban
Refactor nftables actionstop into smaller parts
parent
9779eeb986
commit
985e8938a4
|
@ -31,11 +31,15 @@ nftables_mode = <protocol> dport \{ <port> \}
|
||||||
actionstart = <nftables> add set <nftables_family> <nftables_table> f2b-<name> \{ type <nftables_type>\; \}
|
actionstart = <nftables> add set <nftables_family> <nftables_table> f2b-<name> \{ type <nftables_type>\; \}
|
||||||
<nftables> insert rule <nftables_family> <nftables_table> <chain> %(nftables_mode)s ip saddr @f2b-<name> <blocktype>
|
<nftables> insert rule <nftables_family> <nftables_table> <chain> %(nftables_mode)s ip saddr @f2b-<name> <blocktype>
|
||||||
|
|
||||||
|
_nft_list = <nftables> --handle --numeric list chain <nftables_family> <nftables_table> <chain>
|
||||||
|
_nft_get_handle_id = grep -m1 'ip saddr @f2b-<name> <blocktype> # handle' | grep -oe ' handle [0-9]*'
|
||||||
|
|
||||||
# Option: actionstop
|
# Option: actionstop
|
||||||
# Notes.: command executed once at the end of Fail2Ban
|
# Notes.: command executed once at the end of Fail2Ban
|
||||||
# Values: CMD
|
# Values: CMD
|
||||||
#
|
#
|
||||||
actionstop = HANDLE_ID=$(<nftables> --handle --numeric list chain <nftables_family> <nftables_table> <chain> | grep -m1 'ip saddr @f2b-<name> <blocktype> # handle' | grep -oe ' handle [0-9]*'); <nftables> delete rule <nftables_family> <nftables_table> <chain> $HANDLE_ID
|
actionstop = HANDLE_ID=$(%(_nft_list)s | %(_nft_get_handle_id)s)
|
||||||
|
<nftables> delete rule <nftables_family> <nftables_table> <chain> $HANDLE_ID
|
||||||
<nftables> delete set <nftables_family> <nftables_table> f2b-<name>
|
<nftables> delete set <nftables_family> <nftables_table> f2b-<name>
|
||||||
|
|
||||||
# Option: actioncheck
|
# Option: actioncheck
|
||||||
|
|
Loading…
Reference in New Issue