diff --git a/ChangeLog b/ChangeLog index 5aa24b51..c6f8d8e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ releases. * action.d/bsd-ipfw.conf - Make the rule number, the action starts looking for a free slot to insert the new rule, configurable (gh-1689) + - Replace not posix-compliant grep option: fgrep with `-q` option can cause + 141 exit code in some cases (gh-1389) * filter.d/apache-overflows.conf: - Fixes resources greedy expression (see gh-1790); - Rewritten without end-anchor ($), because of potential vulnerability on very long URLs. diff --git a/config/action.d/bsd-ipfw.conf b/config/action.d/bsd-ipfw.conf index 65a5e39b..f08905b8 100644 --- a/config/action.d/bsd-ipfw.conf +++ b/config/action.d/bsd-ipfw.conf @@ -14,7 +14,7 @@ # Notes.: command executed once at the start of Fail2Ban. # Values: CMD # -actionstart = ipfw show | fgrep -q 'table()' || ( ipfw show | awk 'BEGIN { b = } { if ($1 < b) {} else if ($1 == b) { b = $1 + 1 } else { e = b } } END { if (e) exit e
else exit b }'; num=$?; ipfw -q add $num from table\(
\) to me ; echo $num > "" ) +actionstart = ipfw show | fgrep -c -m 1 -s 'table(
)' &> /dev/null || ( ipfw show | awk 'BEGIN { b = } { if ($1 < b) {} else if ($1 == b) { b = $1 + 1 } else { e = b } } END { if (e) exit e
else exit b }'; num=$?; ipfw -q add $num from table\(
\) to me ; echo $num > "" ) # Option: actionstop