DirectAdmin Forums

Go Back   DirectAdmin Forums > Modifications / Add-ons > How-To Guides

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2006, 08:39 AM
hci hci is offline
Verified User
 
Join Date: Jun 2004
Posts: 217
ClamAV Antivirus HOWTO

This is an update to the how to on adding ClamAV to your DA server using rpm's. The original was close to 2 years old and did not work without changes when I added ClamAV to a new server.

The original is located here for reference:
http://www.directadmin.com/forum/sho...&threadid=3860

This is a very basic how to on adding support for ClamAV to your Directadmin server. It simply rejects all messages containing viruses. Please do not try this on a production box unless you are sure you know what you are doing and do it at your own risk. Your Directadmin box must be running Exiscan patch which all new DA releases are AFAIK. I am running on CentOS 4.2 so if you are not it could go differently.

This is based on info from here:

http://www.timj.co.uk/linux/exim.php

SSH into your box as root.

cd /var/tmp

Now we must download and install ClamAV and Clamd.

www.clamav.net or various Fedora rpm's:
http://crash.fce.vutbr.cz/crash-hat/

Since I was running CentOS 4.2 and it based on Fedora Core 3

wget http://crash.fce.vutbr.cz/crash-hat/....88-1.i386.rpm
wget http://crash.fce.vutbr.cz/crash-hat/....88-1.i386.rpm

rpm -Uvh clamav-0.88-1.i386.rpm
rpm -Uvh clamav-server-0.88-1.i386.rpm

Now add a cronjob to keep ClamAV up to date.

export EDITOR=nano

crontab -e

Add an entry to your crontab as follows:

46 * * * * /usr/bin/freshclam --quiet

Change 46 to a random number between 1-60 to be considerate to server load.

Alt-X to save and exit.

Next type:

clamd start
chkconfig clamd on
freshclam

This should start clamd and bring your virus signatures up to date.

Now we need to edit exim.conf. The -w turns off wordwrap in nano.

nano -w /etc/exim.conf

At the end of comments section add this:

av_scanner = clamd:127.0.0.1 3310

Type in Ctrl-W and search for the second instance of check_message

Change:

# ACL that is used after the DATA command
check_message:
accept

To this:

# ACL that is used after the DATA command
check_message:
# Virus Check
deny message = This message contains a virus or other malware ($malware_name)
demime = *
malware = *
accept

Do a Ctrl-X and save.

Now restart Exim

/etc/init.d/exim restart

Does it work? It should refuse all virus infected messages. Test it extensively before trusting it. Also, occasionally the ClamAV software may need updated so log in and do a freshclam to see all is ok once in a while. Unlike Mailscanner this rejects infected messages before accepting them. If you cannot get this to work please post here so someone may help you.

Matthew

Last edited by hci; 02-22-2006 at 08:20 AM.
Reply With Quote
  #2  
Old 02-17-2006, 01:52 PM
jlasman's Avatar
jlasman jlasman is offline
NoBaloney
 
Join Date: Jun 2003
Location: Riverside, Calif., USA
Posts: 20,706
A thousand thanks, Matthew.

I've moved the thread; it's really a HowTo.

