works fine for me, please give it a try.
any improvements / bug fixes are highly apreciated.
Scott wrote:
RUIVO Eugenio Morais wrote:
I've been using clam-av and amavis-ng through courier's perlfilter setup without problems.
What would be nice is if someone who has had success with these settings could write a howto for clamav and amavis-ng with courier. I used to use openantivirus with amavis and it worked spectacularly except that oav is dead. If I can find the time to try clam/amavisng setup on a test box I will post my steps. Don't hold your breath, though.
-Scott
-----Original Message----- From: Mitch (WebCob) [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 16 de Outubro de 2003 16:12 To: [EMAIL PROTECTED] Subject: [courier-users] Has anyone used courier & clam-av? What's the preferred method of integration?
The following links seem to have some references... for those others who may
be looking:
http://clamav.elektrapro.com/doc/FreeBSD-HowTo/qmail-scanner-how-to.html
http://www.fremerx.com/open-source/mail/courier.html
http://iland.net/~ckennedy/source/docs/blackhole/index_a.shtml
http://sourceforge.net/mailarchive/message.php?msg_id=4267102
Black hole seems to be interesting, in that it is C not PERL and can manage
both calls to spamassassin & clam-av...
BUT the documentation is lagging the code - saw some comment in the list archives of people starting to work with it - anyone presently?
If not, anyone know which version of amavis works best and why?
My perfect world would be an efficient method of using spamc & clam-av (which seems to be more active than openantivirus?) with database based config for easy user driven control...
Hope this isn't considered too far afield - it is integration related. ;-)
Many thanks.
m/
$| = 1;
my $filedesc=shift @ARGV; my $socket=undef; my $tempdir = "/var/run/courier/antivirus/scan-$$"; my ($line, $mailfile, $errmsg); open($socket, "+<&$filedesc"); die "$!" unless defined $socket; while (defined ($line=<$socket>)) { chomp $line; last unless($line); $mailfile = $line unless($mailfile); # Ignore control files } if($mailfile) { $errmsg = viruscheck($mailfile); cleantmpdir(); } $errmsg = "200 Ok" unless($errmsg); $errmsg .= "\n" unless $errmsg =~ /\n$/; print $socket $errmsg; close($socket); undef($socket); ################################################## sub viruscheck() { my $filename=shift; newtmpdir(); system("/usr/local/courier/bin/reformime -x$tempdir/ < $filename"); return "432 internal mime handler failure" if($?); system("/usr/local/clamav/bin/clamscan", '-i', '--quiet', '--disable-summary', '-r', '--max-space=20000', '--max-files=1000', '--max-recursion=5', '-l', "$tempdir.rep", "--tempdir=$tempdir", $tempdir); if($?) { return "432 virus scanner invocation failure" if($? != 256); my ($fh, $err, $virus_ref); open($fh, "$tempdir.rep"); return "432 virus scanner report failure" unless($fh); while(<$fh>) { chomp; if(/^$tempdir\/(.*)/) { $virus_ref = $1; $err = "ANTIVIRUS ALERT! $virus_ref"; last; } } close($fh); if(-d '/tmp/virus_log/') { $virus_ref =~ s/[^a-zA-Z0-9.:_ ]/-/g; my($file, $virus) = split(/ +/, $virus_ref); chop($file); system("/bin/cp $filename /tmp/virus_log/$virus"); } return "432 virus scanner report failure" unless($err); return "500 $err"; } return ""; } sub cleantmpdir { system('/bin/rm', '-rf', $tempdir); unlink("$tempdir.rep"); } sub newtmpdir { if(-d $tempdir) { cleantmpdir(); } mkdir($tempdir, 0700); }