1 message in net.sourceforge.lists.courier-maildrop[maildropl] maildrop spam script ?
FromSent OnAttachments
Voytek EymontOct 30, 2007 4:36 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[maildropl] maildrop spam script ?Actions...
From:Voytek Eymont (voy@sbt.net.au)
Date:Oct 30, 2007 4:36:54 am
List:net.sourceforge.lists.courier-maildrop

Hi,

I have Centos 4. with Postfix/CourierIMAP/MySQL/amavisd with virtual domains; and, I'd like to deliver user's spam mail to spam IMAP folder

I tried following Gary's howto from

http://www200.pair.com/mecham/spam/virtualp1.html#admin

so, I installed maildrop, and configured postfix and amavis to use it

I think... I have the postfix part somewhat correct, and, also the amavis part somewhat correct, as I still receive emails, and, some get sub-addressed with '+spam'

(log extract at the end)

but, I think my maildrop script needs something...

if someone can point me in the right direction, I'm all ears, thanks

/etc/maildroprc at the end

# ls -al /etc/maildroprc -rw-r--r-- 1 vmail vmail 3387 Oct 28 22:45 /etc/maildroprc

------------- (from maildroprc.log) ... Date: Tue Oct 30 21:46:30 2007 From: MobileSoftware.explorePDA.com <ma@mailtrust.org> Subj: ***SPAM*** Seven Days - 20% Site Wide Discount Offer on all titles File: sbt.net.au/voy@sbt.net.au/ (12601) ...

------------- # grep ***SPAM*** /var/log/maildroprc.log

Subj: ***SPAM*** Seven Days - 20% Site Wide Discount Offer on all titles

-------------- # grep "+spam" /var/log/maillog

Oct 30 20:25:02 bilby postfix/pipe[15376]: 4F959B446E0: to=<voytek+sp@sbt.net.au>, orig_to=<voytek+spam>, relay=maildrop, delay=0.15, delays=0.09/0.02/0/0.04, dsn=2.0.0, status=sent (delivered via maildrop service) Oct 30 21:46:30 bilby amavis[16683]: (16683-03) FWD via SMTP: <voy@sbt.net.au> -> <voytek+sp@sbt.net.au>,BODY=7BIT 250 2.6.0 Ok, id=16683-03, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 393E5B446E0 Oct 30 21:46:30 bilby postfix/pipe[18301]: 393E5B446E0: to=<voytek+sp@sbt.net.au>, relay=maildrop, delay=0.14, delays=0.06/0.04/0/0.04, dsn=2.0.0, status=sent (delivered via maildrop service)

----------------- # Global maildrop filter file (used on Debian) # For use with Postfix/Courier IMAP/Amavisd-new virtual mailbox domains. # # ve 28/10/2007 # edited dir path for vhosts # # http://www200.pair.com/mecham/spam/maildroprc.txt # # This maildroprc automagically creates a Spam folder for the recipient # and places spam there. It also subscibes the recipient to the folder. # # Example maildir: /var/vmail/example.com/user/ # Configure 'plus addressing' in amavisd-new and Postfix in order to deliver # spam to user+sp@example.com. In main.cf: # recipient_delimiter = + # # in amavisd.conf: # $recipient_delimiter = '+'; # @addr_extension_spam_maps = ('spam'); # # Remember that 'plus addressing' occurs at tag2_level, not kill_level. kill_level needs # to be sufficiently high in order to allow some mail at tag2_level or greater to be # delivered to the recipient. Also be aware: if you create virtual aliases designed to # send mail to remote domains, either those remote domains must also support # 'plus addressing' or you will need to create additional aliases to remove +spam: # # user+sp@example.org us@example.org # # This means address rewriting cannot be disabled on the amavisd-new reinjection port. # # Also in main.cf: # virtual_transport = maildrop # maildrop_destination_concurrency_limit = 2 # maildrop_destination_recipient_limit = 1 # # and in master.cf: # # maildrop unix - n n - - pipe # flags=DRhu user=vmail:daemon argv=/usr/bin/maildrop -w 90 -d ${user}@${nexthop} # ${extension} ${recipient} ${user} ${nexthop} # # /var/log/maildroprc.log needs to exist and owned by vmail:vmail and # a logrotate script needs to be created. #

HOME_DIR="/var/mail/vhosts" logfile "/var/log/maildroprc.log" EXTENSION="$1" RECIPIENT=tolower("$2") USER="$3" HOST="$4" SENDER="$5"

if ( $EXTENSION eq "spam" ) { # Change 'spam' to 'Spam' since folder names are typically capitalized EXTENSION = "Spam"

# Autocreate extension maildir # # See if the user exists `test -e $HOME_DIR/$HOST/$USER` #log "Testing for $HOME_DIR/$HOST/$USER subdirectory: result=$RETURNCODE"

# Only continue if user is valid if ( $RETURNCODE == 0 ) { # See if the spam directory already exists `test -e $HOME_DIR/$HOST/$USER/.$EXTENSION` #log "Testing for $EXTENSION subdirectory: result=$RETURNCODE"

if ( $RETURNCODE != 0 ) # spam directory does not exist - so we create it {

# Create the subdirectory `maildirmake -f $EXTENSION $HOME_DIR/$HOST/$USER` log "Ran \"maildirmake -f $EXTENSION $HOME_DIR/$HOST/$USER\""

# Auto-subscribe the subdirectory `if ! grep -q INBOX.$EXTENSION $HOME_DIR/$HOST/$USER/courierimapsubscribed; then echo INBOX.$EXTENSION >> $HOME_DIR/$HOST/$USER/courierimapsubscribed; fi`

# Set permissions on the mailbox `chmod -R 0700 $HOME_DIR/$HOST/$USER` log " Ran \"chmod -R 0700 $HOME_DIR/$HOST/$USER\"" }

# Deliver the message to the mailbox exception { # for those who unsubscribed themselves - subscribe them `if ! grep -q INBOX.$EXTENSION $HOME_DIR/$HOST/$USER/courierimapsubscribed; then echo INBOX.$EXTENSION >> $HOME_DIR/$HOST/$USER/courierimapsubscribed; fi` to "$HOME_DIR/$HOST/$USER/.$EXTENSION" } } }