Hey all!
Ok..here's what I got for my sidelinespamd.sh. First,
pipes through spam assassin. This logs to syslog
everytime an email is tagged as spam (delivered or
not). Then it checks if the email gets tagged and
delivered or nuked. After that it greps the email and
sees who it is going to. If it matches ANY of
"different|email|addresses|here" it uses a different
sanitizer.cfg file. If it doesn't match it just sends
using the default sanitizer.cfg. Can anyone see a
better/different way to get this done? Thank!
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/lib/sendmail -i"
ANOMY=/usr/local/anomy
ANOMY_CONF=/etc/sanitizer.cfg
ANOMY_CONF_USER=/etc/sanitizer_user.cfg
ANOMY_LOG=/dev/null
SPAMASSASSIN=/usr/bin/spamc
EGREP=/bin/egrep
SIDELINE_DIR=/var/spool/spam
SPAMLIMIT=7
SPAM=4
export ANOMY SPAMLIMIT
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist;
exit $EX_TEMPFAIL; }
trap "rm -f out.$$" 0 1 2 3 15
cat | $SPAMASSASSIN -x > out.$$
# Is this spam? If so log it to syslog:
if $EGREP -q -m 1 "^X-Spam-Level: \*{$SPAM,}" < out.$$
then
logger /var/log/messages Spam Email Recieved
fi
# Are there more than $SPAMLIMIT stars in X-Spam-Level
header? If so move to /var/spam:
if $EGREP -q -m 1 "^X-Spam-Level: \*{$SPAMLIMIT,}" <
out.$$
then
mv out.$$ $SIDELINE_DIR
fi
# See who this is
if $EGREP -q -m 1 "different|email|addresses|here" <
out.$$
then
$ANOMY/bin/sanitizer.pl $ANOMY_CONF_USER < out.$$
2>>$ANOMY_LOG | $SENDMAIL "$@"
else
$ANOMY/bin/sanitizer.pl $ANOMY_CONF < out.$$
2>>$ANOMY_LOG | $SENDMAIL "$@"
fi
exit 0
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/