First off: I have to start off by saying I love mailcow! I’ve been running a (home) mail server for years now with multiple different apps and this one is by far the best and slickest. Granted, there have been some learning curves and when things didn’t work it could take some time to figure out, but that’s to be expected. For the most part you can get an email server up-and-running in minutes.
I’m not sure of mailcow’s demographic, however one of the things I’ve implemented is georestriction so that only IPs or locations I authorize can access my mail server web interface (e.g. mailcow, SoGo or Roundcube). Sure I could look at two-factor or multi-factor authentication but with nginx, the geoip restriction implementation is not very complicated and I can easily restrict by city/town, state or even country.
What would be really cool is if mailcow could implement something like this natively. Currently I have a “high-availability raspberry pi keepalived cluster” of two pis, each running nginx and with one common IP, working as a (reverse) proxy in front of mailcow. I implemented the geoip2 module in nginx and made simple changes to my nginx .conf file to allow access from my state and block everything else. This gets rid of 99% of malicious attacks or attempts to access my website. With the maxmind database, I don’t need to manage extensive lists of IPs, I simply “allow Ohio and disallow everything else” in the config with a couple of extra tweaks and checks and then MOO! Only IPs in that state can access mail and get reverse-proxied to the mail host.
In order to implement this, you have to re-compile nginx, add-in the geoip module, then change the nginx .conf files. While I’m a seasoned IT pro, this kind of customizations to containers isn’t easy, plus I’d rather stick with “stock” containers rather than modded ones. I’m thinking the mailcow.conf file could contain your georestriction settings (e.g. maxmind account) and the UI could handle the “whitelists or block-lists”.
My next project is to figure out how to make mailcow “highly available”. Right now I run two instances of mailcow: a primary and a (warm standby) backup. The nginx proxy (or router) forwards the ports to the primary. The secondary server was set up almost identically (especially crypt!) but with a different directory/mounts for the containers (e.g. mail2 instead of mail1) and then syncs emails every 5 mins or so. When the primary goes down, I manually change the router and nginx to point to the backup server. Once the primary is restored, I have it sync from the backup then flip back the router to point to it. Not ideal, but it works if the primary has a crash or when I do maintenance.
I’d be happy to provide any info on my setup if anyone wants more info.
Thank you mailcow team for all your hard work on a great product! MOO!