Yuval Lieberman wrote:
> to activate anti-virus and anti-spam scanners, you should use the
> QMAILAUEUE
> patch,
> (its included in qmail-ldap, you just need to enable it).
> the scanner will be called by qmail-smtpd, and will call qmail-queue after
> its done.
> avalable scanners are:
> http://qmail-scanner.sourceforge.net/
> http://toribio.apollinare.org/qmail-scanner/ (a patch for the first)
> http://www.qscanq.org/
> (can anybody recommend one, or compare?)
> an alternate method will be to scan the mail in the delivery using
> maildrop,
> this have to be configured in each mailbox,
> but I'm not sure how exactly to implement this in qmail-ldap.

There's still another possibility:
1) Change your qmail-send run file to deliver to a script:

exec env - PATH="/var/qmail/bin:$PATH" /var/qmail/bin/qmail-start \
                           "| /usr/local/bin/virus_scanner"
2) Create a /usr/local/bin/virus_scanner, it should read the mail
from stdin and deliver (or refuse) the mail depending on scan results.
I use this scheme for tagging spam with SpamAssassin, modify to your needs:

==============8<========================================================
#!/bin/sh
SPAMC="/usr/bin/spamc"
DISABLED_FILE="/var/qmail/control/DISABLE_SPAMC"
LOGGER="/usr/bin/logger"
SPAMD_HOST="127.0.0.1"
CONFFILE="/var/qmail/control/spamc_conf"
# deliverquota from courier package
DELIVER_PROGRAM="/usr/bin/deliverquota -c"

do_log() {
    $LOGGER -i -p mail.info -t SPAMC_WRAPPER $1
}

[ -f $CONFFILE ] && . $CONFFILE

if [ -f $DISABLED_FILE ]; then
    do_log "spam tagging disabled (found $DISABLED_FILE), \
            running $DELIVER_PROGRAM"
    $DELIVER_PROGRAM "$HOME/Maildir" "$MAILDIRQUOTA"
else
    do_log "spam tagging enabled, running $SPAMC and $DELIVER_PROGRAM"
    TMPFILE=`tempfile -p SPAMC`
    # I use create&unlink here, so the stdin for DELIVER_PROGRAM is
    # seek()'able
    $SPAMC -u $USER -d $SPAMD_HOST > "$TMPFILE"
    exec 4< "$TMPFILE"
    rm "$TMPFILE"
    exec $DELIVER_PROGRAM "$HOME/Maildir" "$MAILDIRQUOTA" <&4
fi
==============>8========================================================

HTH,
Igor

Reply via email to