From e016f205c03f71445c28899257cf20beaefd454f Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Wed, 9 Sep 2009 00:04:04 +0000 Subject: added filtering function --- cron-sh/functions.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cron-sh/functions.sh') diff --git a/cron-sh/functions.sh b/cron-sh/functions.sh index 9200838..cedd4c1 100644 --- a/cron-sh/functions.sh +++ b/cron-sh/functions.sh @@ -67,6 +67,26 @@ Count() { echo "$MESSAGE: $NUM_ENTRIES" >> $LOG } +Filter() { + # filters output according to defined rules + RULE="$1" + exceptions=/etc/security/msec/exceptions + + if [ ! -s "$exceptions" -o "a$RULE" = "a" ]; then + FILTER="cat" + else + # get the rules + EXCEPTIONS="" + for except in $(cat $exceptions | sed -e "/^$RULE /!d; s/^$RULE \(.*\)/\1/g"); do + exc=${except//\//\\\/} + EXCEPTIONS="$EXCEPTIONS -e /${exc}/d" + done + FILTER="sed $EXCEPTIONS" + fi + $FILTER + +} + Syslog() { if [[ ${SYSLOG_WARN} == yes ]]; then cat ${1} | while read line; do -- cgit v1.2.1