Difference between revisions of "Clamav"

From CBLFS
Jump to navigationJump to search
(Editing the freshclam.conf file)
(Editing the clamd.conf file)
Line 105: Line 105:
 
Edit the /etc/clamd.conf and remove or comment the line where "Example" is writed.
 
Edit the /etc/clamd.conf and remove or comment the line where "Example" is writed.
 
If using /usr/share/clamav folder, then make sure to uncomment <b>DatabaseDirectory</b> and change the entry to read <b>/usr/share/clamav</b>
 
If using /usr/share/clamav folder, then make sure to uncomment <b>DatabaseDirectory</b> and change the entry to read <b>/usr/share/clamav</b>
 +
It should look like:
 +
 +
''DatabaseDirectory /usr/share/clamav''
  
 
=== Editing the freshclam.conf file ===
 
=== Editing the freshclam.conf file ===

Revision as of 21:18, 11 November 2008

Download Source: http://downloads.sourceforge.net/clamav/clamav-0.96.tar.gz
Download Main Virus Database: http://db.local.clamav.net/main.cvd
Download Daily Virus Database: http://db.local.clamav.net/daily.cvd

Introduction to Clamav

Clam AntiVirus is an open source (GPL) anti-virus toolkit for UNIX, designed especially for e-mail scanning on mail gateways.

Project Homepage: http://www.clamav.org/


Dependencies

Optional

Creating the clamav User & Group

groupadd -g 36 clamav &&
useradd -c "Clam AntiVirus Daemon" -d /dev/null \
       -u 36 -g clamav -s /bin/false clamav

Non-Multilib

Compile the package:

./configure --prefix=/usr --sysconfdir=/etc \
     --with-zlib=/usr --with-dbdir=/var/lib/clamav &&
make

Install the package:

make install

Multilib

32Bit

Compile the package:

CC="gcc ${BUILD32}" ./configure --prefix=/usr --sysconfdir=/etc \
     --with-zlib=/usr --with-dbdir=/usr/share/clamav &&
make

Install the package:

make install &&
mv -v /usr/bin/clamav-config{,-32}

N32

Compile the package:

To do ...

Install the package:

To do ...

64Bit

Compile the package:

CC="gcc ${BUILD64}" ./configure --prefix=/usr --sysconfdir=/etc \
     --with-zlib=/usr --with-dbdir=/usr/share/clamav &&
make

Install the package:

make install &&
mv -v /usr/bin/clamav-config{,-64}
ln -svf /usr/bin/clamav-config multiarch_wrapper

Configuring

Install the virus database files

mkdir -v /usr/share/clamav &&
wget -P /usr/share/clamav -c http://db.local.clamav.net/{daily,main}.cvd &&
chown -vR clamav:clamav /usr/share/clamav && 
chmod -vR 600 /usr/share/clamav/{main,daily}.cvd 

OR

mkdir -v /usr/share/clamav && 
cd -v /folder/I/downloaded/main.cvd/and/daily.cvd/in &&
install {main,daily}.cvd /usr/share/clamav &&
chown -vR clamav:clamav /usr/share/clamav && 
chmod -vR 600 /usr/share/clamav/{main,daily}.cvd

Editing the clamd.conf file

Edit the /etc/clamd.conf and remove or comment the line where "Example" is writed. If using /usr/share/clamav folder, then make sure to uncomment DatabaseDirectory and change the entry to read /usr/share/clamav It should look like:

DatabaseDirectory /usr/share/clamav

Editing the freshclam.conf file

Edit the /etc/freshclam.conf file and remove or comment the line where "Example" is writed.

Edit the DatabaseDirectory to say where freschlam must find the virus databases following :

DatabaseDirectory /var/lib/clamav

OR

DatabaseDirectory /usr/share/clamav

Creating the freshclam.log file

This file is necessary for updating the virus databases, create it and change permissions following :

touch /var/log/freshclam.log &&
chmod 600 /var/log/freshclam.log &&
chown clamav /var/log/freshclam.log

Bootscript

Create the bootscript:

cat > /etc/rc.d/init.d/clamav << "EOF"
#!/bin/sh
# Begin $rc_base/init.d/clamav

. /etc/sysconfig/rc
. ${rc_functions}

case "${1}" in
        start)
                boot_mesg "Starting ClamAV Daemon..."
                loadproc /usr/sbin/clamd
                ;;

        stop)
                boot_mesg "Stopping ClamAV Daemon..."
                killproc /usr/sbin/clamd
                ;;

        restart)
                ${0} stop
                sleep 1
                ${0} start
                ;;

        status)
                statusproc /usr/sbin/clamd
                ;;

        *)
                echo "Usage: ${0} {start|stop|restart|status}"
                exit 1
                ;;
esac

# End $rc_base/init.d/clamav
EOF
chmod -v 754 /etc/rc.d/init.d/clamav

Link it into the runlevels:

for link in /etc/rc.d/rc{{0,1,6}.d/K32,{2,3,4,5}.d/S18}clamav; do
  ln -sfv ../init.d/clamav $link;
done

Contents

Installed Directories: /var/lib/clamav
Installed Programs: clamscan, clamd, freshclam, sigtool, clamconf, clamav-config
Installed Libraries: libclamunrar.{a,la,so}, libclamunrar_iface.{a,la,so}, libclamav.{a,la,so}