mjl- / mox

modern full-featured open source secure mail server for low-maintenance self-hosted email
https://www.xmox.nl
MIT License
3.69k stars 110 forks source link

Running two mox servers and syncing with them #227

Open exander77 opened 1 month ago

exander77 commented 1 month ago

I would like to run two mox servers in different location with one primary and one secondary and syncing data between them.

How to achieve this?

mjl- commented 1 month ago

This is not currently possible with mox, I think it will come at some point in the future. The complication is that quite some state should be synchronized between the mail servers. Not just which accounts exists. But also historic classifications: That's what mox uses for its junk filtering. If the secondary MX is independent, it couldn't do (the same) proper junk filtering, and spammers would just get email delivered through the secondary MX, bypassing any filtering on the first.

I think this will require changes relatively deeply in the database storage layer to do the synchronization. Probably with some proper failover mechanism. It's a relatively big feature, and I would want it to solve the problem in an easy to use way (configure the primary with the address & keys of the secondary, then install a mox in secondary mox on a new machine and configure it with the key of the primary, and have it all work automatically from there on).

Also see https://www.xmox.nl/faq/#hdr-how-do-i-configure-a-second-mox-instance-as-a-backup-mx

exander77 commented 1 month ago

I like the idea of primary and secondary, like I have it with DNS server.

It has to synchronize everything, both in real time and historically, if one instance was unavailable for a while. Kinda like, master-master replication.