[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: prodotti alternativi spamassassin



Alle 09:40, giovedì 19 aprile 2007, automatic_jack ha scritto:
> configurato procmail per richiamare clamav

forse ho trovato il metodo che tu hai applicato, ed ho potuto constatare 
che le prestazioni sono migliorate in quanto posso applicare il controllo 
email alle sole email che ritengo opportuno, puoi confermarmi se utilizzi 
questo sistema: 
la seguente regola in .procmail

# Controlla con clamfilter
:0fw
| /usr/local/bin/clamfilter.pl
:0:
* ^X-Virus-Found: yes
${MAILDIR}/Virus/


e il lo script che ho trovato faticosamente nella rete
cat /usr/local/bin/clamfilter.pl

#!/usr/bin/perl -w
#
# ClamFilter 1.0
# by Matt Hahnfeld (http://www.everysoft.com/)
# Requires perl, clamscan, procmail, and this script.
#
# Add these lines to your .procmailrc:
#
# :0fw
# | /usr/local/bin/clamfilter.pl
# 
# This script is public domain.
#

use strict;
use File::Temp 'tempfile';

&main();
exit 0;

sub main {
  # Set up a temporary file for the original message
  my ($tmpfh, $tmpfn) = tempfile( UNLINK => 1 );
  -w $tmpfn or die 'Could not open temp file!';

  # Pass 1: Write out the temporary file
  while (<STDIN>) {
    print $tmpfh $_;
  }
  seek($tmpfh, 0, 0);

  # Pass 2: Scan the message
  open CLAMSCAN, "/bin/cat $tmpfn | /usr/bin/clamscan --stdout --recursive 
--mbox - 2>/dev/null |" or die 'Could not open clamscan!';
  my $clamstatus = qq|X-Virus-Found: yes
X-Virus-Status:
 ------------------------------------------------------------
 Virus Scan Status:
 ------------------------------------------------------------
|;
  while (<CLAMSCAN>) {
    $clamstatus .= ' ' . $_;
  }
  close CLAMSCAN;
  $clamstatus .= qq| 
 ------------------------------------------------------------

|;

  # Pass 3: Print out the message
  my $bodyflag = 0;
  while (<$tmpfh>) {
    if (! $bodyflag and $_ eq "\n") {
      if ($?) {
	print $clamstatus;
      }
      else {
	print "\n";
      }
      $bodyflag = 1;
    }
    else {
      print;
    }
  }
}



Reply to: