Okay, I found a few things that you need to do to get this working.
I have attached a unified diff of my current scanmails script -- your
mileage may vary.
Here's what you would do to reproduce what I have, from beginning to end.
install 4.04 of mcafee virusscan for linux
./configure --enable-qmail --enable-x-headers=no
Once that's done, BEFORE running make, apply the attached patch to
src/scanmails/scanmails
Good, now make. :)
make a directory called "/tmp/virusmails"
make a directory called "/var/log/scanmails"
touch "/var/log/scanmails/logfile"
mv /var/qmail/bin/qmail-local /var/qmail/bin/qmail-local-real
mv /var/qmail/bin/qmail-remote /var/qmail/bin/qmail-remote-real
ln /var/qmail/bin/qmail-local /usr/sbin/scanmails
ln /var/qmail/bin/qmail-remote /usr/sbin/scanmails
That did it for me.
--- scanmails Thu Dec 9 20:47:40 1999
+++ /usr/src/amavis-0.2.0-pre6/src/scanmails/scanmails Thu Dec 9 20:49:46 1999
@@ -2,6 +2,9 @@
#
# File: /usr/sbin/scanmails
#
+# Patched 12/9/1999 by Dustin Miller ([EMAIL PROTECTED])
+# Use at your own risk -- this works on mine, might not on yours.
+#
# This file is part of AMaViS - A Mail Virus Scanner
# Version : 0.2.0-pre6
# available at:
@@ -52,7 +55,7 @@
# Path to NAI AntiVirus (uvscan) #
# (if installed) #
################################################
-uvscan=/usr/sbin/uvscan
+uvscan=/usr/local/bin/uvscan
uvscan_version=4
################################################
@@ -83,7 +86,7 @@
# "virusmailsdir" indicates the path where #
# infected files are saved in #
################################################
-virusmailsdir=/root/virusmails
+virusmailsdir=/tmp/virusmails
################################################
# "tmpdir" indicates where the script operates #
@@ -103,7 +106,8 @@
# - if "do_log" is set to "yes" #
################################################
var_log=/var/log
-do_log=no
+systemlogdir=${var_log}/scanmails/
+do_log=yes
do_syslog=yes
syslog_level=mail.info
@@ -242,11 +246,11 @@
receiver=`echo ${RECEIPIENT} | ${sed} -e "s/[\\\`\\\\\$\(\)]//g"`
sender=`echo ${SENDER} | ${sed} -e "s/[\\\`\\\\\$\(\)]//g"`
-if [ "$sender" != "$2" -o "$receiver" != "$7" ] ; then
+if [ "$sender" != "${SENDER}" -o "$receiver" != "${RECEIPIENT}" ] ; then
cat <<EOF | ${mail} -s "AMaViS Intrusion???" ${mailto}
############################################################
- $7 or $2 is not a valid Email address
+ ${RECEIPIENT} or ${SENDER} is not a valid Email address
(changed to $receiver and $sender)!
############################################################
@@ -644,7 +648,7 @@
fi
scanstatus5=0
else ## Version 4.x
- ${uvscan} --secure -rv --summary ${tmpdir}/unpacked/ >> ${tmpdir}/logfile 2>&1
+ ${uvscan} -rv --summary ${tmpdir}/unpacked/ >> ${tmpdir}/logfile 2>&1
scanstatus5=$?
scanstatus1=0
fi
@@ -840,9 +844,12 @@
echo The attached mail has been found to contain a virus >${tmpdir}/virusmail
echo Originally $0 "$@" >>${tmpdir}/virusmail
echo The mail has been stored as ${virusmailsdir}/virus$$ >> ${tmpdir}/virusmail
- mkdir -p ${var_log}/${scanscriptname}
- cat ${tmpdir}/logfile >>${var_log}/${scanscriptname}/logfile
- cat ${tmpdir}/virusmail ${tmpdir}/logfile | ${mail} -s "FOUND VIRUS IN MAIL $*"
${mailto}
+ if [ "x${do_log}" = "xyes" ]; then
+ mkdir -p ${systemlogdir}
+ cat ${tmpdir}/logfile >>${systemlogdir}/logfile
+ fi
+ echo ------attached message below------ >${tmpdir}/virusmail
+ cat ${tmpdir}/virusmail ${virusmailsdir}/virus$$ | ${mail} -s "FOUND VIRUS IN MAIL
+$*" ${mailto}
################### send a mail back to sender ######################
@@ -897,33 +904,27 @@
else
echo No virus found - good >> ${tmpdir}/logfile
- if [ "x${deliver}" != "x" ] && [ -x ${deliver} ] ; then
+ if [ "x${usingqmail}" != "x" ]; then
if [ "x$x_header" = "xyes" ] && [ "x${formail}" != "x" ] && [ -x ${formail} ] ;
then
- if [ "x${usingqmail}" != "x" ]; then
- # If invoked as anything other than "scanmails", invoke the real
- # program else fall thru to exit
- if [ "${scanscriptname}" != "scanmails" ] ; then
- cat ${tmpdir}/receivedmail |\
- ${formail} -f \
- -A "${X_Header_String}" \
- | ${scanscriptname}-real "$@"
- fi
- else
- cat ${tmpdir}/receivedmail |\
- ${formail} -f \
- -A "${X_Header_String}" \
- | ${deliver} "$@"
+ if [ "${scanscriptname}" != "scanmails" ] ; then
+ cat ${tmpdir}/receivedmail |\
+ ${formail} -f \
+ -A "${X_Header_String}" \
+ | ${scanscriptname}-real "$@"
+ fi
+ else
+ if [ "${scanscriptname}" != "scanmails" ] ; then
+ ${scanscriptname}-real "$@" < ${tmpdir}/receivedmail
fi
+ fi
+ elif [ "x${deliver}" != "x" ] && [ -x ${deliver} ] ; then
+ if [ "x$x_header" = "xyes" ] && [ "x${formail}" != "x" ] && [ -x ${formail} ] ;
+then
+ cat ${tmpdir}/receivedmail |\
+ ${formail} -f \
+ -A "${X_Header_String}" \
+ | ${deliver} "$@"
else
- if [ "x${usingqmail}" != "x" ]; then
- # If invoked as anything other than "scanmails", invoke the real
- # program else fall thru to exit
- if [ "${scanscriptname}" != "scanmails" ] ; then
- ${scanscriptname}-real "$@" < ${tmpdir}/receivedmail
- fi
- else
- ${deliver} "$@" <${tmpdir}/receivedmail
- fi
+ ${deliver} "$@" <${tmpdir}/receivedmail
fi
else
pid=$$
@@ -937,8 +938,8 @@
if [ "x${do_log}" = "xyes" ]
then
- mkdir -p ${var_log}/${scanscriptname}
- cat ${tmpdir}/logfile >> ${var_log}/${scanscriptname}/logfile
+ mkdir -p ${systemlogdir}
+ cat ${tmpdir}/logfile >> ${systemlogdir}/logfile
fi
fi