Postfix+VDA+PostgreSQL: need to filter mail into different mail folders

From: Michael A Nachbaur (no email)
Date: Mon Jun 02 2003 - 14:39:04 EDT


Hello everyone,

I have recently built a really sweet mail server infrastructure here at a
Cable ISP, and am very happy with it (multiple identical Postfix servers,
load-balanced with ipvsadm, storing mail in a back-end NFS server). All of
my users are authenticated / configured using a PostgreSQL database server.
My users have their mail stored on an NFS server as such:

    /var/spool/mail/<domain>/<first-letter>/<username>

so, my address would be:

    /var/spool/mail/nachbaur.com/m/mike

All my users are automatically given a UID and GID from the database server
(UID == primary key from the users table + 1000, GID == primary key from the
domain table + 1000). The a-z directories are chgrp'd to the GID of the
domain, and I have an auto-maildircreate script that automagically creates a
user's home directory and Maildir. Finally, I have filesystem quotas enabled
for both users and groups, so I can specify a per-user filesystem quota
and/or a quota for an entire domain of users.

My problem is, now that this is all configured (and working beautifully), I
need to filter my user's incoming mail into separate directories. I'm
implementing a Spam/Virus filtering system on these mail servers, but would
like to automatically dump mail I've determined as being spam into a separate
folder.

I'm using Courier-IMAP with Maildir++ support to check mail, so my mail store
can handle sub-folders; I just need to be able to deliver mail to a different
location.

I discovered (much too late it seems) that you can't use maildrop or
deliverquota when working with VDA. Is there an alternate solution to this
problem? I have thought of several ideas so far:

a) Create a "virtual user" in the database that has the exact same UID/GID as
the regular account, but with the "Maildir" path in the database pointing to
"Maildir/.Spam/" instead of just "Maildir/".

b) Make a patch to the VDA code that allows it to do database lookups based on
email-address extension (e.g. send/rewrite incoming mail to
mike+ to dump mail in the spam folder).

c) Post-process mail after it arrives and forcefully move it to a new
directory. I could write a Perl program connected to the FAM daemon to move
a message once it is written (and if it's header matches my filter rules) but
this seems a bit hack-ish.

Any other ideas? Anyone have this same problem, and what solution (if any)
did you come up with? Any feedback is appreciated.

-- 
Michael A Nachbaur <>







Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD