LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-18-2006, 07:17 PM   #1
depam
Member
 
Registered: Sep 2005
Posts: 861

Rep: Reputation: 30
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"
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xmail and SpamAssassin depam Linux - Software 1 12-10-2005 07:03 PM
Xmail jagster Linux - Software 0 11-08-2005 04:26 PM
Xmail localhost jagster Linux - Networking 1 11-08-2005 03:25 PM
Apache/XMail OpsVentus Linux - Security 1 07-17-2004 12:55 PM
XMail problem OpsVentus Linux - Software 0 05-16-2004 07:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration