Complete Virtual Mail Server
From Gentoo Linux Wiki
|
Complete Virtual Mail Server |
|
Getting Started Basic Mail Setup Enhanced Mail Services
Anti-Spam Configuration
Anti-Virus Configuration Log Analyzer Wrapping it Up |
| edit |
[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] Additions to this document
(2006-10-07, by mknappe)
This document was by far the best I could find for setting up a virtual mail system including all kind of spam and virus filtering. But I chose a different approach and I am going to comment parts of this HOWTO with my own experiences. The main differences are:
- MYSQL instead of Postgres
- CYRUS imapd instead of Courier
I am additionally going to explain certain configuration options and why they are important and maybe in the near future I will provide you with a download link where you can get a PHP application to administer your mail database. All my comments will start with (date of writing, by mknappe) and end with (/addition)
(/addition)
[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
Webmin and Apache were both 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.
[edit] PostgreSQL
All the details we need to ensure Postgres is installed, the schema created and is properly configured to backend our solution.
[edit] Postfix
The basic Postfix installation to confirm that it is installed and working. We will get to the more advanced stuff further on.
[edit] Postfix to Postgres
Connecting our two systems together with some add-on features.
[edit] Enhanced Mail Services
[edit] Postfixadmin
While I decided not to use Postfixadmin in my final setup, I still felt it was worth including this as many may find it quite useful.
[edit] Courier-IMAP and Authentication Services
Installation and setup of secure IMAP and POP3 services using courier-imap.
[edit] SMTP Authentication
To ensure my mailserver does not get abused, I require authentication before users are allowed to send any outgoing mail.
[edit] Web Access
We can provide web access to individual mail accounts with Squirrelmail.
[edit] Refining the Setup
Using some of the out-of-the-box features of Postfix we can refine the settings to help eliminate some spam and make some minor performance adjustments.
[edit] Anti-Spam Configuration
[edit] Installing Amavisd and SpamAssassin
Setup Amavisd, SpamAssasin and Postfix to filter your emails before delivery. If all goes well, neither spam nor virus' should see the inside of a mailbox.
[edit] Quarantine and Spam Management
We have a database, so we might as well use it. All undesirable mail will be quarantined in the database. A good option for per-user access and management.
[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] Amavis/Spamassassin UI
A base interface does exist, but it was not all encompassing enough for my needs. Still it shows promise so I will setup you through it.
[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] Distributed and Collaborative Networks
Connections to some of the more popular (and yes, free) networks available in the battle against spam.
[edit] Anti-Virus Configuration
[edit] Configuring for ClamAV
With the infrastructure we have to this point, it is fairly easy to tie in ClamAV as a virus scanner for our system.
[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.
