Hello,
I am trying to put some functionality in a script I use to clean my email. Now My weakness is programming, so my scripting and reg ex is not the strongest.
here's the help I need from all of you who breathe this stuff:
Cox is marking email from my domain as spam. the most I can get out of them is "forward your email to
thisisnotspam@cox.net and they will remove it." Well they haven't, so I want to send a copy of all outgoing email to an @cox.net address to their address. this should dump quite a few emails to their address and hopefully get their attention. I told their tier 2 guy I was going to do this, and he was ok with it (ignorance?).
Anyway, I'm providing the whole script for your perusal. while I originally got this from advosys.com, it has changed so much and I've stared at it so long i'm stuck.
While investigating this, i noticed that my clamav statement will not stop the sending of an email if a virii is found and the email deleted, so clients are getting blank emails. better than a virus, but I'd rather just drop it. an if-then-else should fit this fine, as clamav returns 0 for no virus and 1 if a virus is detected.
I then realized that boththese changes need to occur in the same area of the script, and my brain freezes right there.
I've noted the lines in question (doubt) with ?->
Thank you,
anthony
#!/bin/sh
#
# filter-sideline.sh
#
# Simple filter to plug Anomy Sanitizer and SpamAssassin into
# the Postfix MTA, plus take action on very high scoring mail.
# "Action" includes sending to a holding directory for later inspection
# ("sideline" it), diverting to another e-mail address, or deleting it.
#
# Note: SpamAssassin "scores" are not foolproof, but generally
# messages with score 15 and over are rarely legitimate mail.
#
# From http://advosys.ca/papers/postfix-filtering.html
# Advosys Consulting Inc., Ottawa
#additional functionality courtesy of Anthony Milbauer
#
# For use with:
# Postfix 20010228 or later
# Anomy Sanitizer revision 1.49 or later
# SpamAssassin 2.42 or later
#
# Note: Modify the file locations to match your particular
# server and installation of SpamAssassin.
# File locations:
# (CHANGE AS REQUIRED TO MATCH YOUR SERVER)
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail.postfix -i"
ANOMY=/usr/local/anomy
ANOMY_CONF=/usr/local/anomy/anomy.conf
SPAMASSASSIN="nice -n 15 /usr/bin/spamassassin"
SPAMC="/usr/bin/spamc"
EGREP=/bin/egrep
CLAMSCAN=/usr/local/bin/clamscan
# Directory to put high score spam into:
# (NOTE: Create this directory and give it same permissions as $INSPECT_DIR)
SIDELINE_DIR=/var/spool/spam
# Number of *'s in X-Spam-level header needed to sideline message:
# (Eg. Score of 5.5 = "*****" )
SPAMLIMIT=5
export ANOMY SPAMLIMIT
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
# Clean up when done or when aborting.
trap "rm -f out.$$" 0 1 2 3 15
# Pipe message through SA to a temp file:
cat | $SPAMC -f -d localhost -p 783 -u filter > out.$$
# Are there more than $SPAMLIMIT stars in X-Spam-Level header? :
if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}" < out.$$
then
# Option 1: Move high scoring messages to sideline dir so a human can look at them later:
# mv out.$$ $SIDELINE_DIR
# Option 2: Divert to an alternate e-mail address:
# (Comment out the above, then uncomment next line to use this option)
$SENDMAIL spamwatcher@domain.com < out.$$
# Option 3: Delete the message
# rm -f out.$$
else
#run through clamav
?-> $CLAMSCAN -v --mbox --unzip=/usr/bin/unzip --move=/tmp/quarentine -l /var/log/avmail < out.$$
?-> #then
?-> #exit 0
#else
?-> #if $EGREP -q "^To: .*@cox.net" < out.$$
?-> #then $SENDMAIL thisisnotspam@cox.net <out.$$
?-> #else
#Scan with anomy and return to email system
$ANOMY/bin/sanitizer.pl $ANOMY_CONF < out.$$ 2>>/tmp/anomy.log | $SENDMAIL "$@"
#fi
#fi
fi
exit 0
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss