Install Mailscanner, Spamassassin, ClamAV
Optional Steps is to Install Mailscanner, Spamassassin & ClamAV.
Why we say optional ? because if you follow our guide until "Install Squirellmail" this is mean you already successfully installed postfix with imap and webmail.
So these step below is just an optional steps so if you don't need any spam and antivirus prevention you can skip this steps below.
What is Mailscanner ?
MailScanner is an e-mail security and anti-spam package for e-mail gateway systems. It is not designed to be run on Microsoft Windows desktop PCs. Instead, it is designed to be run on mail servers operated by companies and internet service providers (ISPs) so that all their users and customers can be protected from one place. This avoids the need for any software to be installed on individual desktop PCs at all.
The software works with any Unix-based system and is compatible with a wide range of mail transports. It comes with support for any combination of 25 different virus scanner packages, including the free ClamAV scanner, and its design allows the use of multiple virus scanners in parallel to increase the level of security.
Protection against spam is mostly based on the widely acclaimed SpamAssassin package, which again is free and open source. It is supplemented with fast blacklist lookups that can be used to reject a large proportion of messages with minimal overhead.
Protection against malware is provided by a very wide selection of checks and tests, ranging from simple filename rules to content-based file type detection. It also incorporates one of the most sophisticated phishing detectors available anywhere. Many other checks and tests can also be run against messages, far too many to list here.
MailScanner is highly configurable using a very easy-to-use system of rulesets. Virtually every configuration option can, for example, be controlled on a per-user, per-domain or per-IP basis.
Extract Spamassassin, ClamAV & Mailscanner
cd /root/postfixrocks
tar -zxvf Mail-SpamAssassin-3.3.1.tar.gz
tar -zxvf MailScanner-4.79.11-1.suse.tar.gz
tar -zxvf clamav-0.96.tar.gz
Install Mailscanner
cd MailScanner-4.79.11-1
./install.sh
NOTE :
If you have any problem with the Installation with error like below :
You need to install the patch command from your Linux distribution.
Once you have done that, please try running this script again.
This is mean that your server need patch package installed on it.
below is the steps to install patch.
yast -i patch
Verify All Mailscanner Perl Modules
/usr/sbin/MailScanner -v
you will see a bunch of perl modules there, if few modules missing
you can just install it from perl CPAN.
Click here for How To Install Perl Modules from CPAN
Install Spamassassin
cd /root/postfixrocks/Mail-SpamAssassin-3.3.1
perl Makefile.PL
make && make install
Update Spamassassin SA Rules
sa-update
Create ClamAV User and Group
add clamAV user and group
useradd -u 88 -g 88 clamav -s /bin/false
Install ClamAV
cd /root/postfixrocks/clamav-0.96
./configure
make && make install
Edit freshclam.conf Config file
vi /usr/local/etc/freshclam.conf
# Comment or remove the line below.
#Example
DatabaseOwner clamav
DatabaseDirectory /usr/local/share/clamav
Create freshclam.log and /usr/local/share/clamav directory
touch /var/log/freshclam.log
chown -R clamav:clamav /var/log/freshclam.log
mkdir -p /usr/local/share/clamav
chown -R clamav:clamav /usr/local/share/clamav
Download ClamAV Virus Database
/usr/local/bin/freshclam
crontab -e
37 * * * * /usr/local/bin/freshclam
Starting Up Mailcleaner
/etc/init.d/Mailcleaner start
Note:
Mailcleaner will automatically start|stop with postfix
so we don't need to execute "postfix start|stop" anymore
We also have included all our Mailscanner and freshclam config in our /root/postfixrocks/config directory so you can see all options that we've enabled in our Mailcleaner settings.