Hi all, I have added maildrop-toaster-1.8.1-1.2.7.src.rpm and qmailadmin-toaster-1.2.8-1.2.7 to the web site for download.
I have added user selectable message filtering via qmailadmin. By selecting "Spam Detection" on the "Modify User" page, each user may select to filter messages tagged by spamassassin and scores less that 12 to ~/Maildir/.Spam. Those messages scoring 12, or greater, will be sent to sa-learn then dropped. These settings may also be made by the postmaster within qmailadmin. You can change the value in "if ( $MATCH2 >= 12 )" to whatever value you like. If you are not concerned about feeding spam through sa-learn, you can comment 'cc "|sa-learn --spam"' and the messages will just be dropped. This version, or greater, of maildrop-toaster must be installed before qmailadmin-toaster. The current-install-script.sh has been updated. If you are currently running maildrop filters, you may want to look at the /usr/bin/maildrop permissions (chown root:vchkpw chmod 4775). If you have any problems, you can uncomment the logging in the mailfilter file and find the logs in /var/log/maildrop Regards, Nick Here is the mailfilter script (located in /etc/mail/): ~~~~~~ mailfilter ~~~~~~ SHELL="/bin/sh" import EXT import HOST VHOME=`pwd` TIMESTAMP=`date "+%b %d %H:%M:%S"` #-------------------------------------------------------- # mailfilter # # Path to this file should be /etc/mail/mailfilter # chown vpopmail:vchkpw chmod 600 # # # This file was adapted from Matt Simerson's work # http://www.tnpi.biz/internet/mail/toaster/ # # Nick Hemmesch <[EMAIL PROTECTED]> # August 23, 2005 # #-------------------------------------------------------- logfile "/var/log/maildrop/maildrop.log" #log "$TIMESTAMP - BEGIN maildrop processing for [EMAIL PROTECTED] ===" #-------------------------------------------------------- # Include any rules set up for the user - this gives the # administrator a way to override the sitewide mailfilter file #-------------------------------------------------------- `test -r $VHOME/.mailfilter` if( $RETURNCODE == 0 ) { # log " including $VHOME/.mailfilter" exception { include $VHOME/.mailfilter } } #-------------------------------------------------------- # Create the maildirsize file if it doesn't already exist #-------------------------------------------------------- `test -e $VHOME/Maildir/maildirsize` if( $RETURNCODE == 1) { `test -x /home/vpopmail/bin/vuserinfo` if ( $RETURNCODE == 0) { # log " creating $VHOME/Maildir/maildirsize for quotas" `/home/vpopmail/bin/vuserinfo -Q [EMAIL PROTECTED] `test -s "$VHOME/Maildir/maildirsize"` if ( $RETURNCODE == 0 ) { `/bin/chown vpopmail:vchkpw $VHOME/Maildir/maildirsize` `/bin/chmod 640 $VHOME/Maildir/maildirsize` } } else { # log " WARNING: cannot find vuserinfo! Please edit mailfilter" } } #-------------------------------------------------------- # Set MAILDIRQUOTA. If this isn't set, maildrop and deliverquota # will not enforce quotas for message delivery. #-------------------------------------------------------- `test -e $VHOME/Maildir/maildirsize` if( $RETURNCODE == 0) { MAILDIRQUOTA=`/usr/bin/head -n1 $VHOME/Maildir/maildirsize` } #-------------------------------------------------------- # Filter spam - scores >= SPAMLIMIT is not delivered # # If you DO NOT want to send mail that is over the spam limit # to spamassassin autolearn, comment: 'cc "|sa-learn -spam"' #-------------------------------------------------------- if ( /^X-Spam-Status: Yes, score=![0-9]+\.[0-9]+! /:h) { if ( $MATCH2 >= 12 ) { log "$TIMESTAMP - SPAM: [EMAIL PROTECTED] score $MATCH2: Sending message to autolearn" cc "|sa-learn --spam" EXITCODE=0 exit } # if the user doesnt' have a Spam folder, we create it. `test -d $VHOME/Maildir/.Spam` if( $RETURNCODE == 1 ) { log "$TIMESTAMP - Creating $VHOME/Maildir/.Spam " `maildirmake -f Spam $VHOME/Maildir` `/usr/bin/subscribeIMAP.sh Spam $VHOME` } # log " SPAM: score $MATCH2: delivering to $VHOME/Maildir/.Spam" # make sure the deliverquota binary exists and is executable `test -x /usr/bin/deliverquota` if ( $RETURNCODE == 1 ) { # log " WARNING: no deliverquota!" # log "=== END === [EMAIL PROTECTED] success" exception { to "$VHOME/Maildir/.Spam" } } else { exception { xfilter "/usr/bin/deliverquota -w 90 $VHOME/Maildir/.Spam" } if ( $RETURNCODE == 0 ) { # log "=== END === [EMAIL PROTECTED] success (quota)" EXITCODE=0 exit } else { if( $RETURNCODE == 77) { log "$TIMESTAMP - [EMAIL PROTECTED] bounced (quota)" to "|/var/qmail/bin/bouncesaying '[EMAIL PROTECTED] is over quota'" } else { log "$TIMESTAMP - [EMAIL PROTECTED] failure (unknown deliverquota error)" to "$VHOME/Maildir/.Spam" } } } } if ( /^X-Spam-Status: No, score=![\-]*[0-9]+\.[0-9]+! /:h) { # log " message is clean ($MATCH2)" } #-------------------------------------------------------- # Include any user rules #-------------------------------------------------------- `test -r $VHOME/Maildir/.mailfilter` if( $RETURNCODE == 0 ) { # log " including $VHOME/Maildir/.mailfilter" exception { include $VHOME/Maildir/.mailfilter } } #log " delivering to $VHOME/Maildir" `test -x /usr/bin/deliverquota` if ( $RETURNCODE == 1 ) { log "$TIMESTAMP - [EMAIL PROTECTED] WARNING: no deliverquota!" # log "=== END === [EMAIL PROTECTED] success" exception { to "$VHOME/Maildir" } } else { exception { xfilter "/usr/bin/deliverquota -w 90 $VHOME/Maildir" } #-------------------------------------------------------- # check to make sure the message was delivered # returncode 77 means that out maildir was overquota - bounce mail #-------------------------------------------------------- if( $RETURNCODE == 77) { log "$TIMESTAMP - BOUNCED: bouncesaying '[EMAIL PROTECTED] is over quota'" # log "$TIMESTAMP - [EMAIL PROTECTED] bounced" to "|/var/qmail/bin/bouncesaying '[EMAIL PROTECTED] is over quota'" } else { # log "=== END === [EMAIL PROTECTED] success (quota)" EXITCODE=0 exit } } log "$TIMESTAMP - [EMAIL PROTECTED] - WARNING: This message should never be printed!" ~~~~~~ end ~~~~~~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
