Complete Virtual Mail Server

Under Construction
This is a copy of copy from the original gentoo-wiki. I wrote the article over on the gentoo-wiki.com which was pretty much a complete rewrite from the 'old' gentoo-wiki that only exists as a backup of some sorts now. As I am currently in the process of installing a new e-mail server, these instructions will be changed and updated where needed and hopefully thus accurate. Parts I am not configuring or not using will be stubs for someone else to fill in hopefully.

Original-Introduction
Wow, when I started this HOWTO, it was going to be a simple extension of the "Virtual Mailhosting System with Postfix Guide" written by Ken Nowack and Ezra Gorman. All I was going to do is change from MySQL to PostgreSQL, how much of a problem could that be?

After many hours of effort, about 8000 different configuration variations and having to try to read hints and tips from pages in almost every language you can imagine, I finally have it (Phew!). I have made every effort to validate that this configuration is correct but cannot guarantee it 100%, however it was close enough to get me running and believe me, I am no Linux expert.

Because this document is so long (over 100 pages in a4 paper format!), I have broken it into a number of sections in the hopes that it will be more manageable. Enjoy!

So What do I Get?
The purpose of this HOWTO is to establish a virtual mail system that can handle multiple domains with a variety of different interface options. This is not intended to be used by the average user who is looking for a mail client, this is a full-scale Mail Transfer Agent (MTA) intended for individuals who are hosting their own domains and/or need to provide support for virtual domains.

By the end of this HOWTO, you will have an easy method to manage a mail server that supports: The real plus is that all of this is managed by a single database.
 * Web based system administration
 * Unlimited number of domains
 * Virtual mail users without the need for shell accounts
 * Domain (specific) user names
 * Mailbox quotas
 * Web access to email accounts
 * IMAP and (very optional)POP3 support
 * SMTP Authentication for secure relaying
 * SSL for transport layer security
 * Strong SPAM filtering
 * Anti-Virus filtering
 * Log Analysis

System Setup and Packages
This section outlines a system setup (a multi-server implementation) as well as the core packages that were used. This is a MUST READ before reading on any further (don't worry, it's short).

Linux 'vmail' user
Mailboxes are stored on a normal filesystem and thus needs a user and group for security.

Admin Support Systems
and were key tools in getting through testing and getting this to hang together. While the details of an Apache/PHP setup are not here, there is good information in here all the same.

Postfix to databasebackend
will be coupled to a database backend allowing virtual users on multiple domains.

Linking Courier-imap to databasebackend
will be coupled to the same database.

SMTP Authentication
Hainv a mailserver that relay's local mail good enough for most, being able to relay mail after authentication is extremly handy.

Web Access
Now that a basic mailserver has been setup, web-access can be both useful and helpful during testing.

SSL Certificates
Securing the mail server with SSL certificates.

Refining the Setup
Using default Postfix configuration options, the server gets some performance tweaks and security settings.

Amavisd, Spam-Assassin and ClamAV
Defending against spam using Amavis, Spam-assassin and ClamAV for virus protection.

Logging mail traffic with AWStats
Always important is monitoring. To do so AWStats is used to get a useful overview of passed messages.

ToDo
Things that need to be looked at, and are scrabbled here as a reminder.