The Server Pages

»

TheServerPages Articles

»

Servers

»

CPanel

»

Mail

Installing an E-Mail Virus Scanner

Author: Wojjie     Posted: 2004-05-14     Viewed: 8,671

Note: This how-to only applies to exim installations.

Introduction:

This article is intended to aid people running a CPanel web server to install a mail virus scanner. This mail virus scanner will automatically scan all incomming mail, and remove all attachments that are found to contain a virus. It then inserts a text file into the email, notifying the recipient that a virus was found. Here is an example attachment from an email found to be containing a virus (slightly formated to fit):

This is a message from the MailScanner Virus Protection ... 
-----------------------------------------------------------
The original e-mail attachment "Message.exe" was believed to 
be infected by a virus and has been replaced by this warning 
message.

If you wish to receive a copy of the *infected* attachment, 
please e-mail helpdesk and include the whole of this message
in your request. Alternatively, you can call them, with
the contents of this message to hand when you call.

At Fri May 14 00:42:50 2004 the virus scanner said:
 Message.exe contains Worm.Bagle.Y 
 Executable DOS/Windows programs are dangerous in email
	 (Message.exe)
 No programs allowed (Message.exe)

Note to Help Desk: Look on the MailScanner in 
	/var/spool/MailScanner/quarantine/20040514
	(message #@@@@@-####@@-@@).
-- 
Postmaster
Mailscanner thanks transtec Computers for their support
Links Required:
- CPanel: Layer 1 Downloads

- ClamAV (Virus Scanner)

Instructions:

These instruction will tell you how to install the MailScanner with the newest version of ClamAV:


1. Download the "Latest MailScanner installer" from the CPanel: Layer 1 Downloads link.

2. Extract the MailScanner on the server.

Ex:
tar -xzvf mailscanner-autoinstall-1.5.tar.gz

3. Download the latest ClamAV (Virus Scanner) into the directory that was created during the extraction process.

Ie:
mailscanner-autoinstall-1.5/

4. Open the file 'claminstall' in your favorite editor, and find all lines with 'clamav-[old version]' in it. Change these lines to have the new version number you just downloaded from ClamAV.

Ex: (slightly modified to fit)
I downloaded clamav-0.70, so I would make the follow modifications:

Old file
#!/bin/sh

/scripts/adduser clamav /usr/local 0
chsh -s /bin/false clamav
if [ -e "/usr/sbin/pw" ]; then
        /usr/sbin/pw lock clamav
else
        passwd -l clamav
fi
tar xfzv clamav-0.60.tar.gz
(cd clamav-0.60;./configure --prefix=/usr  \
	--sysconfdir=/etc;make;make install)

echo "clamav.cpanel.net" > /usr/share/clamav/mirrors.pre
cat /usr/share/clamav/mirrors.txt >> /usr/share/clamav/mirrors.pre
mv -vf /usr/share/clamav/mirrors.pre /usr/share/clamav/mirrors.txt

touch /var/log/clam-update.log
chmod 600 /var/log/clam-update.log
chown clamav /var/log/clam-update.log

(cd /usr/local/bin;ln -s ../../bin/freshclam)

/usr/bin/freshclam
New (modified) file
#!/bin/sh

/scripts/adduser clamav /usr/local 0
chsh -s /bin/false clamav
if [ -e "/usr/sbin/pw" ]; then
        /usr/sbin/pw lock clamav
else
        passwd -l clamav
fi
tar xfzv clamav-0.70.tar.gz
(cd clamav-0.70;./configure --prefix=/usr  \ 
	--sysconfdir=/etc;make;make install)

echo "clamav.cpanel.net" > /usr/share/clamav/mirrors.pre
cat /usr/share/clamav/mirrors.txt >> /usr/share/clamav/mirrors.pre
mv -vf /usr/share/clamav/mirrors.pre /usr/share/clamav/mirrors.txt

touch /var/log/clam-update.log
chmod 600 /var/log/clam-update.log
chown clamav /var/log/clam-update.log

(cd /usr/local/bin;ln -s ../../bin/freshclam)

/usr/bin/freshclam

5. Now run './install', and after it is done installing, you are done.


Comments

Copyright © 2004-2015: TheServerPages.com