How to Install SpamAssassin, MailScanner, ClamAV in CentOS Mail server.

Last modified: July 30, 2020
You are here:
Estimated reading time: 1 min

One of the most important things you can do for your mail server is install MailScanner. It will help detect incoming and outgoing spam. This will prevent your IP from getting blacklisted, keeping the server clean. Installing SpamAssassin and ClamAV will add another layer of defense against these issues.

 

Steps to install SpamAssassin, MailScanner, ClamAV

1)  Install all dependency packages on the server using the below command.

# yum install -y yum-utils gcc cpp perl bzip2 zip unrar make patch automake rpm-build perl-Archive-Zip perl-Filesys-Df perl-OLE-Storage_Lite perl-Sys-Hostname-Long perl-Sys-SigAction perl-Net-CIDR perl-DBI perl-MIME-tools perl-DBD-SQLite binutils glibc-devel perl-Filesys-Df zlib zlib-devel wget mlocate

2) Install ClamAV and SpamAssasin using the following command.

# yum install clamav spamassassin

3) Update ClamAV database using the command.

# freshclam –v

4) Update SpamAssasin.

# sa-update
# service spamassassin start
# chkconfig spamassassin on

 

Configure postfix for Mail scanning

1) To configure postfix mail scanning, header check will help to hold all incoming mails that postfix receives.

Add the line below in postfix configuration file and header_check file.

# vi /etc/postfix/main.cf

header_checks = regexp:/etc/postfix/header_checks

# vi /etc/postfix/header_check

/^Received:/ HOLD

2) For the mail scanner installation first we need to download the packages.

# wget http://www.mailscanner.info/files/4/rpm/MailScanner-4.84.6-1.rpm.tar.gz

3) Extract the file and install the mail scanner using the below commands.

# tar zxvf MailScanner-4.84.6-1.rpm.tar.gz
# cd MailScanner-4.84.6-1
# ./install

4) After installation, create a directory for SpamAssasin and change the ownership to postfix.

# mkdir /var/spool/MailScanner/spamassassin
# chown postfix /var/spool/MailScanner/spamassassin
# chown –R postfix /var/spool/MailScanner/incoming/

5) Configure MailScanner , the configuration file should be similar to the below file.

# Vi  /etc/MailScanner/MailScanner.conf

%org-name% = test CentOS Mail Server

%org-long-name% = ORGFULLNAME

%web-site% = ORG WEBSITE

Rn As User = postfix

Rn As Group = postfix

MTA = postfix

Incoming Queue Dir = /var/spool/postfix/hold

Outgoing Queue Dir = /var/spool/postfix/incoming

Virus Scanners = clamav

## please check /etc/MailScanner/spam.lists.conf for more details ##

Spam List = SBL+XBL

## the directory created earlier ##

SpamAssassin User State Dir = /var/spool/MailScanner/spamassassisin

6) Now we have successfully installed MailScanner. We can check any syntax error in configuration file by using the below command.

# MailScanner –lint

7) Finally, we need to start and enable the mail scanner service.

# service MailScanner start
# chkconfig MailScanner on

8) After installation and configuration, you can verify if the mailscanner is enabled by checking the mail log.

# tailf /var/log/maillog

 

If you need any further help please contact our support department.

Was this article helpful?
Dislike 0
Views: 109