Jump to content

How to set up secure private email server with Modoboa


Modoboa is a modular open-source mail server and management platform that integrates with well-known software such as Postfix or Dovecot. A SQL database (MySQL, PostgreSQL, or SQLite) is used as a central point of communication between all components. As a result, you are able to create your own dependable and secure email server.

In short, with Modoboa, you won’t have to rely on email providers. These are the main features of Modoboa:

 

 

  • Encryption of all communications between your email server and the outside by default using the TLS protocol and a valid SSL certificate provided by Let’s Encrypt.
  • Administration panel – An online panel to manage domains, mailboxes, aliases, and more!
  • Amavis with SpamAssassin and ClamAV virus scanning, banned content type, and the likes.
  • Creation of filtering rules to organize emails
  • Unlimited creation of domains, mailboxes, and aliases
  • Creation of filtering rules to organize emails
  • Reputation optimization – Improve email reputation using standard protocols like DKIM or DMARC, this way, you can ensure your email will always be delivered.
  • Support MySQL/MariaDB, or PostgreSQL database.
  • and many more…

n this guide, we’ll show how to install Modoboa on an UpCloud Cloud Server running Ubuntu 18.04 but the instructions can be easily adapted to other operating systems as well.

Prerequisites

Modoboa can be installed on multiple different operating systems and a wide variety of configurations. However, it does have some requirements you should be aware of:

  • First, you will need to deploy a clean instance of a cloud server with minimum system requirements of at least 2 GB RAM, 2 CPU cores, and 10 GB of storage.
  • Operating System: Debian 8 – 10 / Ubuntu 14.04 & Higher / CentOS 7
  • Make sure Port 25 is not blocked: The port 25 is used for communication between mail servers and it is blocked by default for new users on UpCloud. The port 25 needs to be open, otherwise, your server may be not able to receive or/and send emails.

Note that you don’t need to register a new domain, you can use any existing one. Just make sure you are creating a new DNS Domain entry and the following DNS records exist for your domain. We will be using the domain name ‘example.com’ as an example, replace it with your own where applicable.

mail IN A
IN MX mail.example.com.

You can find out more about how to manage your DNS records at our guide on domain name systems.

Lastly, make sure your reverse DNS is set on your email server’s IP address e.g. mail.example.com.

Step 1: Setting Up Modoboa Configuration Installer

We will be using the Modoboa installer for the mail server setup. To be able to use it, first, make sure you have python installed as Modoboa is written in python. We’ll also need the git utility, so install that at the same time if not already present on your system.

sudo apt update
sudo apt install python-virtualenv python-pip git -y

Once python and git are installed and ready, download the modoboa-installer script from its GitHub repository:

git clone https://github.com/modoboa/modoboa-installer

Next, change directory into the script folder:

cd modoboa-installer

You can customize the configuration before running the installer. Use the following command to generate a new configuration file.

sudo ./run.py --stop-after-configfile-check example.com
Welcome to Modoboa installer!
Configuration file installer.cfg not found, creating new one.

Then open the new config file in a text editor.

sudo nano installer.cfg

You can automatically generate a valid SSL certificate for your mail domain using Let’s Encrypt by change the type under certificate from self-signed to letsencrypt. You should also set your email address which is used for account recovery and other information.

[certificate]
generate = true
type = letsencrypt

[letsencrypt]
email = mail@example.com

Modoboa uses Postgres by default. However, if you prefer MariaDB, change the engine in the database section to mysql.

[database]
engine = mysql
host = 127.0.0.1
install = true

Once you are done with the setting, press CTRL + X, and Y, and Enter to save and exit.

Lastly, check your hostname using hostnamectl. Make sure it matches your MX record value, e.g mail.example.com.

sudo hostnamectl
   Static hostname: mail.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 00650ba6576b432c8ee995979b224ca7
           Boot ID: c22f9c1e5b1a4c00a3a26d25c34dddc5
    Virtualization: kvm
  Operating System: Ubuntu 18.04.5 LTS
            Kernel: Linux 4.15.0-124-generic
      Architecture: x86-64

If it is different, change it with the following command while replacing the example mail domain:

sudo hostnamectl set-hostname mail.example.com

Before you begin the installation, you should check that your DNS records for the mail server (mail.example.com) have propagated using dnschecker.org. If yes, continue with the next step, otherwise, wait a moment and check again.

 

Continue Reading...

Tutorial Videos

Optionally you can add videos from Youtube or Vimeo to your tutorial

User Feedback

Recommended Comments

There are no comments to display.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...