iRedMail on Ubuntu
Problems with previous setup (iCloud/gmail)
A few weeks ago I decided that I’d had enough with iCloud/Google/etc for my e-mail.
- iCloud’s anti-spam SUCKS. I’m tired of getting multiple, obvious spam emails a day.
- Apple’s mail.app rules are not executed server side.
- If computer and mail.app are not running, mail will not be filtered.
- Mail is filtered client side, after being delivered to inbox, thus iPhone will alert for every email prior to it being moved from the inbox.
- Apple’s iCloud, server-side email filtering features is very limited.
- Maximum of 99 mail filtering rules.
- Extremely limited options when configuring filters.
- Want full control of my email, where it is stored, and how it is sent.
- No longer want to have my data ‘in the cloud.’
- Want to keep everything encrypted.
- Want to be able to send email within my domain without it ever leaving my server.
- Tired of paying for extra space for all my e-mail with apple.
Add SWAP File.
If hosting your iRedMail on a cloud server or VPS, be sure to add a SWAP file. In Ubuntu, like this:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k sudo mkswap /swapfile sudo swapon /swapfile echo "/swapfile none swap sw 0 0" >>/etc/fstab echo 0 | sudo tee /proc/sys/vm/swappiness echo vm.swappiness = 0 | sudo tee -a /etc/sysctl.conf sudo chown root:root /swapfile sudo chmod 0600 /swapfile
Some Security Considerations.
I’m using Ubuntu, which is not my favorite when security is concerned.
- Using iptables, drop all incoming connections except http, https, ssh, imaps, and smtps.
- No password login, ssh keys only.
- Force HTTPs for all web activity.
- Use encfs to encrypt the mail directory, and if wanted the MySQL directory.
- Only allow secure IMAP/SMTP. No plain text connections.
Getting email to push correctly to iPhone.
Since Apple’s iOS doesn’t natively support IMAP IDLE, one will notice that email often takes a long time to get pushed to your iDevice (if ever pushed at all). To fix this, I installed z-push. With z-push setup, mail from my self-hosted solutions actually hits my iPhone FASTER than iCloud’s email.
One of the critical flaws for me with Apple iCloud email was the limit of 99 mail filter rules. Using RoundCube Webmail + the Dovecot Manage Sieve Plugin (this is all enabled by default with iRedMail) you can create as many rules as wanted. In addition the rules have the potential to be far more complex than apple’s crappy iCloud.com email rules.
These rules are all executed by Dovecot, this they are executed server side, prior to the e-mail being delivered to the Inbox. This means that if you are subscribed to a high volume mailing list and have the mail from it directed to a sub-folder, you iPhone will not go off every time you receive one of the emails from the mailing list.