How to Setup Posfix with Amavisd-new, ClamAV, Spam on Plesk & Centos

Posted on May 31, 2013

This guide will help walk you through some of the steps necessary to install Postfix, Amavisd-new, ClamAV, and Spamassassin on Plesk based linux servers. Thanks to

A few quick items before we start:

Part 1: Amavisd-new, ClamAV and Spamassassin installation

Enable the RPMForge Repo

Amavisd-new and ClamAV were installed from the RPMForge repository. To enable the RPMForge repository do the following (this example is for 64bit systems. You will need a different RPM for 32bit systems)

Install amavisd-new, clamav and spamassassin

yum install amavisd-new clamav clamav-devel clamd spamassassin

This will likely also install a bunch of dependencies including various perl modules and archive packages.

Part 2: Amavisd-new Setup

This adds user amavis and add them to clamav group check:

Comment out existing Spamassassin custom headers/header_rewrite as this will be done via Amavisd-new:

Part 3: ClamAV Setup

ClamAV’s configuration is stored in /etc/clamd.conf. We must edit /etc/clamd.conf to tell ClamAV that Amavisd-new will communicate using a local UNIX socket rather than a tcp socket.

Amavisd-new and Clamd Checkup

If all went well, two new users, amavis and clamav should have been installed onto the system:

In addition, the clamav user should automatically have been added to the amavis group:

If not, you can manually add clamav to the amavis group:

Part 3: Amavisd-New Configuration

Part 5: Postfix Configuration

Two important changes here. We need to update Postfix’ master.cf and main.cf files.

Edit Postfix Master.cf

Edit Postfix Main.cf

Now edit the Postfix Main.CF file

Restart Postfix

Check your maillog for success or error messages

Step 6: Testing your Amavisd-new and Postfix setup

At this point it might be wise to test the Amavisd-new and Postfix daemons are listening correctly (see the Testing section below).

Start the clamd and amavisd services:

Is Amavisd Listening

Now test that the amavisd service is listening on 127.0.0.1:10024 using telnet

If everything is working then you should see a successful connection similar to above.

Is Postfix Listening?

Next to test the Postfix smtpd is listening on 127.0.0.1:10025

Step 7: Enable Message Filtering

Once everything is in place and working, the final step is to enable message filtering in Postfix by adding the following setting to /etc/postfix/main.cf:

Now reload postfix

Step 8: Watch your mail logs!

Now that everything is place, let’s tail our maillogs to make sure everything is functioning properly:

I hope this tutorial has been helpful! Please don’t hesitate to let us know if you have any issues

References

Setting up Postfix/Amavisd/Spamassassin – Atomic Rocket Forum
HowTos/Amavisd – Centos Website

Related Posts

Contact Us

Have a question? Send us a message. We'll get back to you soon.

captcha

3 Shares
Share
Share3
Tweet
+1
Pin
Stumble