Linux Mail Server: Overview and Configuration

E-mail for most users looks like a regular website with a convenient interface where you can comfortably type text, attach pictures and send messages to friends. However, in fact, everything is much more complicated. For data transfer mail servers on Linux are used. They are the ones who handle the processing, delivery, and routing of messages. This article will cover the most popular Linux mail servers, as well as ways to configure some of them.

Overview of solutions for creating systems for sending and receiving messages

Using a Linux mail server, you can quickly and conveniently deploy your own message receiving and sending mechanism. There are a lot of ready-made solutions on the Web, which can only be installed and a little โ€œfinishโ€. Among them, of course, there are more complicated systems to configure, the configuration of which will be shown later on the example of Postfix.

linux mail server

SendMail - popular and fast

SendMail can be called a pioneer among Linux mail servers. The first version was released back in 1983. Since then, SendMail has mastered many stations and nodes. It is actively used to this day. A fast and optimized server, however, does not meet modern security requirements and is quite difficult to configure.

Postfix - flexible, powerful and reliable.

It was originally developed for the internal needs of the IBM Research Center. Many features and capabilities are borrowed from SendMail. However, it is much faster, safer, and setup takes less time and effort. It can be used as a mail server on Linux, MacOS, Solaris.

IredMail

This server is essentially the largest set of scripts and configuration files. With their help, you can quickly raise the mail server on Linux with and without a Web interface. It has support for the SMTP, POP3 and IMAP protocols. The installation procedure in general will not take more than 10 minutes, depending on the skill of the admin.

In the process of setting up a Linux mail server, iRedMail will automatically install anti-virus and spam tools. In addition to them, password protection mechanisms, various analyzers, etc. can be added. A great option for a ready-made Linux mail server.

Indimail

It combines several well-known protocols and technologies for implementing the transmission of mail messages. The system integrates the ability to create channels between nodes of the same network, for example, to organize a common mail resource for different branches of the company. The system has a very flexible configuration mechanism. It is implemented by redefining variables, of which there are about 200 in the server. In this case, you can create several IndiMail workflows in parallel.

Rumble

Linux mail web server written in C ++. There is a built-in API for managing and creating scripts. It has a large number of functions and capabilities out of the box. Several well-known DBMS versions are supported. If desired, or reconfiguration, you can quickly switch from one to another. Server interfaces are divided by rights to their specific zones - users, domain administrators and servers.

Zentyal

Probably the easiest and most convenient ready-made Linux mail server. In it, almost all instructions and settings are executed in a special graphical interface. This mail server is based on Linux Ubuntu. Adding features or capabilities is done by installing new modules. Using it, you can organize a separate mail server, as well as a certain router or intermediary node between the main highways.

Axigen

Free, powerful and feature-rich mail server. It can be used both through its own web interface, and through any email client. It is able to collect mail from external mailboxes, automatically reply to messages, filter them, and it is also convenient to import in CSV format.

For configuration and administration has its own web interface. For fans of the classic control model - the task of commands through the console is available.

The server supports a large number of operating systems, including those from the Windows line. The interaction process is very well documented and explained by numerous examples on the developer's site.

CommuniGate Pro

Cross-platform server capable of working with e-mail and voice messages. It is possible to connect to it using email clients or a centralized web interface. There is an implementation of the delimitation of access rights of one account to several people. Plugins can help integrate various anti-virus systems and solutions.

Setup on the example of one system

After reviewing mail servers on Linux, it is worth considering setting up one of them in more detail.

For example, you can show how to install and configure Postfix on Ubuntu. It is assumed that the hardware already has this operating system and has been updated to the latest version.

The first thing to do is download the server itself. It is available in Ubuntu repositories, so in the terminal you need to type:

linux web mail server

During the installation process, the system will ask you to specify a new password for the database user under the root account. Then it must be repeated to confirm. Then he may ask what type of installation is of interest. Then the system mail name in which you can specify - some.server.ru.

Now you need to create a database for the server. You can do this using the command:

mysqladmin -u root -p create mail.

It is here that you will need the previously specified password for the database.

Now you can go into the MySQL shell itself using the command:

mysql -u root. The system again asks for the password that must be entered.

Next is a set of commands that will help create a new user with privileges:

linux mail server with web interface

You will also need tables in the main database, you can create them like this:

linux mail server setup

Now the mysql console is no longer needed and you can exit it.

Postfix configuration

First you need to show the server how to access the database, how to look for the necessary values โ€‹โ€‹there. For this, several files will be created. They can be located in the / etc / postfix directory. Here are their names:

linux mail server for enterprise

They should contain the following content, among which the query string for each file will be unique:

user = admin name specified when creating the table;

password = <admin password>;

dbname = name of the created database;

query = query, unique for each file;

hosts = 127.0.01.

The query variable for files:

overview of mail servers on linux

The password for entering the database will be located in these files, so access to them needs to be somehow limited. For example, set rights that are restrictive.

Now it remains to add some more settings to Postfix. It is worth noting that in the lines below, you need to replace some.server.ru with a real domain.

mail servers on linux ubuntu

Safety certifications

First you need to create your own certification authority, which will confirm the validity of all certificates.

Storage is created for the files:

mkdir ~ / CA_new

And the configuration file. It contains the following code:

mail server under linux

A small explanation to it:

  • C variable - here you need to specify the country in a two-letter format, for example, for Russia - RU;
  • ST - means a specific region or region;
  • L is the city;
  • O - name of the company;
  • CN - here you need to specify the domain to which the key is intended;
  • E-mail address.

Then the key itself is created:

sudo openssl genrsa -des3 -out ca.key 4096

The system will prompt you to specify a password for this key, which in no case should be forgotten.

Now we need an open version of the key:

openssl req -new -x509 -nodes -sha1 -days 3650 -key ca.key -out ca.crt -config ca.conf

Here you will need to enter the previously created password for the private key.

Now certificate:

openssl pkcs12 -export -in ca.cer -inkey ca.key -out ca.pfx

Next, you need to create a directory in which all generated keys will be stored. Each server has its own folder.

mkdir SERV

mkdir SERV / some.domain.com

And it creates its own configuration:

nano SERV / some.domain.com / openssl.conf

Inside it should be the settings listed below. They are similar to those that have already been created.

ready linux mail server

To generate keys, use the command:

sudo openssl genrsa -passout pass: 1234 -des3 -out SERV / some.server.ru / server.key.1 2048

The password 1234 is used in this line. It is needed for a while.

Now the password is removed from the command:

openssl rsa -passin pass: 1234 -in SERV / some.server.ru / server.key.1 -out SERV / some.server.ru/server.key

Now you need to sign the key:

openssl req -config SERV /some.server.ru/ openssl.conf -new -key SERV /some.server.ru/ server.key -out SERV /some.server.ru/ server.csr

And remove the temporary: rm -f SERV / some.server.ru/server.key.1

With the help of the manipulations, a mail server will appear that can simply receive and send messages. In addition to the main ones, there are additional modules that can be installed to expand the functionality. This will create a full-fledged mail server on Linux for the enterprise.

Additional functions

The following modules can be used to expand the capabilities of the mail server, for example, Antispam or the mailing service.

  • Horde. Very convenient web interface for mail. In addition to its main task, it has built-in calendar, scheduler and contacts. It has a convenient configuration and configuration scheme.
  • Amavisd-new. Acts as a gateway and is mainly used for docking various technologies. Amavisd-new receives the message, filters it, finds out if it can be dangerous, and connects additional functions of other modules for verification.
  • SpamAssassin. As the name implies, the module filters messages according to certain rules, calculating spam. It can be used both separately and as part of various demons.
  • ClamAV. A popular antivirus in a Linux environment. It is free software. Able to work with many different mail servers, scan files and messages on the fly.
  • Razor This module stores checksums of spam emails and interacts directly with P ostfix.
  • Pyzor is another tool for detecting messages that contain malicious or useless code for the user.
  • Fail2ban. A tool that protects user accounts from cracking passwords. After a certain number of attempts, a specific IP address is blocked for a while.
  • Mailman A convenient tool for creating newsletters through a web interface.
  • Munin. Tool for monitoring server performance. It has a large number of ready-made plugins that expand its capabilities. Network protocols can be tracked on convenient graphs.

Conclusion

As you can see from the article, installing and configuring a full-fledged mail server manually is a long and difficult task. However, such an approach will make it possible to generally understand how the system works and to know its weak and strong points. In case of problems, a trained administrator can quickly localize and fix the problem. This will be especially relevant for large companies whose work depends entirely on the speed of receiving and sending messages to customers or partners. For small networks, the out of the box solution, which can be quickly deployed using the convenient interface, is quite suitable.

linux mail server for enterprise

However, in the event of a server failure, you will have to delve into and understand the systemโ€™s device for a long time. The article, using the Postfix mail server as an example, showed the basic configuration methods for initial work. Together with a large number of modules, plugins and add-ons, this will create a powerful and reliable tool for sending and receiving messages.

Source: https://habr.com/ru/post/K3381/


All Articles