Setup squidclamav CentOS 6


I. Install ClamAV
# yum --enablerepo=rpmforge -y install clamav
# vi /etc/freshclam.conf
Line 122: make it comment

NotifyClamd /etc/clamd.conf

-Update clamav
# freshclam


-Test download virus example & test scan:
# wget http://www.eicar.org/download/eicar.com
# clamscan --infected --remove --recursive .

II. Install clamd
# yum --enablerepo=rpmforge -y install clamd
# /etc/rc.d/init.d/clamd start
# chkconfig clamd on
III.Install c-icap
# cd /opt
# wget http://sourceforge.net/projects/c-icap/files/c-icap/0.1.x/c_icap-0.1.7.tar.gz/download
# tar zxvf c_icap-0.1.7.tar.gz
# cd c_icap-0.1.7
# ./configure
# make
# make install
# cd
# cp /usr/local/etc/c-icap.conf /etc/
# vi /etc/c-icap.conf
Line 140: change admin address

ServerAdmin root@localhost

Line 149: change to your server name

ServerName cumi.bachem.local

Line 497: add

Service squidclamav squidclamav.so

-Create init script
# vi /etc/rc.d/init.d/c-icap

#!/bin/bash

# c-icap: Start/Stop c-icap
# chkconfig: - 70 30
# description: c-icap is an implementation of an ICAP server.
# processname: c-icap
# pidfile: /var/run/c-icap/c-icap.pid

. /etc/rc.d/init.d/functions
. /etc/sysconfig/network

CONFIG_FILE=/etc/c-icap.conf
PID_DIR=/var/run/c-icap

RETVAL=0
start() {
echo -n $"Starting c-icap: "
daemon /usr/local/bin/c-icap -f $CONFIG_FILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/c-icap
return $RETVAL
}
stop() {
echo -n $"Stopping c-icap: "
killproc c-icap
rm -f /var/run/c-icap/c-icap.ctl
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $PID_DIR/c-icap.pid /var/lock/subsys/c-icap
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status c-icap
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit $?

# chmod 755 /etc/rc.d/init.d/c-icap
IV. Install SquidClamav
Download latest version of it from the following link : http://sourceforge.net/projects/squidclamav/files/squidclamav/

# wget http://sourceforge.net/projects/squidclamav/files/squidclamav/6.10/squidclamav-6.10.tar.gz/download
# tar zxfv squidclamav-6.10.tar.gz
# cd squidclamav-6.10
# ./configure
# make
# make install
# cd
# vi /etc/squidclamav.conf

Line 17: change( destination URL for redirect. Create it first )

redirect http://cumi.bachem.local/cgi-bin/clwarn.cgi

Line 26: add (same with clamd)

clamd_local /var/run/clamav/clamd.sock

-Start c-icap service & setup start on boot
# /etc/rc.d/init.d/c-icap start
# chkconfig --add c-icap
# chkconfig c-icap on

VI. Testing
Try to access to a page that has trial virus from here http://eicar.org/85-0-Download.html
Click ‘eicar.com’ and try to download it. Then, the error page that is set in the config of squidclamav. Virus is blocked normally.


1 thought on “Setup squidclamav CentOS 6

  1. 86Fredericka

    I have noticed you don’t monetize your page, don’t
    waste your traffic, you can earn extra bucks every month because you’ve got high quality content.
    If you want to know how to make extra bucks, search for: best adsense alternative Wrastain’s tools

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *