LINUXMAKER, OpenSource, Tutorials

Mail server and mail filter with Postifx, Dovecot and Cyrus

Large companies have their own. Why shouldn't you benefit from a mail server as a medium-sized or small company, as a self-employed person or even as a private individual?

  • First of all, the independence from large providers and the associated restrictions (limited storage space, limited configuration options, limited accounts) must be mentioned.

  • The failure of a large provider can lead to greater restrictions.

  • With your own mail server, there is no need for unpredictable mail addresses with domain names that everyone can have, @ t-online.de, @ aol.com, @ gmail.com etc., because you have the right domain name and personalized email addresses.

  • You determine how current your virus scanner and spam protection are on your mail server and how well they work.

  • With your own mail server you are also in control of the number of mail accounts and quotas.

  • If a server has already been rented in a data center and is not yet fully utilized, you can still use these resources at no additional cost and better utilize the existing infrastructure!

Email as the means of communication for digitization

The mail server plays one of the main roles in e-mail communication: it receives e-mails, sends them, forwards them and saves them for later retrieval. This is done for the purpose of exchanging appointments, information and documents. The mail server is operated by the provider with whom the email address or the web hosting package has been registered. In contrast, companies usually operate their own mail servers.
As a user, you access the email server via your email account and email address. This temporarily stores the messages sent by an e-mail client until they are retrieved by the recipient. This is possible either with the Post Office Protocol (POP) or the Internet Message Access Protocol (IMAP).
The mail server works with numerous other modules to ensure that everything runs smoothly. These include:

- the Mail Transfer Agent (MTA)
- the Mail Retrieval Agent (MRT)
- the Mail Delivery Agent (MDA).

Despite billions of emails being sent every day, only about 10% of them are really wanted emails. 90% of global mail traffic consists of unsolicited advertising emails and computer viruses, the "spam". This directly threatens IT security and the productivity of your employees.

That is why IT-LINUXMAKER offers you tried-and-tested solutions that can easily handle large amounts of data and a large number of spam mails without affecting performance.
In addition, our mail servers have various filters that automatically sort out spam mails and messages infected with malware. IT-LINUXMAKER uses well-functioning filters and thus reliably protects you against viruses, worms and other attacks from the Internet.

Dovecot MDA

Dovecot is a mail delivery agent (MDA) for Linux that supports the IMAP and POP3 protocols. His specialty is small networks (approx. 200 mailboxes) up to large company networks (over 1000 mailboxes). The data is stored in mbox or Maildir format and can therefore be easily migrated or used in email clients that access the data locally. Furthermore, no users have to be created. Every local user can log on directly to the mail server with his user data. And Dovetcot is fully compatible with the older Courier IMAP server and the old UW-IMAP reference server software for the IMAP protocol.

Dovecot has left the other IMAP servers such as Courier and Cyrus behind: high performance and stability, simple configuration, beautiful documentation and finally a properly functioning SASL implementation - and in the end even with dbox the design of its own open storage format for E Emails to compensate for all the advantages and disadvantages of existing formats. The suite also includes Sieve, a domain-specific language that is used by users to configure mail filters on mail servers.

Cyrus MDA

The mail server Cyrus is an open source project of Carnegie Mellon University, which is now a recognized mail delivery agent (MDA), which is also used in the professional field. In addition to the POP3, it also supports the IMAP protocol. Cyrus works with various SMTP servers under Linux/Unix and is ideally equipped to work with the Postfix mail server. Cyrus uses the Cyrus SASL Library - an implementation of SASL - to be able to provide several authentication methods, such as plain, CRAM-MD5, Digest-MD5, or PAM.

Cyrus IMAP is one of the big four IMAP servers next to UW, Courier and Dovecot and probably provides the most extensive functionality. But with this server some things work a little differently. In contrast to the classic mailbox or Maildir files, it stores emails in its own format on the server and also goes its own way with a multiserver setup.

Technical implementation with Postfix, AmaVis and SpamAssassin

Mail Server
As a mail transfer agent, IT-LINUXMAKER uses the popular Postfix, which is also very well supported in the open source community. The POP3 and IMAP functions are mapped either with Dovecot or with Cyrus. Cyrus is generally the choice for large installations.

Virus filter
The following principle applies to virus filters:
The Mail Transfer Agent accepts the emails and forwards them to the Amavis filter software before any further processing. If necessary, it unpacks the relevant attachments and scans the content using an installed virus scanner. Amavis can act both with open source scanners like Clamav, which we prefer, and with proprietary virus scanners, such as Avira. If viruses are detected in the mail, the mail is rejected and the mail server can now send an error message. In order to avoid so-called backscatter spam, it is mostly not used. All other emails classified as harmless are delivered as normal.

Spam filter
IT-LINUXMAKER filters out spam mails using different, combinable methods.
(DNS) blacklisting, greylisting and score filtering are also used. The DNS blacklisting checks whether a DNS-A record exists for the sender's IP address. If the A record does not exist, the IP address is blacklisted. In the future, any email that comes from this IP address can be identified as spam mail.
On the other hand, the SMTP service, specifically Postfix, definitely rejects any incoming email in the greylisting. The IP address of the sending mail server, the e-mail address of the sender and the e-mail address of the recipient are saved in a database. The sending mail server then receives a response that the receiving mail server is temporarily unavailable and the delivery attempt should be repeated. Now that the spam technology largely sends mail using worms and Trojans, delivery attempts will generally not be made. In contrast, regular mail servers will repeat the delivery attempt. The data used is compared and the greylisting is adjusted. If there is a positive check, the email is processed further. Amavis is again used, which now forwards the email to the SpamAssassin spam filter for evaluation. SpamAssassin evaluates the email according to certain characteristics, such as keywords in the subject line or in the content and / or the frequency of HTML tags in the text, and awards a corresponding number of points. If a variably adjustable threshold value is exceeded during the evaluation, the mail is classified as spam and moved to a spam folder.

All mail server systems that are implemented by IT-LINUXMAKER generally receive security via SSL/TSL, which we create and configure using Let's Encrypt.


IT service and IT consulting

The digitization of business life, essential production processes and private life is in full swing. At the same time, threats from server failures, viruses and cybercrime are increasing. The whole thing is reinforced by neglecting IT security both in the private sphere and in the business world. Protective mechanisms that are really necessary are usually only considered when the damage has already occurred and the restoration of the IT infrastructure has caused enormous costs.
Linux offers you a secure basis in your IT infrastructure right from the start. On the one hand, because it has always been conceived as an operating system geared towards network operation. On the other hand, because the free availability of the source code makes the possibility of defective or misused functions almost impossible. In addition, “Open Source” has always meant permanent improvement by innovative specialists from all over the world. In the meantime, more and more users trust Linux, which among other things provides the kernel for the numerous Android installations, including companies and institutions such as Siemens, BMW, Lufthansa, Deutsche Post AG, Greenpeace and state institutions including the Federal Commissioner for Data Protection.
You are a company, a medium-sized company, a craft company, a sole trader with the appropriate IT infrastructure and you want to fully satisfy your customers with your products. Or you are a private individual with corresponding support requests. Your IT infrastructure should work reliably around the clock. As an expert in this field, IT-LINUXMAKER can protect your information effectively and quickly. With the services of IT-LINUXMAKER you secure your competitive advantage through the stability of your IT infrastructure and your data.

The support contracts from IT-LINUXMAKER are the ideal plus for your IT or development department. IT-LINUXMAKER supports you in all situations related to Linux with administration, monitoring, configuration, troubleshooting and script programming. Where your IT infrastructure is located, how large it is or how many users work in it does not matter for IT-LINUXMAKER.