Installing Mailscanner ClamAv and Spamassassin
In this article we will see how to install a basic system to avoid your system to spread spam, virus and any type of crap to your users.
Since it is what we use, the machine which we are speaking about is a CentOS 4.0 with BlueQuartz control panel, to be honest, the one provided by Nuonce.net.
The installation procedure has been tested several times on different servers, and everything went OK.
The software we installed is MailScanner 4.56 , Spamassassin version 3.1.7 on Perl 5.8.5, ClamAV 0.90RC1.1
Well, let's go on!
To be nice we will download the packages in a brand new directory, let's call it "installation_dir" so that you will always be able to track down the installation process.
Log in to your machine and become root with su command.
Then type the following:cd
Locate the MailScanner package, go to MailScanner site and grab the stable release.wget http://%%%SOMEPATH%%%%%/MailScanner-4.56.8-1.rpm.tar.gz
Then untar it and install the software with the install script provided with the package:tar -xzvf MailScanner-4.53.8-1.rpm.tar.gz
Everything should be ok, let's make some changes to the init scripts:cd /etc/init.d/
mv sendmail sendmail.orig
ln -s MailScanner sendmail
If you runtail -f /var/log/maillog
you should see some mailscanner-related lines of logs
This is the antivirus part of the job. Locate the last package of clamav from the official site, then:yum install gmp-develcd /root/installation_dir/
tar -xzvf clamav-0.90RC1.1.tar.gz
/usr/sbin/useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
To test if everything is ok typeclamscan /root/installation_dir/
You should see something like this:/root/installation_dir/clamav-0.90RC1.1.tar.gz: ClamAV-Test-File FOUND
Now we configure the signature download process:pico /usr/local/etc/freshclam.conf
Here locate the UpdateLogFile directive and uncomment it out. It must look like:UpdateLogFile /var/log/freshclam.log
Now we create the freshclam.log file, setting the right permissionstouch /var/log/freshclam.log
chown clamav /var/log/freshclam.log
chmod 660 /var/log/freshclam.log
By now it is possible to runfreshclam
To install SpamAssassin there are two ways:
1) install it by compiling the tar.gz you can obtain on the official site
2) install it using CPAN
Actually we prefer the second way.. is very easy!
Let's log to CPAN by typing:perl -MCPAN -e shell
If it's the first type you run CPAN the system will ask you a lot of informations... Follow the instructions on screen. When you get the CPAN prompt ( cpan> ) type:install Digest::SHA1
And finally....install Mail::SpamAssassinquit
Then restart sendmail:/etc/init.d/sendmail restart
Now that we have SpamAssassin installed, we can provide to it some additional software, suc as Vipul's Razor. Locate the two tars and download them into the installation dir:cd /root/installation_dir/
Then uncompress and install:tar -jxvf razor-agents-sdk-2.07.tar.bz2
tar -jxvf razor-agents-2.82.tar.bz2
Now that Razor is installed we must run three utilities to make it working:razor-admin -home=/etc/mail/spamassassin/.razor -create
razor-admin -home=/etc/mail/spamassassin/.razor -discover
razor-admin -home=/etc/mail/spamassassin/.razor -register
To install Pyzor locate the tar with the latest version and download it:cd /root/installation_dir/
then uncompress it and proceed to install:tar -jxvf pyzor-0.4.0.tar.bz2
python setup.py build
python setup.py install
python -c 'import gdbm' && echo 'gdbm found'
run the next command to complete pyzor installationpyzor --homedir /etc/mail/spamassassin discover
This is the last step, locate DCC and download it:cd /root/installation_dir/
uncompress it, compile and install it:tar -xzvf dcc.tar.Z
We must now edit the following enabling DCC:pico /etc/mail/spamassassin/v310.pre
Locate the line#loadplugin Mail::SpamAssassin::Plugin::DCC
and uncomment itloadplugin Mail::SpamAssassin::Plugin::DCC
Save the file and that's done
How to test the installation
To test SpamAssassin installation you can copy a complete message into a file on the server:pico /etc/mail/spamassassin/testmsg
Here place a whole message. Test the installation by typing the following:spamassassin -t -D -p /etc/MailScanner/spam.assassin.prefs.conf < /etc/mail/spamassassin/testmsg