iRedMail Mail Server

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 rules are not executed server side.
    • If computer and 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.
  • Privacy.
    • 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.
  • Space.
    • 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.

  1. Using iptables, drop all incoming connections except http, https, ssh, imaps, and smtps.
  2. Fail2ban.
  3. No password login, ssh keys only.
  4. Force HTTPs for all web activity.
  5. Use encfs to encrypt the mail directory, and if wanted the MySQL directory.
  6. 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.

Mail Rules/Filters.

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 email rules.

Screen Shot 2014-01-16 at 10.46.18 AM

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.




2 thoughts on “iRedMail Mail Server

  1. Thank you for sharing your ideas. Did you succeed with iRedMail and encfs and if yes, would you mind to share your experience?

  2. I’m also interestedin setting up an encryption module in roundcube.
    Could you post more details on this topic?

Leave a Reply