MFC 1.8, 1.9:
- Correctly parse output, when logging amount is limited in the rule itself, not in verbose_limit sysctl. [1] - Do check rules, even if verbose_limit is set 0. Rules may have their own log limits. PR: conf/77929 Submitted by: Andriy Gapon [1] Reviewed by: matteo Approved by: re (scottl)
This commit is contained in:
parent
2a6cb14761
commit
dce99e7faa
@ -44,17 +44,25 @@ case "$daily_status_security_ipfwlimit_enable" in
|
||||
[Yy][Ee][Ss])
|
||||
TMP=`mktemp -t security`
|
||||
IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null`
|
||||
if [ $? -eq 0 ] && [ "${IPFW_LOG_LIMIT}" -ne 0 ]; then
|
||||
ipfw -a list | grep " log " | \
|
||||
grep '^[[:digit:]]\+[[:space:]]\+[[:digit:]]\+' | \
|
||||
awk -v limit="$IPFW_LOG_LIMIT" \
|
||||
'{if ($2 > limit) {print $0}}' > ${TMP}
|
||||
if [ -s "${TMP}" ]; then
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
ipfw -a list | grep " log " | \
|
||||
grep '^[[:digit:]]\+[[:space:]]\+[[:digit:]]\+' | \
|
||||
awk -v limit="$IPFW_LOG_LIMIT" \
|
||||
'{if ($6 == "logamount") {
|
||||
if ($2 > $7)
|
||||
{print $0}
|
||||
} else {
|
||||
if ($2 > limit)
|
||||
{print $0}}
|
||||
}' > ${TMP}
|
||||
|
||||
if [ -s "${TMP}" ]; then
|
||||
rc=1
|
||||
echo ""
|
||||
echo 'ipfw log limit reached:'
|
||||
cat ${TMP}
|
||||
fi
|
||||
fi
|
||||
rm -f ${TMP};;
|
||||
*) rc=0;;
|
||||
|
Loading…
Reference in New Issue
Block a user