On Thu, 13 Dec 2001, Dc Ad wrote:
I am using procmail with sendmail. i am new to both.
is it possible to use procmail and only procmail to
send all the mails in the queue to an external anti
virus in this case Mcafee's uvscan? how can that be
done.
Thanks and waiting for the reply.
-Shantanu
...
My unvirus is F-proc, the recipe is:
_________________________ cat /etc/procmail _______________________
:0
{
# The filter is a script which returns FALSE if the message is clean!
:0 fw
| /etc/local/bin/isvirus
# If the header is just metamail(1) message - a viruse was found.
:0 H
* ^This message
/dev/null
}
_________________________ /etc/procmail _______________________
Now, to the script:
___________________ cat /etc/local/bin/isvirus ________________
#!/bin/sh
#---------------------------------------------------------------------------
# isvirus called from /etc/procmail to run unvirus and save the headr if
# needed in /var/spool/infeted to note the user about.
# (see virus-notifcation)
#
#uuddii(_at_)eng(_dot_)tau(_dot_)ac(_dot_)il Udi Sun Nov
25 14:53:12 IST 2001
#---------------------------------------------------------------------------
# Yes, stupid random name + PID
N=`awk 'BEGIN{srand();x=int(rand()*99999999%9999999);print x;exit}'`.$$
METAMAIL_TMPDIR=$dir; export METAMAIL_TMPDIR
dir=/var/tmp/$N
head=/var/spool/infeted/$N.$LOGNAME
mkdir $dir && cd $dir
# sed(1) will save the header. metamail(1) exctract (decode?) the message.
/bin/sed "/^From /,/^$/w $head" | /usr/bin/metamail -r -y -w -q -x 2>/dev/null
/usr/local/f-prot/f-prot -archive -silent $dir
infect=$?
cd $dir/.. # But.. but, I don't need this line..
/bin/rm -rf $dir
# Here comes the trick, F-prot says (return) Okay if the dir is clean, but,
# procmail will drop the message if evry thing in filter is Okay, isn't?
case "$infect" in
0|8) /bin/rm -f $head; /bin/false ;;
*) /bin/true ;;
esac
____________________ /etc/local/bin/isvirus ____________________
If Mcafee know to work directly with Email messages and mime
i.e. you do not need the metamail(1) it would be more simplicity.
However, attention the return code.
Enjoy,
Udi
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail