aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-09-09 00:04:04 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-09-09 00:04:04 +0000
commite016f205c03f71445c28899257cf20beaefd454f (patch)
treebe2209e813e32558c9af30ffc7c90aadb8fb90b7 /cron-sh
parent8dcb259983ed00e53bd245776dc636e1724cf5ca (diff)
downloadmsec-e016f205c03f71445c28899257cf20beaefd454f.tar
msec-e016f205c03f71445c28899257cf20beaefd454f.tar.gz
msec-e016f205c03f71445c28899257cf20beaefd454f.tar.bz2
msec-e016f205c03f71445c28899257cf20beaefd454f.tar.xz
msec-e016f205c03f71445c28899257cf20beaefd454f.zip
added filtering function
Diffstat (limited to 'cron-sh')
-rw-r--r--cron-sh/functions.sh20
1 files changed, 20 insertions, 0 deletions
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