diff options
Diffstat (limited to 'cron-sh')
-rw-r--r-- | cron-sh/functions.sh | 20 |
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 |