mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
action.d/nftables.conf - fixed for SELinux without execmem permission, rewrite capturing with grep -P using grep -E or sed;
(PCRE-JIT by `grep -P` may cause SELinux denial for execmem), closes gh-4137
This commit is contained in:
parent
948e923589
commit
8506e4a41d
3 changed files with 9 additions and 6 deletions
|
|
@ -40,6 +40,9 @@ ver. 1.1.1-dev-1 (20??/??/??) - development nightly edition
|
|||
- postfix backend switched to `systemd` (gh-3527)
|
||||
* `action.d/firewallcmd-ipset.conf`:
|
||||
- rename `ipsettype` to `ipsetbackend` (gh-2620), parameter `ipsettype` will be used now to the real set type (gh-3760)
|
||||
* `action.d/nftables.conf`:
|
||||
- action fixed for SELinux without execmem permission, rewrite capturing with `grep -P` using `grep -E` or `sed`
|
||||
(PCRE-JIT by `grep -P` may cause SELinux denial for execmem, see gh-4137)
|
||||
* `action.d/xarf-login-attack.conf` - ignore errors or warnings in output of `dig` provided as comment (gh-4068)
|
||||
* `filter.d/apache-badbots.conf`, `filter.d/apache-fakegooglebot.conf`:
|
||||
- regexs rewritten more strict (removed catch-alls, etc);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ _nft_for_proto-multiport-iter = for proto in $(echo '<protocol>' | sed 's/,/ /g'
|
|||
_nft_for_proto-multiport-done = done
|
||||
|
||||
_nft_list = <nftables> -a list chain <table_family> <table> <chain>
|
||||
_nft_get_handle_id = grep -oP '@<addr_set>\s+.*\s+\Khandle\s+(\d+)$'
|
||||
_nft_get_handle_id = sed -nE 's/.*@<addr_set>\s+.*\s+\#\s*(handle\s+[0-9]+)$/\1/p'
|
||||
|
||||
_nft_add_set = <nftables> add set <table_family> <table> <addr_set> \{ type <addr_type>\;<addr_options> \}
|
||||
<_nft_for_proto-<type>-iter>
|
||||
|
|
@ -67,7 +67,7 @@ _nft_del_set = { %(_nft_list)s | %(_nft_get_handle_id)s; } | while read -r hdl;
|
|||
# Notes.: command executed after the stop in order to delete table (it checks that no sets are available):
|
||||
# Values: CMD
|
||||
#
|
||||
_nft_shutdown_table = { <nftables> list table <table_family> <table> | grep -qP '^\s+set\s+'; } || {
|
||||
_nft_shutdown_table = { <nftables> list table <table_family> <table> | grep -qE '^\s+set\s+'; } || {
|
||||
<nftables> delete table <table_family> <table>
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1362,10 +1362,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|||
"`{ nft flush set inet f2b-table addr6-set-j-w-nft-mp 2> /dev/null; } || ",
|
||||
),
|
||||
'stop': (
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr-set-j-w-nft-mp\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`",
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | sed -nE 's/.*@addr-set-j-w-nft-mp\s+.*\s+\#\s*(handle\s+[0-9]+)$/\1/p'; } | while read -r hdl; do`",
|
||||
r"`nft delete rule inet f2b-table f2b-chain $hdl; done`",
|
||||
r"`nft delete set inet f2b-table addr-set-j-w-nft-mp`",
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-mp\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`",
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | sed -nE 's/.*@addr6-set-j-w-nft-mp\s+.*\s+\#\s*(handle\s+[0-9]+)$/\1/p'; } | while read -r hdl; do`",
|
||||
r"`nft delete rule inet f2b-table f2b-chain $hdl; done`",
|
||||
r"`nft delete set inet f2b-table addr6-set-j-w-nft-mp`",
|
||||
),
|
||||
|
|
@ -1408,10 +1408,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|||
"`{ nft flush set inet f2b-table addr6-set-j-w-nft-ap 2> /dev/null; } || ",
|
||||
),
|
||||
'stop': (
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`",
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | sed -nE 's/.*@addr-set-j-w-nft-ap\s+.*\s+\#\s*(handle\s+[0-9]+)$/\1/p'; } | while read -r hdl; do`",
|
||||
r"`nft delete rule inet f2b-table f2b-chain $hdl; done`",
|
||||
r"`nft delete set inet f2b-table addr-set-j-w-nft-ap`",
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | grep -oP '@addr6-set-j-w-nft-ap\s+.*\s+\Khandle\s+(\d+)$'; } | while read -r hdl; do`",
|
||||
r"`{ nft -a list chain inet f2b-table f2b-chain | sed -nE 's/.*@addr6-set-j-w-nft-ap\s+.*\s+\#\s*(handle\s+[0-9]+)$/\1/p'; } | while read -r hdl; do`",
|
||||
r"`nft delete rule inet f2b-table f2b-chain $hdl; done`",
|
||||
r"`nft delete set inet f2b-table addr6-set-j-w-nft-ap`",
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue