PDA

View Full Version : mysql whitelisting for 'Virtual Users And Domains With Postfix, Courier And MySQL'?


hnodine
25th May 2007, 02:17
Hello-
I followed the 'Virtual Users And Domains With Postfix, Courier And MySQL (Fedora Core 5)' howto, and added maildrop mail filtering to move messages marked as spam to each user's Junk folder. Now I would like to whitelist senders that I have placed in a mysql database. There are some guides on the web, but since the howto does not create teh same tables as those in other guides I am unsure how to proceed. Any help would be appreciated.

Thank you in advance for your time.

acoghlan
25th May 2007, 20:12
I followed the 'Virtual Users And Domains With Postfix, Courier And MySQL (Fedora Core 5)' howto, and added maildrop mail filtering to move messages marked as spam to each user's Junk folder.

i have used the same guide on my FC5 box, and have been trying to do get Maildrop filtering out the spam for some time now, but cant seem to get it working (although the mail server itself is working great, and identifying spam quite well).

Could you possibly post the FC5 maildrop instructions in this forum? The other instructions listed on this site are for Debian, and I cant get it all working on FC5.

In exchange - I have nearly got the whitelist working - with all entries stored in MySQL - when I have it sorted, I will post here.

Cheers

Andrew

hnodine
25th May 2007, 20:42
A simple way to filter mail marked as spam to each virtual users mailbox is to edit /etc/postfix/master.cf, where you see the maildrop line, make sure it reads
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${user}@${nexthop} ${extension} ${recipient} ${user} ${nexthop} ${sender}

Save the changes, then exit.
Next, edit /etc/postfix/main.cf and add a line at the bottom of the file that says
maildrop_destination_recipient_limit=1
Save and exit.
Finally, create /home/vmail/.mailfilter . In that file paste
USER="$3"
HOST="$4"
if ( /^X-Spam-Status: Yes/)
{
to "/home/vmail/$HOST/$USER/.Junk"
}
This will place all of the mail with the X-Spam-Status: Yes header (which is inserted by Spammassin) into each user's Inbox.Junk directory. Note that you could make a much more complex set of filters for each user, but this really seems to be the best setup I have found. Let me know if you have problems with this. I thank you in advance for your efforts on my problem.

acoghlan
25th May 2007, 22:57
cool - thanks for that.

I take it that this setup moves junk mail for ALL users? I have 2 questions;
1. where would you put the .mailfilter file to make it user based
2. is there any way the maildrop filter can be stored in MySQL rather than on the file system?