Menu

How to install a secure mail server in ubuntu with Mail-in-a-box

3 years ago 4

In this article i will show you how to install a really secure mail server the easy way.

Throughout the time i had always had a hard time installing mail servers in Linux, first they require a lot of configuration just to get them working properly, second there is no easy way to manage them and easily add users, aliases or new domains, and third making them secure was yet another challenge because of the dozens of modern protocols that surround it, that is until i discovered Mail-in-a-Box.

Mail-in-a-Box is a GitHub project that aims to provide an easy way to deploy a mail server that is both secure and easy to use, it helps individuals or organizations take back control of their email with an easy to deploy mail server that is 100% ready for Production environments.

Why do we need this?
Why not just use Google Apps or Microsoft Exchange?

Mass electronic surveillance by governments revealed over the last year or so has changed the way the web works, empowering users tu use new encryption methods and get away from using services like Google or Microsoft to host their email and data all in an effort to re-decentralize the web, and to be their own service providers again.

This is important not just for privacy, but for the web to evolve and give back the power to the user as it always has.

What’s in the BOX ?
  • IMAP/SMTP server(Dovecot, Postfix)
  • Roundcube Webmail
  • OwnCloud Contacts (contacts and calendar synchronization)
  • (Z-Push) ActiveSync compatibility synchronizes emails, calendar, contacts and tasks
  • Automatic DNS configuration
  • SpamAssassin Spam filtering
  • Email Greylisting (Postgrey)
  • Backups to Amazon S3
  • Static website hosting (Nginx)
  • Free TLS (SSL) certificates from Let’s Encrypt.
  • A Web Control Panel to easily add domains, users, domains, and monitor your mail server performance among other things.
  • Modern mail protocols (SPF, DKIM, and DMARC) and the latest security best practices, including opportunistic TLS, strong ciphers, and HSTS. When enabled, DNSSEC (with DANE TLSA) provides a higher level of protection against active attacks.
Note:

Please provision a machine with at least 768 MB, 1 GB recommended

Also make sure if you are running this server from within your own network make sure you have a business internet service to avoid your outgoing email being marked as spam.

This tutorial requires that you are familiar with setting mail server records in dns specifically MX, SPF and DKIM.

Mail-In-a-Box is a full fledged Dns server so you could point your domains to it and it would set all of the record automagically. you can also view all of the records in the web admin and copy them into your domain registrar directly.
Here are some tutorials on how to do this Godaddy.

Mx Records
Spf Record

If you are looking for something more advanced, try iRedMail , Modoboa or Zimbra.

Install

Step 1
Connect to your server as the admin user via SSH or open a command prompt.

ssh [email protected]

Update and upgrade

sudo apt-get update && sudo apt-get upgrade

Step 2

We need git for this so let’s install it

sudo apt-get install git

and now we clone the Project to our machine

git clone https://github.com/mail-in-a-box/mailinabox

Step 3
Let’s Install it

cd mailinabox

It does not get easier than this, just run the install script to start.

sudo bash setup/start.sh

Now we Choose the email that will also be the account that will manage the mail server. Note that whatever subdomain that we choose will also be the first domain that will get added to the mail server.

Now we choose a hostname

Choose your timezone
Select the admin password

Your Mail-in-a-Box is running.

That’s it you are pretty much done all that is left is to point your domains dns to Mail-in-a-Box and you have a fully functional Mail server, webmail, calendar, web server and contacts and, on top of it all it uses the latest encryption methods to make your mail server as secure as possible.

Please log in to the control panel for further instructions at:

https://yourserverip/admin