Can somebody clarify how setting up a secondary mail server should work with virtualmin. I’ve set my backup vm box as a secondary mx in the virtual server module, but all this seems to do is add an extra mx record when creating the domain, is this correct?
Ideally what i would like to acheive is to have my backup vm box as the secondary mx, if the first is unavailable the email should be stored on the secondary and then forwarded to the primary when it comes back online, is this possible?
Yep, I don’t think Virtualmin currently handles the actual configuration of the secondary server, though it can setup the MX. But it’s pretty easy to configure postfix to relay for some or all domains. I believe all you need to do is tell Postfix that it’s a relay for the domain:
In the Postfix module, click on SMTP Server Options.
Find the field labeled "Restrict mail relaying" and fill in a list of the domains for which this server will be a backup.
Save it and apply the changes.
I’m pretty sure that’s all it takes…And I think we’ll have this capability in Virtualmin pretty darned soon (obviously, it’s not all that complicated, even if maybe I’m missing a step). Holler if this does the trick, and I’ll see about getting it into the next release of the virtual-server module.
This works perfectly. Stopped postfix on primary and email went to secondary and sat in the queue with a "connection refused" status. Restarted and flushed the queue and they got delivered. How long will email sit on the secondary mx, ideally i want it to sit there until the primary is online, and never bounce the mail. where do i check this ?
I’ve just noticed that when i create a new domain now, it does get automagically added to the Restrict mail relaying list on the secondary server.
What would be nice is if there were an option to enable it for existing domains, so as people add mx servers they are configured on the fly.
If you’ve any pointers on a shell script that would help me add the second mx record to all my existing domains, then i think i’m sorted.