|
|
This is intended as a step-by-step guide to setting up an anti-spam e-mail gateway utilizing some of the most effective tools available. While these instructions may be adapted to other configurations, they are written for a Debian Linux installation. We use pre-compiled distribution packages where possible - so we can't offer help with compilation for those programs. We have made every effort to ensure the accuracy and completeness of this instructions. If you have any difficulty or confusion, please contact us with questions or recommendations. Likewise, if you found this page help - please let us know! Prerequisites - proper DNS configuration for both your internal network and your published external domain. Without this, nothing works. You must have valid A, PTR, and MX records for your internal e-mail server and your new gateway. The packages referenced below are from the Debian "unstable" repository. Debian is known for several features - cutting edge updates are NOT part of Debian's reputation. Debian concentrates on stability - one of things that makes it excellent as a server platform. Packages in the "unstable" area are not a comment on the code quality or reliability - only that it has not gone through the extensive testing and installation cycles that the Debian "stable" releases go through. A program that is considered "stable" by its authors may be in Debian's "unstable" area for over a year! Therefore, to install the programs listed below and utilize as many as possible of their current features, you will need to select the "unstable" versions from Debian. Comments below are enclosed in {} - the braces and comments should NOT be entered into a configuration files! Step 1 - Postfix Installation. Install the latest versions of the postfix and postfix-pcre packages. Step 2 - Postfix Base Configuration.
Important settings in /etc/postfix/main.cf (and leave the rest alone!):
Example main.cf settings: Now we need to add some restrictions. We'll get fancier later, we'll start with the basics now. Add the following lines to /etc/postfix/main.cf - and make sure you only have one instance of each parameter. strict_rfc821_envelopes = yes Now start Postfix and check your logs - postfix should startup without errors - otherwise there is a problem that needs fixing. Do not proceed until Postfix operates properly at this level. If the logs are clear and a process check shows postfix is running then try sending a message from inside your network to an Internet address. Now we'll add another layer - anti-virus protection using Amavisd-new and ClamAV. Amavisd-new is a multi-function program - it performs some basic anti-spam and anti-virus work internally, and it provides a link to other programs that do not have an SMTP interface. Installing these is a snap on Debian. To install Amavisd-new, oddly enough, install the Amavisd-new package. If you look, you will see a number of additional amavis* packages. One or two of these have some useful support tools, like amavis-stats - but most of them are older versions - don't install these. Unless you know what you're doing - accept the defaults and recommendations of the installer. Now it's time to make some changes to the configuration file - /etc/amavis/amavisd.conf:
That's it. $mydomain should be obvious - the $forwardmethod and $notifymethod tell amavis how to both pass on acceptable mail and how to submit notifications. Now we have a functioning e-mail gateway with anti-virus protection. Time to start blocking spam. You can actually eliminate a substantial amount of junk mail by using some of Postfix's built-in filters - but some of these can cause "good" mail to be blocked as well. This is due to the unfortunate tendency of Internet mail servers to be misconfigured. The original "golden rule" of the Internet was, "be conservative in what you send, liberal in what you accept" (not meant to be a political commentary). The problem with this is spammers have taken advantage of this open policy to facilitate their business. At this time, the vast majority of junk mail comes from misconfigured servers. Setting your e-mail gateway to only accept mail from properly configured remote server and clients can eliminate a HUGE amount of junk - with the side-effect of showing you which of your desired e-mail sources are also misconfigured. If you want to implement some of these policies, you need to be prepared for an investment of time - and some complaints. The other way of reducing spam is by content-filters. While there are quite a few alternatives available - one has stood apart recently for its performance. Introducing . . . dspam. Dspam is a command-line utility - it accepts a mail message as a parameter, processes it, and then sends it using the local server's mail submission command. On a Postfix server, this mean the sendmail compatibility command. Amavisd-new currently does not have an interface |
|
Please see the contact page if you have questions or comments about this web site.
|