Dec 13 2004
Setting up Postfix with Courier-IMAPD, vmail, mysql and Mailman
Tip: When attempting to set up a http://www.postfix.org/ system with http://www.inter7.com/courierimap/INSTALL.html, mysql backend, http://www.probsd.net/vmail/ admin and http://www.gnu.org/software/mailman/, do not do something stupid like, say, adding your REAL hostname to the list of VIRTUAL domains in vmail. Bad things happen.
It took me a long time to figure out why my otherwise perfectly functioning postfix system would not deliver mail to my otherwise perfectly functioning Mailman system when I sent mail to the test mailing list I created. “test@redlance.pure-chaos.com” would bounce. The log indicated it was trying to deliver to “test@redlance.homeunix.org”, which of course didn’t exist. (The whole purpose of this exercise is to have a system where two or more virtual domains can have mailing lists with the same local address, something you can’t do with Sendmail).
Here’s how it breaks down:
Per http://mail.python.org/pipermail/mailman-users/2002-September/022370.html (and many other fine sites) you have to add the following to Mailman’s mm_cfg.py:
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
Replacing “dom2.ain” and “dom3.ain” with whatever virtual domains you’re hosting that you want to allow to have mailing lists.
The part they DON’T mention is that you ALSO have to have
add_virtualhost('www.dom2.ain', 'mailserver.dom2.ain')
add_virtualhost('www.dom3.ain', 'mailserver.dom3.ain')
To map the web host of your virtual domain to it’s corresponding mail server. This is obvious if you read through the Mailman docs on the subject, but both the docs and every web site I’ve found on the subject of Mailman and Postfix imply that POSTFIX_STYLE_VIRTUAL_DOMAINS takes care of that for you. Not true. You need BOTH steps.
Finally, once you’ve got that done, and you’ve made the correct changes in postfix’s main.cf to work with mysql, vmail and mailman, do not, repeat DO NOT add your “real” host name in the vmail admin interface. This adds your “real” host to virtual hosts. Thus when mail for a mailing list on your virtual host arrives, Postfix will process the mail through virtual_maps, find the correct local address, tack on the “real” host name, then attempt to process THAT address through virtual_maps again, where it will fail, instead of processing through alias_maps to get to Mailman.
eg: My real hostname is “redlance.homeunix.org”. I created a test list on my virtual host, redlance.pure-chaos.com. “test@redlance.pure-chaos.com” is a mailman list.
Mail from andrew@pure-chaos.com to test@redlance.pure-chaos.com arrived at redlance.homeunix.org, postfix processed it, found “test@redlance.pure-chaos.com” in virtual_maps, which mapped it to “test”. Since there was no FQDN part, it added the “real” hostname, so it became “test@redlance.homeunix.org”. Since I’d added redlance.homeunix.org to vmail, it then proceeded to look for “test@redlance.homeunix.org” in virtual_maps and failed, bouncing the message, rather than looking for “test” in alias_maps, where it would have piped it through Mailman.
Lesson learned. Hopefully someone else who is beating their head into a brick wall will find this post and gain clue quicker than I did.
Tues: finish this project by making sure Procmail delivery and Spamassassin work correctly. If all goes well, Wed night I will roll this out on the live server.