From a138bcf5a43fc553255e77f892166c7dd7a1cd8b Mon Sep 17 00:00:00 2001 From: Charlie Brady Date: Mon, 20 Jul 2009 12:59:32 +0200 Subject: [PATCH 1/4] Disconnect hosts in rhsbl --- Changes | 2 ++ plugins/rhsbl | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index ddd16e0..94d2b27 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ + Disconnect host in rhsbl (Charlie Brady) + POD cleanups (Steve Kemp) check_spamhelo disconnects after denying a 'helo' (Filippo Carletti) diff --git a/plugins/rhsbl b/plugins/rhsbl index 03a0585..2a613a3 100644 --- a/plugins/rhsbl +++ b/plugins/rhsbl @@ -1,5 +1,15 @@ #!perl -w +sub register { + my ($self, $qp, $denial ) = @_; + if ( defined $denial and $denial =~ /^disconnect$/i ) { + $self->{_rhsbl}->{DENY} = DENY_DISCONNECT; + } + else { + $self->{_rhsbl}->{DENY} = DENY; + } + +} sub hook_mail { my ($self, $transaction, $sender, %param) = @_; @@ -49,12 +59,12 @@ sub hook_rcpt { my $result = $self->process_sockets; if ($result && defined($self->{_rhsbl_zones_map}{$result})) { if ($result =~ /^$host\./ ) { - return (DENY, "Mail from $host rejected because it " . $self->{_rhsbl_zones_map}{$result}); + return ($self->{_rhsbl}->{DENY}, "Mail from $host rejected because it " . $self->{_rhsbl_zones_map}{$result}); } else { - return (DENY, "Mail from HELO $hello rejected because it " . $self->{_rhsbl_zones_map}{$result}); + return ($self->{_rhsbl}->{DENY}, "Mail from HELO $hello rejected because it " . $self->{_rhsbl_zones_map}{$result}); } } - return (DENY, $result) if $result; + return ($self->{_rhsbl}->{DENY}, $result) if $result; return DECLINED; } From f4eb90cba3429d9b91ef0344c585ec82022c85d6 Mon Sep 17 00:00:00 2001 From: Charlie Brady Date: Mon, 20 Jul 2009 13:02:38 +0200 Subject: [PATCH 2/4] Fix spamassassin plugin log noise if spam score is 0.0 --- Changes | 2 ++ plugins/spamassassin | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 94d2b27..89d9760 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ + Fix spamassassin plugin log noise if spam score is 0.0 + Disconnect host in rhsbl (Charlie Brady) POD cleanups (Steve Kemp) diff --git a/plugins/spamassassin b/plugins/spamassassin index 9aadb84..1a1b4b1 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -188,7 +188,7 @@ sub hook_data_post { # check_spam } } - my $tests = ; + my $tests = || ''; close SPAMD; $tests =~ s/\015//; # hack for outlook $flag = $flag eq 'True' ? 'Yes' : 'No'; From b3c5195b6434ca23a309dd5320e10980828c7394 Mon Sep 17 00:00:00 2001 From: Jonathan Martens Date: Mon, 20 Jul 2009 13:07:45 +0200 Subject: [PATCH 3/4] Modify plugins/virus/clamav option for ClamAV 0.95 (no-summary) --- Changes | 2 ++ plugins/virus/clamav | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 89d9760..0829603 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ + Modify plugins/virus/clamav option for ClamAV 0.95 (no-summary) + Fix spamassassin plugin log noise if spam score is 0.0 Disconnect host in rhsbl (Charlie Brady) diff --git a/plugins/virus/clamav b/plugins/virus/clamav index a74e0f1..6f80c94 100644 --- a/plugins/virus/clamav +++ b/plugins/virus/clamav @@ -187,7 +187,7 @@ sub hook_data_post { . " --stdout " . $self->{_back_compat} . " --config-file=" . $self->{_clamd_conf} - . " --disable-summary $filename 2>&1"; + . " --no-summary $filename 2>&1"; $self->log(LOGDEBUG, "Running: $cmd"); my $output = `$cmd`; From 52a1ba8debd348f5a2fd32c14129d0a29bb414d0 Mon Sep 17 00:00:00 2001 From: "Shad L. Lords" Date: Mon, 20 Jul 2009 13:13:51 +0200 Subject: [PATCH 4/4] Temporary deny if clamd is not running --- Changes | 2 ++ plugins/virus/clamav | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Changes b/Changes index 0829603..b3c5fe8 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ + Temporary deny if clamd is not running + Modify plugins/virus/clamav option for ClamAV 0.95 (no-summary) Fix spamassassin plugin log noise if spam score is 0.0 diff --git a/plugins/virus/clamav b/plugins/virus/clamav index 6f80c94..bb595fe 100644 --- a/plugins/virus/clamav +++ b/plugins/virus/clamav @@ -139,6 +139,9 @@ sub register { elsif (/back_compat/) { $self->{_back_compat} = '-i --max-recursion=50'; } + elsif (/declined_on_fail/) { + $self->{_declined_on_fail} = 1; + } else { $self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin"); return undef; @@ -149,6 +152,7 @@ sub register { $self->{_spool_dir} ||= $self->spool_dir(); $self->{_back_compat} ||= ''; # make sure something is set $self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set + $self->{_declined_on_fail} ||= 0; # decline the message on clamav failure unless ($self->{_spool_dir}) { $self->log(LOGERROR, "No spool dir configuration found"); @@ -202,6 +206,7 @@ sub hook_data_post { if ($signal) { $self->log(LOGINFO, "clamscan exited with signal: $signal"); + return (DENYSOFT) if (!$self->{_declined_on_fail}); return (DECLINED); } if ($result == 1) { @@ -215,6 +220,11 @@ sub hook_data_post { } elsif ($result) { $self->log(LOGERROR, "ClamAV error: $cmd: $result\n"); + return (DENYSOFT) if (!$self->{_declined_on_fail}); + } + else { + $transaction->header->add( 'X-Virus-Checked', + "Checked by ClamAV on " . $self->qp->config("me") ); } return (DECLINED); }