Xmail+ClamAV
Guys, I tried integrating Xmail and ClamAV to check viruses. It scans the attached file when I send mails. However, it doesn't scan mails when I receive it. It is also not working when I use the webmail at home. Can anyone help me integrate ClamAV with Xmail better? My idea is:
* To scan mails (sent and received).
* Integrate it with the webmail for scanning
Below are the script I downloaded from the internet. Hope someone out there can help me on this.
anti-virus.sh
#!/bin/bash
##
### Config
##
File=$1
RejFile=$File".rej"
Temp=$File".av"
RemoteAddress=$2
Authuser=$3
timestamp=`date +%s`
date=`date +%Y%m%d000`
nowtime=`date +%r`
ClamAV='clamdscan --no-summary --stdout '
### Doing Stuff
XMail_lines=`cat $File | grep -a -n -m1 "<<MAIL-DATA>>" | awk -F: '{print $1}'`
Total_lines=`cat $File | wc -l | awk '{print $1}'`
Real_lines=$((Total_lines-XMail_lines))
## setup temp file
echo "Return-Path: localhost" > $Temp
tail -n $Real_lines $File >> $Temp
### Run the scan
run=`$ClamAV $Temp`
Found=`echo "$run" | awk '{print $3}'`
Virus=`echo "$run" | awk '{print $2}'`
### Remove Them
rm -f $Temp
### Log
echo "$nowtime $RemoteAddress $Authuser $Virus" >> /var/MailRoot/logs/anti-virus-$date
### Exiting
if [ $Found ]; then
echo "550 Virus : $Virus Found in Email " > $RejFile
exit 3
fi
filters.post-data.tab
"/var/MailRoot/filters/anti-virus.sh" "@@FILE" "@@REMOTEADDR" "@@USERAUTH"
|