Archive for the 'Mailserver' Category

PGP encrypted mailinglist

Saturday, March 15th, 2008

Found a perlscript to manage pgp-encryption for mailinglists but had to tweek it some for my purpose. Original is found here:
http://www.rediris.es/pgp/app/pgplist

Added support for Reply-To: My Patch

Postgrey bypass

Sunday, February 10th, 2008

So it seems that postgrey is an marvelous system to stop spammer, but howto when you need that password sent for you asap and do not want to wait the 5 minutes timeout + time for the mailing server to resend your mail?

Well, I come up with an solution using bash script and procmail.

Yes, I should say that my MX running postgrey and procmail on debian etch stable versions and all other likely email software

First I alter /etc/passwd “home” folder for already installed postgrey “user”

/var/lib/postgrey

in that folder I put an .procmailrc file:

—————————————-

PATH=/usr/bin:/usr/local/bin
LOGFILE=/var/log/procmail.log
SHELL=/bin/bash
DROPPRIVS=yes

#start postgrey bypasscript
:0
* ^Subject:.*\secretword:\/[^ ]+
| /var/lib/postgrey/prio.sh “$MATCH”
#dump all mail to /dev/null
:0
/dev/null
——————————————-

So now will all mail to postgrey@myserver be forward to trashcan (/dev/null)

but all that have secretword:myemail@myserver in subject

will acivate prio.sh script.

So what then.

prio.sh:

———————————-

#!/bin/bash
for i
do
echo “$1” >> /etc/postgrey/whitelist_recipients
/etc/init.d/postgrey reload
/bin/sleep 300
/bin/cat /etc/postgrey/whitelist_recipients | eval “/bin/sed -e \ ‘/^”$1″$/d’ > /etc/postgrey/whitelist_recipients”
/etc/init.d/postgrey reload

done
——————————————–

notice that line 7 and 8 can all be on same line (7) remove last \ is so,

What is script doing:
first add the myemail@myserver to postgrey default whitelist for recipient
then reload postgrey so it will be affected.
sleep in 5 minutes

remove myemail@myserver from whitelist and reload postgrey

so you can enjoy postgrey stopping spam.

Hope you find my soultion usefull

/Markus


Creeper