LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-22-2006, 06:03 AM   #1
juniox
Member
 
Registered: Apr 2003
Posts: 34

Rep: Reputation: 15
using clamav on email server


hi all.
i´m using debian, clamav, procmail, spamassassin and exim4.

the users has being received too much virus and i need to block it...

but, the received messages going to $HOME/INBOX (like /home/juniox/INBOX)

Quote:
/home/juniox/INBOX
INBOX.Sent
INBOX.Spam
INBOX.Trash
INBOX.Draft
running the clamscan i found too much virus into $HOME/INBOX ... but how can i remove the virus now? if i do that... the INBOX file will be removed, dont it?

does anybody help-me?
 
Old 03-24-2006, 06:45 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
the users has being received too much virus and i need to block it.
Does that mean ClamAV ain't working? Better check and fix infected mailboxes after that else you keep getting stuff in.


but how can i remove the virus now? if i do that... the INBOX file will be removed, dont it?
Here's the idea. Split messages from mailbox, pipe procmail, pipe through clamscan, deliver.
Could look something like this:
Code:
cat /home/user/mailbox|formail -s procmail -m av.rc
The av.rc could contain something like:
Code:
VERBOSE=on
LOGFILE=$HOME/mailbox.log

:0Efw
| clamassassin

:0
* ^X-Virus-Status: Yes
/home/user/mailbox_warning_infected

:0
* ^X-Virus-Scan: Suspicious
/home/user/mailbox_warning_suspicious

:0
mailbox.new
What you've got to do is test this procedure on a copy of a single mailbox to see if all stuff isn in your $PATH, if you need any other variable set, stuff like that. Check the log for errors & post back. I did test the procedure (only mailbox format) and for me it works OK, YMMV(VM). You need clamassassin or else use clamscan/clamdscan in which case you will have to find the necessary parameters to run it yourself. If you use maildir or whatever you know what to do.

Script example. Might look like this. Note it doesnt make backups and leaves the infected/suspicious mailboxes in place for you to examine & remove. Takes one directory name as input:
Code:
#!/bin/bash
if [ -d "$1" ]; then find "$1" -type f | while read ; do file $REPLY|grep -q ": ASCII mail text"; case "$?" in 0) target="$REPLY";
dir=$(dirname "$target"); file=$(basename "$target"); filenew="${file}_new"; echo -en "VERBOSE=on\nLOGFILE=${dir}/\
${filenew}.log\n\n:0Efw\n| clamassassin\n\n:0\n\* ^X-Virus-Status: Yes\n${dir}/${file}_warning_infected\n\n:0\n\* ^X-Virus\
-Scan: Suspicious\n${dir}/${file}_warning_suspicious\n\n:0\n${dir}/${filenew}\n" > "${dir}/${filenew}.rc"; cat "$target"|formail\
 -s procmail "${dir}/${filenew}.rc"; mv "${dir}/${filenew}" "$target" && rm -f "${dir}/${filenew}.rc";; esac; done; fi; exit 0

Anyway, HTH
 
  


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
Mailscanner With Spamassassin + Clamav On The Same Server treedstang Linux - Enterprise 3 02-09-2006 10:53 PM
dovecot imap server & clamav paul_mat Linux - Networking 0 01-09-2006 09:43 PM
ClamAV with a Samba file Server for windows paul_mat Linux - Security 3 12-29-2005 07:30 PM
upgrade clamav on mitel sme mail server Warmduvet Linux - Newbie 0 05-08-2005 10:10 PM
Run email script from clamav Pete M Programming 0 07-25-2004 04:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:17 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