December 18, 2009

Installing ClamAV with MailScanner

Installing ClamAV is fairly straightforward*:

* If you would like to verify ClamAV's digital signatures on the virus definition files as they are updated through freshclam, you need to install GMP first:
/scripts/ensurerpm gmp gmp-devel
* Next you will need to create a user for clamav to use:
useradd clamav
Some OS's require you to add the group as well:
groupadd clamav
Don't worry if the user and/or group already exist.
* Download the latest stable ClamAV distribution from http://www.clamav.net
* Expand the distribution and cd into the resultant directory and build ClamAV using:
tar -xzf clamav-*
cd clamav*
./configure
make
make install
* Comment out the line (put a # as the first character on the line) near the top that says simply:
pico -w /usr/local/etc/freshclam.conf
Example
* Comment out the line (put a # as the first character on the line) near the top that says simply:
pico -w /usr/local/etc/clamd.conf
Example
* Run freshclam to download the latest definitions:
freshclam
* Create an empty log file for clamav updates:
touch /var/log/clam-update.log
chown clamav:clamav /var/log/clam-update.log
* At this point you can setup ClamAV only in:
pico -w /usr/mailscanner/etc/MailScanner.conf
Virus Scanners = clamav
* Then restart MailScanner with:
service MailScanner restart
* Or you can install the more efficient Mail::ClamAV module. You'll need to install some perl modules first (all on one line):
/scripts/perlinstaller --force Compress::Raw::Zlib
/scripts/perlinstaller --force Scalar::Util Net::CIDR Archive::Zip Compress::Zlib Convert::BinHex Inline::C Time::HiRes Digest::SHA1 IO::Zlib Net::IP
* Then install the ClamAV perl module:
/scripts/perlinstaller --force Mail::ClamAV
* Then setup clamavmodule:
pico -w /usr/mailscanner/etc/MailScanner.conf
Virus Scanners = clamavmodule
* Then restart MailScanner with:
service MailScanner restart
* You can now set what domains you want scanned for viruses in:
/usr/mailscanner/etc/rules/virus.scanning.rules

That's it. If you don't feel confident doing any of this yourself, or if you get into a horrible mess, we offer a cheap package to do it all for you, and more, over here.

*Remember that adding virus scanning of emails to MailScanner will add load to your server.

No comments:

Post a Comment