(Don't worry; your link still works.)

This looks like a good addition to the official SpamBlocker script.

Please everyone keep this thread updated so we can make sure it works. Unless we get some bad reviews it's going into the next SpamBlocker in a week .

Jeff
__________________

Jeff Lasman <directadmin@nobaloney.net> +1 951 643-5345
Third-Party DirectAdmin administration and support
Dedicated Servers, Dedicated Reseller Accounts
NoBaloney Internet Services
P.O. Box 52200
Riverside, Calif. 92517
Reply With Quote
  #3  
Old 02-17-2006, 02:46 PM
ZPillay ZPillay is offline
Verified User
 
Join Date: Feb 2006
Location: Rotterdam, Netherlands
Posts: 10
Starting exim: 2006-02-18 00:35:53 Exim configuration error in line 558 of /etc/exim.conf:
error in ACL: unknown ACL condition/modifier in "demime = *"


I get that error...
Using DA 1.262 with exim on CentOS 4.2

everything went fine till there

You know what could have caused this?
Reply With Quote
  #4  
Old 02-17-2006, 03:11 PM
hci hci is offline
Verified User
 
Join Date: Jun 2004
Posts: 217
Quote:
error in ACL: unknown ACL condition/modifier in "demime = *"

Look here.

http://www.directadmin.com/forum/sho...0202#post50202

My DA was a fresh install. Is yours maybe a little older and had Exim compiled differently?

Matthew
Reply With Quote
  #5  
Old 02-17-2006, 05:45 PM
hostpc.com's Avatar
hostpc.com hostpc.com is offline
Verified User
 
Join Date: Aug 2003
Location: Schenectady, NY
Posts: 1,181
Anyone who has converted to dovecot will need to re-patch for that ... otherwise, it works fine.

Joe
__________________
Joseph Mack http://www.hostpc.com Since November 1998
DirectAdmin Hosting and Dedicated Servers Since August 2003
Reply With Quote
  #6  
Old 02-20-2006, 01:53 AM
@how@'s Avatar
@how@ @how@ is offline
Verified User
 
Join Date: Mar 2005
Location: Kingdom of Bahrain
Posts: 860
Thumbs up

Thanks, work fine



Wael
__________________


Web for host serving the web since 2004


((( update.script ))) help you to upgrade

OpenSSL / Exim / OpenSSH / ProFTP / phpMyAdmin / MySQL / SquirrelMail
AVG Anti-Virus / Clam Anti-Virus / MODclamAV / MRTG / SpamAssassin / IMAP
SquirrelMail / MODsecurity / MODsecurity Rules / MODevasive / MailScanner
KISS My Firewall / eAccelerator / Freetype / Control panel Webmin

Reply With Quote
  #7  
Old 02-21-2006, 11:36 AM
getUP getUP is offline
Verified User
 
Join Date: Sep 2005
Posts: 296
You mean like some months old, heh. Been working fine for ages now.

http://www.directadmin.com/forum/sho...threadid=10478
Reply With Quote
  #8  
Old 02-21-2006, 11:56 AM
@how@'s Avatar
@how@ @how@ is offline
Verified User
 
Join Date: Mar 2005
Location: Kingdom of Bahrain
Posts: 860
Quote:
Originally posted by getUP
You mean like some months old, heh. Been working fine for ages now.

http://www.directadmin.com/forum/sho...threadid=10478
Yes
http://www.directadmin.com/forum/sho...threadid=10478
work fine with me tested in 5 server



Wael
__________________


Web for host serving the web since 2004


((( update.script ))) help you to upgrade

OpenSSL / Exim / OpenSSH / ProFTP / phpMyAdmin / MySQL / SquirrelMail
AVG Anti-Virus / Clam Anti-Virus / MODclamAV / MRTG / SpamAssassin / IMAP
SquirrelMail / MODsecurity / MODsecurity Rules / MODevasive / MailScanner
KISS My Firewall / eAccelerator / Freetype / Control panel Webmin

Reply With Quote
  #9  
Old 02-21-2006, 01:30 PM
getUP getUP is offline
Verified User
 
Join Date: Sep 2005
Posts: 296
Besides, I'm pretty sure my howto covers other OS' as well, instead of the RPM based systems only.
Reply With Quote
  #10  
Old 02-22-2006, 08:52 AM
hci hci is offline
Verified User
 
Join Date: Jun 2004
Posts: 217
Quote:
You mean like some months old, heh. Been working fine for ages now.

http://www.directadmin.com/forum/sho...threadid=10478
Actually I was referring to this how to.

http://www.directadmin.com/forum/sho...&threadid=3860

Yours is a source install. I prefer rpm's. Rpm's also make it easier in my opinion to upgrade when a new version comes along. But rpm's just won't work for some and some people would just rather use source. Your how to would be better for them. Now there are both options. ;<)

