Since y'all did so well at turning my last efforts into a one-liner, I
thought you may enjoy expressing your superior recipe cooking skills
regarding this one. I'm using it as an INCLUDERC in /etc/procmailrc to
scan attachments for virii, and if infected, notify the system
administrator and the sender, and then dump the mail. I would like the
notice to the system administrator to be a bit more verbose than it is now,
like including the sender's information and the intended recipient...
Thanks.
Lee Howard
METAMAIL_TMPDIR="/etc/procmail/avtemp"
# note that the avtemp directory must be writable by all mail
recipients
SYSADMIN=lee(_at_)server(_dot_)deanox(_dot_)com
VIRUSMSG=/etc/procmail/virusmsg
# this is a message that will be sent to the sender
CONAME=Deanox
:0
ic:/tmp/avtemp.lock
| metamail -r -w -x
:0 ic:/tmp/avtemp.lock
|
/usr/bin/antivir $METAMAIL_TMPDIR/* >
$METAMAIL_TMPDIR/antivir.log
VIRUSCHECK=`grep -e "VIRUS"
$METAMAIL_TMPDIR/antivir.log`
:0 ic:/tmp/avtemp.lock
| rm -f
$METAMAIL_TMPDIR/*
:0
* ! $VIRUSCHECK ?? ^^^^
{
:0 ic
| ( formail -r -A
"X-Loop: $SYSADMIN" \
-I "From: $CONAME Mail Anti-Virus Agent <$SYSADMIN>"
\
-I "Subject: WARNING! infected mail went undelivered" ; \
cat $VIRUSMSG
; echo $VIRUSCHECK ) | $SENDMAIL -t
:0 i
| ( formail -r -A "X-Loop:
$SYSADMIN" \
-I "From: $CONAME Mail Anti-Virus Agent <$SYSADMIN>"
\
-I "To: $SYSADMIN" \
-I "Subject: NOTICE! Infected mail
went undelivered" ; \
echo "The system successfully caught and
deleted mail infected with the following virus:" ; \
echo $VIRUSCHECK ) |
$SENDMAIL -t
:0:/tmp/avtemp.lock
/dev/null
}
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail