Complete Virtual Mail Server
Contents |
[edit] Pre-Introduction
This is a copy from the original gentoo-wiki. 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. It will not be a 1 on 1 copy, as the old article became cluttered a little and will be cleaned up where possible. Parts I am not configuring or not using will be pure copies or stubs for someone else to fill in hopefully. Ideally, this document will replace all/most other mailserver documents of this kind and offer options where needed so we do no longer have 6 mailserver configuration documents.
[edit] 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!
[edit] 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:
- 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 POP3 support
- SMTP Authentication for secure relaying
- SSL for transport layer security
- Strong SPAM filtering
- Anti-Virus filtering
- Log Analysis
The real plus is that all of this is managed by a single backend Postgres database.
[edit] Getting Started
[edit] System Setup and Packages
This section outlines my system setup (a multi-server implementation) as well as the core packages that were used. This is a MUST READ before you carry on any further (don't worry, it's short).
[edit] Basic Mail Setup
[edit] Admin Support Systems
www-apps/postfixadmin and www-servers/apache were key tools in getting through testing and getting this to hang together. While I will not take you through the details of an Apache/PHP setup there is good information in here all the same. Even though I will not be using these admin features, they should be in the document all the same.
[edit] Linux vmail user
The Linux user that owns the mailbox directory hierarchy on disk.
[edit] PostgreSQL
All the details we need to ensure dev-db/postgresql-server is installed, the schema created and is properly configured to backend our solution.
[edit] MySQL
Optionally one can choose to use dev-db/mysql over dev-db/postgresql-server.
[edit] Postfix
The basic mail-mta/postfix installation to confirm that it is installed and working. We will get to the more advanced stuff further on.
[edit] Postfix to Database backend
Connecting our two systems together with some add-on features.
[edit] Enhanced Mail Services
[edit] Courier-IMAP and Authentication Services
Installation and setup of secure IMAP and POP3 services using net-mail/courier-imap.
[edit] SMTP Authentication
To ensure the mailserver does not get abused, It will require authentication before users are allowed to send any outgoing mail.
[edit] Web Access
mail-client/roundcube, mail-client/squirrelmail or www-apps/horde-imp all can be made available to the users.
[edit] Refining the Setup
Using some of the out-of-the-box features of Postfix we can refine the settings and make some minor performance adjustments.
[edit] Anti-Spam Configuration
[edit] Installing Amavisd, Spam Assasin and ClamAV
Setup Amavisd, SpamAssasin, ClamAV and Postfix to filter your emails before delivery. If all goes well, neither spam nor virus should see the inside of a mailbox.
[edit] Auto and Per-Recipient White/Black Lists
As above, we will configure the system to store your per-recipient white and black lists as well as Auto Whitelisting in the Postgres database. This is a little more limited as I have not found a user interface to support the schema yet.
[edit] Greylisting
A decent feature that can really cut down on your spam. Easy to install and can have a significant impact on spam.
[edit] Log Analyzer
[edit] Install and Configure AWStats
With all the work you've done, you will certainly want to be able to analyze the fruits of your labour. AWstats will allow us to summarize the activity on both our mail server and web site.
[edit] Wrapping it Up
[edit] Final Changes and Troubleshooting
A few minor things to complete the setup along with some useful places to look if you run into problems.
[edit] ToDO
Maybe describe LDAP integration for a shared and private server based address book. replace codeline with bold, italic and path where needed.