I am not a linux sysadmin: how to make a mail setup redundant

Started by wintermute000, September 01, 2016, 07:28:53 AM

Previous topic - Next topic

wintermute000

I run a hobby VPS which runs my domain + mail with a good old fashioned postfix+dovecot+spamassassin+fail2ban stack. My postfix domains/users/aliases are stored in mySQL.


I've put it together over a length of time (e.g. moved to mysql afterwards, bolted on spamassassin afterwards etc.) following guides which I'll freely admit I don't fully understand sometimes.


Now everything runs fine right now but I would like to setup some kind of backup on a different VPS provider. Domain hosting backup is trivial, even I know how to do that - run a different BIND server and get my registrar to point ns2.domain at it. But how the heck does SMTP/IMAP backup work? Esp if you started out with collapsing everything onto one linux server like a good ol' Microsoft SBS disaster zone (LOL)?

I don't really want any clustering solutions or the like, ideally a completely independent VPS on a different provider, like a true backup service.
As far as I can tell, I can configure a backup MX record to an independent SMTP server, but how would I integrate IMAP/mail storage? (even then its better than nothing I suppose, but then I'd have to surely replicate settings/users etc. by hand and it would be a crap solution)?



deanwebb

Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.


deanwebb

If you have a small number of mailboxes, exporting each mailbox may be the way to go. Export/import is what I did when I moved this board to the new provider.
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

Dieselboy

What's the reason for doing it all yourself that way? Have you thought about using something like Google apps and pointing your MX records there?

If you point one MX record to a backup SMTP server then some but not all mail will go there. The mail that does go there, wont be seen in your inbox.

If you just want a dirty backup, can you take a copy of the virtual server or even just the mail database? Do that regularly and in the event of an issue do a restore? Can even test this by taking a backup and setting up a similar system on a local computer and do a restore there as a test.

We use Google Apps because we have a free account. I do need to set up a mail server at some point as we wont be buying more Google Apps licenses. I've thought about some of the obvious challenges in setting this up already, and I'm not keen on it at all.

wintermute000

#5
I have a snapshot in digitalocean but there is no way to backup the actual VPS itself (obtain VMDK files or the like) other than dirty tricks involving dd through a tunnel interface or the like.

The snapshot works 100% but its no good if digitalocean go away or if I want to move the setup to somewhere else.

Its a hobby VPS which I use for my throwaway email account (i.e. forum registrations and the like, basically any 'non-official' signups) so its not the end of the world if it dies, but sure would be inconvenient. I spent a ton of time getting all the bits right including SSL, spamassassin, fail2ban, webmail, virtual users etc.



If all else fails I can just pay a bit more to my registrar and get them to host the mail as well, or repoint the mail records to anyone who can host mail really, but this is more for my interest if anything.


I'm getting the sense that there is no real solution other than a backup MX record, which solves SMTP but does nothing for IMAP/ the actual mailboxes outside of MTA delivery.

deanwebb

Right. The mailboxes have to be migrated, which involves an export/import operation if the target system is not the same as the original host.
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

Dieselboy

I don't think a backup MX record will work at all, for the reasons I mentioned before.

Even though you don't have access to the VMDK for example, you do have access to the OS. Why not take backups of the database and any other configs inside the OS and use that to restore?

wintermute000

well yeah I can do that and I do already dump the mysql tables + zip up my /etc folder, but I wanted to setup a redundant host on a different provider for kicks + learning.

If its not possible then sod it

Dieselboy

I think you're really looking at some kind of clustering, with this already built in. The db's would need syncing and there would need to be some kind of connectivity between the servers. If they're in completely separate environments then may be some kind of host to host IPSEC or L2TP tunnel, or at least some IP connectivity between the two would be needed to do the sync'ing (just thinking about your set up specifically). 
If there's no in-built clustering / replication mechanism, then you might be able to do it manually - but I've no idea how you could sync db on system1 to db on system2.
In addition to the db, I'm not sure what else would be needed to be synced.


wintermute000

yeah its looking like the too hard category. I am curious how its done IRL but not curious enough to bother LOL.

I know SQL clusters, not sure about dovecot (the storage surely would be split off onto SAN or shared storage). Postfix should be able to run completely independently as long as the settings are correct, just need the mail to actually get to that SMTP server domain name.