Matthew
Reply With Quote
  #11  
Old 02-26-2006, 08:38 AM
Remco00 Remco00 is offline
Verified User
 
Join Date: Feb 2006
Posts: 133
error

I get this:

[root@s01 tmp]# ls
clamav-0.88-1.i386.rpm clamav-server-0.88-1.i386.rpm
[root@s01 tmp]# rpm -Uvh clamav-0.88-1.i386.rpm
warning: clamav-0.88-1.i386.rpm: V3 DSA signature: NOKEY, key ID 6cdf2cc1
error: Failed dependencies:
curl is needed by clamav-0.88-1.i386
libcurl.so.3 is needed by clamav-0.88-1.i386
libidn is needed by clamav-0.88-1.i386
libidn.so.11 is needed by clamav-0.88-1.i386
[root@s01 tmp]# ls
clamav-0.88-1.i386.rpm clamav-server-0.88-1.i386.rpm
[root@s01 tmp]# rpm -Uvh clamav-server-0.88-1.i386.rpm
warning: clamav-server-0.88-1.i386.rpm: V3 DSA signature: NOKEY, key ID 6cdf2cc1
error: Failed dependencies:
clamav = 97:0.88-1 is needed by clamav-server-0.88-1.i386
libclamav.so.1 is needed by clamav-server-0.88-1.i386
libcurl.so.3 is needed by clamav-server-0.88-1.i386
libidn.so.11 is needed by clamav-server-0.88-1.i386
[root@s01 tmp]# clamd start
-bash: clamd: command not found
[root@s01 tmp]#
Reply With Quote
  #12  
Old 02-26-2006, 10:13 AM
hci hci is offline
Verified User
 
Join Date: Jun 2004
Posts: 217
Quote:
I get this:

error: Failed dependencies:
curl is needed by clamav-0.88-1.i386
libcurl.so.3 is needed by clamav-0.88-1.i386
libidn is needed by clamav-0.88-1.i386
libidn.so.11 is needed by clamav-0.88-1.i386
Are you running CentOS 4.2 or what?

libidn is on the rpm's CD with CentOS 4.2.
/centos42_rpms/libidn-0.5.6-1.i386.rpm
/centos42_rpms/libidn-devel-0.5.6-1.i386.rpm

Use rpmfind.net to find and nab the others. Whats strange is I do not recall having any troubles with dependancies.

Matthew
Reply With Quote
  #13  
Old 02-26-2006, 10:17 AM
Remco00 Remco00 is offline
Verified User
 
Join Date: Feb 2006
Posts: 133
Matthew, I run Fedora 3 and read in this forum that making a source would be the solution but don't have a clue...
Reply With Quote
  #14  
Old 02-26-2006, 10:57 AM
hci hci is offline
Verified User
 
Join Date: Jun 2004
Posts: 217
Try:

cd /var/tmp

wget http://wuarchive.wustl.edu/pub/cento...rhel4.i386.rpm
wget http://wuarchive.wustl.edu/pub/cento...rhel4.i386.rpm
wget http://wuarchive.wustl.edu/pub/cento...5.6-1.i386.rpm
wget http://wuarchive.wustl.edu/pub/cento...5.6-1.i386.rpm

rpm -Uvh them all. What do you get?

Matthew
Reply With Quote
  #15  
Old 02-26-2006, 01:32 PM
Remco00 Remco00 is offline
Verified User
 
Join Date: Feb 2006
Posts: 133
Mattew, what are those files? Can I just rpm them without risk?
Reply With Quote
  #16  
Old 03-07-2006, 10:37 AM
@how@'s Avatar
@how@ @how@ is offline
Verified User
 
Join Date: Mar 2005
Location: Kingdom of Bahrain
Posts: 860
Re: error

Quote:
Originally posted by Remco00
I get this:

