Ben Kennedy writes:
Hey folks,Some of you may recall this discussion from last fall. I've got a problem, one that I guess my servers have exhibited for years, and I want to fix it. I have two machines, which I'll call "primary" and "secondary". They are both MX for a number of domains; primary has a lower priority number (i.e. is a first choice for delivery), and holds the canonical backing store (maildirs, POP3/IMAP service, etc). Secondary is designed to also accept mail for these domains, and shunt any it happens to receive (by virtue of esmtproutes) to primary. Both have mailbox configuration provided by authmysql from a local replicated MySQL database. In case primary goes down, secondary will continue to queue mail and, at my option, may be quickly switched into "primary behvaiour" (to deliver locally and provide POP3/IMAP service) in the event that the original primary cannot be brought online in a timely fashion. I have used this pattern for several years now, with general success. The gaping hole, of course, is that the secondary will accept any mail for any mailbox on any of the domains. For domains with "alias@..." style catch-alls, this is fine. For the rest, it induces the primary into spewing out backscatter for any undliverable addresses. As I said, both machines share the mailbox config, and therefore have the capability of knowing what is a legitimate address and what isn't. But on the secondary, which has empty hosteddomains and esmtproutes pointing to the primary, it never bothers to do an account lookup (it only looks at the domain). How do I fix this?
Only a machine which has a domain configured as a local/hosted domain can know which address in the domain exists, or not.
One thing you can do is redefine a local domain. If you are example.com, rather than defining example.com as a local domain, define instead mailhost.example.com as a hosted domain, and install an alias
[email protected]: [email protected]Mail addressed to [email protected] gets rewritten to be addressed to [email protected], which would be a valid local mailbox. Nonexistent [email protected] get rejected because example.com is not a local domain. Adresses that exist get rewritten and delivered.
It should be a simple matter to write a script to dump your list of mailboxes, generate an alias entry for each valid mailbox, then run makealiases.
I believe that if you do that, you can install the same alias table on your secondary, and on the secondary put mailhost.example.com into esmtpacceptmailfor, so that mail for that domain gets accepted and queued.
If you've got mail queued up on the secondary, and want to make it a primary, you will need to stop courier, remove mailhost.example.com from esmtpacceptmailfor, and put it into hosteddomain, and start courier, and it should then deliver the queued up mail into local mailboxes.
You'll need to do some experimenting to verify this, but I'm fairly certain that it'll work.
pgpdoOa65UWPs.pgp
Description: PGP signature
------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
