- ClamAV can be found in the apt repository. Run this command to install ClamAV: apt-get install clamav. If you need clamd, you may also want to run: apt-get install clamav-daemon. For the stable release, the packages are updated via the StableUpdates mechanism.
- Not compatible with ClamAV JIT. It is recommended to either compile ClamAV JIT with clang or to compile ClamAV without JIT. A supported CPU for the JIT, either of: X86, X86-64, PowerPC, PowerPC64 The following packages are optional, but needed for the JIT unit tests: GNU Make (version 3.79, recommended 3.81).
Clam AntiVirus (ClamAV) is a free, cross-platform antivirus tool-kit able to detect many types of malicious software, including viruses. One of its main uses is on mailservers as a server-side email virus scanner. The application was developed for Unix and has third party versions available for AIX, BSD, HP-UX, LINUX, MAC OS X, openVMS, OSF (Tru64) and Solaris.Here in this section we will try to automate the entire Process of clamAv using cronjob.We are using Red-hat enterprises Linux platform to test this.
Step 1: Install ClamAV
How to compile clamav 0.98.3. Server hangs on reboot when clam is running. Updating ClamAV 0.98.7 to 0.99.0 for Ubuntu 12.04 LTS. How To Update ClamAV Installation? Hot Network Questions Is 'one' unnecessary in this quote of Melville? Is it illegal to restore a car in my own driveway?
We can use yum command to install clamav in the server.
# yum install clamav clamav-db clamd
Try to start the clamav by typing the command below.
Clamav Windows
# /etc/init.d/clamd start
This automatically sets up a daily cron job which runs fresh clam to update virus definitions.
Step 2 : Create new cron jobs to run daily virus scans
First we need to create a file clamscan_daily in cron.daily folder.It will help us to paste our script in this file,all the files or scripts in this folder will run automatically daily.
Clamav For Linux
Create a clamscan_daily file in the folder cron.daily
#vi /etc/cron.daily/clamscan_daily
Paste the below script in the file and save.
#!/bin/bash
# email subject
SUBJECT='VIRUS DETECTED ON `hostname`!!!'
# Email To ?
EMAIL='alert@domain.com'
# Log location
LOG=/var/log/clamav/scan.log
check_scan () {
# Check the last set of results. If there are any 'Infected' counts that aren't zero, we have a problem.
if [ `tail -n 12 ${LOG} | grep Infected | grep -v 0 | wc -l` != 0 ]
then
EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
# Email To ?
EMAIL='alert@domain.com'
# Log location
LOG=/var/log/clamav/scan.log
check_scan () {
# Check the last set of results. If there are any 'Infected' counts that aren't zero, we have a problem.
if [ `tail -n 12 ${LOG} | grep Infected | grep -v 0 | wc -l` != 0 ]
then
EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
echo 'To: ${EMAIL}' >> ${EMAILMESSAGE}
echo 'From: alert@domain.com' >> ${EMAILMESSAGE}
echo 'Subject: ${SUBJECT}' >> ${EMAILMESSAGE}
Compile Clamav For Mac Installer
echo 'Importance: High' >> ${EMAILMESSAGE}
echo 'X-Priority: 1' >> ${EMAILMESSAGE}
echo '`tail -n 50 ${LOG}`' >> ${EMAILMESSAGE}
sendmail -t < ${EMAILMESSAGE}
fi
}
clamscan -r / –exclude-dir=/sys/ –quiet –infected log=${LOG}
Step 3 : set-up proper permission to the file
#chmod +x /etc/cron.hourly/clamscan_hourly
This steps will help to setup automation of clamav in the server and reports are send directly to the email given in the script.
If you require help, contact SupportPRO Server Admin