[root@s01 tmp]# ls
clamav-0.88-1.i386.rpm clamav-server-0.88-1.i386.rpm
[root@s01 tmp]# rpm -Uvh clamav-0.88-1.i386.rpm
warning: clamav-0.88-1.i386.rpm: V3 DSA signature: NOKEY, key ID 6cdf2cc1
error: Failed dependencies:
curl is needed by clamav-0.88-1.i386
libcurl.so.3 is needed by clamav-0.88-1.i386
libidn is needed by clamav-0.88-1.i386
libidn.so.11 is needed by clamav-0.88-1.i386
[root@s01 tmp]# ls
clamav-0.88-1.i386.rpm clamav-server-0.88-1.i386.rpm
[root@s01 tmp]# rpm -Uvh clamav-server-0.88-1.i386.rpm
warning: clamav-server-0.88-1.i386.rpm: V3 DSA signature: NOKEY, key ID 6cdf2cc1
error: Failed dependencies:
clamav = 97:0.88-1 is needed by clamav-server-0.88-1.i386
libclamav.so.1 is needed by clamav-server-0.88-1.i386
libcurl.so.3 is needed by clamav-server-0.88-1.i386
libidn.so.11 is needed by clamav-server-0.88-1.i386
[root@s01 tmp]# clamd start
-bash: clamd: command not found
[root@s01 tmp]#
update your OS then run RPM, all work fine 100%

Wael
__________________


Web for host serving the web since 2004


((( update.script ))) help you to upgrade

OpenSSL / Exim / OpenSSH / ProFTP / phpMyAdmin / MySQL / SquirrelMail
AVG Anti-Virus / Clam Anti-Virus / MODclamAV / MRTG / SpamAssassin / IMAP
SquirrelMail / MODsecurity / MODsecurity Rules / MODevasive / MailScanner
KISS My Firewall / eAccelerator / Freetype / Control panel Webmin

Reply With Quote
  #17  
Old 03-24-2006, 08:01 AM
Jinson Jinson is offline
Verified User
 
Join Date: Mar 2006
Posts: 24
Re: ClamAV Antivirus HOWTO

It worked beautifully, hci. Thanks alot!

Am also running CentOS here. Version 4.3.



Quote:
Originally posted by hci
This is an update to the how to on adding ClamAV to your DA server using rpm's. The original was close to 2 years old and did not work without changes when I added ClamAV to a new server.

The original is located here for reference:
http://www.directadmin.com/forum/sho...&threadid=3860

This is a very basic how to on adding support for ClamAV to your Directadmin server. It simply rejects all messages containing viruses. Please do not try this on a production box unless you are sure you know what you are doing and do it at your own risk. Your Directadmin box must be running Exiscan patch which all new DA releases are AFAIK. I am running on CentOS 4.2 so if you are not it could go differently.

This is based on info from here:

http://www.timj.co.uk/linux/exim.php

SSH into your box as root.

cd /var/tmp

Now we must download and install ClamAV and Clamd.

www.clamav.net or various Fedora rpm's:
http://crash.fce.vutbr.cz/crash-hat/

Since I was running CentOS 4.2 and it based on Fedora Core 3

wget http://crash.fce.vutbr.cz/crash-hat/....88-1.i386.rpm
wget http://crash.fce.vutbr.cz/crash-hat/....88-1.i386.rpm

rpm -Uvh clamav-0.88-1.i386.rpm
rpm -Uvh clamav-server-0.88-1.i386.rpm

Now add a cronjob to keep ClamAV up to date.

export EDITOR=nano

crontab -e

Add an entry to your crontab as follows:

46 * * * * /usr/bin/freshclam --quiet

Change 46 to a random number between 1-60 to be considerate to server load.

Alt-X to save and exit.

Next type:

clamd start
chkconfig clamd on
freshclam

This should start clamd and bring your virus signatures up to date.

Now we need to edit exim.conf. The -w turns off wordwrap in nano.

nano -w /etc/exim.conf

At the end of comments section add this:

av_scanner = clamd:127.0.0.1 3310

Type in Ctrl-W and search for the second instance of check_message

Change:

# ACL that is used after the DATA command
check_message:
accept

To this:

# ACL that is used after the DATA command
check_message:
# Virus Check
deny message = This message contains a virus or other malware ($malware_name)
demime = *
malware = *
accept

Do a Ctrl-X and save.

Now restart Exim

/etc/init.d/exim restart

Does it work? It should refuse all virus infected messages. Test it extensively before trusting it. Also, occasionally the ClamAV software may need updated so log in and do a freshclam to see all is ok once in a while. Unlike Mailscanner this rejects infected messages before accepting them. If you cannot get this to work please post here so someone may help you.

Matthew
Reply With Quote
  #18  
Old 04-07-2006, 04:14 AM
@how@'s Avatar
@how@ @how@ is offline
Verified User
 
Join Date: Mar 2005
Location: Kingdom of Bahrain
Posts: 860
you need new rpm your rpm old
Latest ClamAV stable release is: 0.88.1
http://www.clamav.net/


Wael
__________________


Web for host serving the web since 2004


((( update.script ))) help you to upgrade

OpenSSL / Exim / OpenSSH / ProFTP / phpMyAdmin / MySQL / SquirrelMail
AVG Anti-Virus / Clam Anti-Virus / MODclamAV / MRTG / SpamAssassin / IMAP
SquirrelMail / MODsecurity / MODsecurity Rules / MODevasive / MailScanner
KISS My Firewall / eAccelerator / Freetype / Control panel Webmin

Reply With Quote
  #19  
Old 04-20-2006, 05:50 AM
Alrik Alrik is offline
Verified User
 
Join Date: Apr 2006
Posts: 35
i get

error: Failed dependencies:
zlib >= 1.2.1.2 is needed by clamav-0.88.1-1


by default da comes with 1.2.2 right?
Reply With Quote
  #20  
Old 04-20-2006, 06:26 AM
viki viki is offline
Verified User
 
Join Date: Mar 2006
Location: Poland
Posts: 25
0.88-1 not working

I got sutch errors,
What is strange, I didn't have this on prevous version 0.88

Any one has simillar problems?
Webpage with source is down.
Internal Error 500 ;((



# rpm -Uvh clamav-0.88.1-1.i386.rpm
warning: clamav-0.88.1-1.i386.rpm: V3 DSA signature: NOKEY, key ID 6cdf2cc1
error: Failed dependencies:
libcrypto.so.5 is needed by clamav-0.88.1-1.i386
libkrb5support.so.0 is needed by clamav-0.88.1-1.i386
libssl.so.5 is needed by clamav-0.88.1-1.i386


# rpm -Uvh clamav-server-0.88.1-1.i386.rpm
warning: clamav-server-0.88.1-1.i386.rpm: V3 DSA signature: NOKEY, key ID 6cdf2cc1
error: Failed dependencies:
clamav = 102:0.88.1-1 is needed by clamav-server-0.88.1-1.i386
libclamav.so.1 is needed by clamav-server-0.88.1-1.i386
libcrypto.so.5 is needed by clamav-server-0.88.1-1.i386
libkrb5support.so.0 is needed by clamav-server-0.88.1-1.i386
libssl.so.5 is needed by clamav-server-0.88.1-1.i386


I check for kerberos and lib ssl:

# rpm -qa | grep ssl
openssl-0.9.7a-43.8
openssl-devel-0.9.7a-43.8
xmlsec1-openssl-1.2.6-3

# rpm -qa | grep krb
pam_krb5-2.1.8-1
krb5-libs-1.3.4-27
krb5-workstation-1.3.4-27
krb5-devel-1.3.4-27
krbafs-1.2.2-6
krbafs-devel-1.2.2-6


Must be some RPM error.
I'am running on CentOS4.3 fresh with all updates.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:39 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
DirectAdmin © 2007 JBMC Software