Merge branch 'master' of git://github.com/abh/qpsmtpd
This commit is contained in:
commit
d7e8ecbf77
8
Changes
8
Changes
@ -1,4 +1,12 @@
|
|||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Disconnect host in rhsbl (Charlie Brady)
|
||||||
|
|
||||||
POD cleanups (Steve Kemp)
|
POD cleanups (Steve Kemp)
|
||||||
|
|
||||||
check_spamhelo disconnects after denying a 'helo' (Filippo Carletti)
|
check_spamhelo disconnects after denying a 'helo' (Filippo Carletti)
|
||||||
|
5
config.sample/badmailfrom
Normal file
5
config.sample/badmailfrom
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# This is a sample config file for badmailfrom
|
||||||
|
# - single email address
|
||||||
|
badmailexample@microsoft.com
|
||||||
|
# - block and entire host, and provide a custom reason
|
||||||
|
@www.yahoo.com yahoo never sends from www
|
@ -24,6 +24,8 @@ stage, so store it until later.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
# TODO: add the ability to provide a custom default rejection reason
|
||||||
|
|
||||||
sub hook_mail {
|
sub hook_mail {
|
||||||
my ($self, $transaction, $sender, %param) = @_;
|
my ($self, $transaction, $sender, %param) = @_;
|
||||||
|
|
||||||
@ -36,11 +38,9 @@ sub hook_mail {
|
|||||||
my $host = lc $sender->host;
|
my $host = lc $sender->host;
|
||||||
my $from = lc($sender->user) . '@' . $host;
|
my $from = lc($sender->user) . '@' . $host;
|
||||||
|
|
||||||
for my $bad (@badmailfrom) {
|
for my $config (@badmailfrom) {
|
||||||
my $reason = $bad;
|
my ($bad, $reason) = $config =~ /^\s*(\S+)(?:\s*(.*))?$/;
|
||||||
$reason =~ s/^\s*(\S+)[\t\s]+//;
|
|
||||||
$reason = "sorry, your envelope sender is in my badmailfrom list" unless $reason;
|
$reason = "sorry, your envelope sender is in my badmailfrom list" unless $reason;
|
||||||
$bad =~ s/^\s*(\S+).*/$1/;
|
|
||||||
next unless $bad;
|
next unless $bad;
|
||||||
$bad = lc $bad;
|
$bad = lc $bad;
|
||||||
$self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next unless $bad =~ m/\@/;
|
$self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next unless $bad =~ m/\@/;
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
#!perl -w
|
#!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 {
|
sub hook_mail {
|
||||||
my ($self, $transaction, $sender, %param) = @_;
|
my ($self, $transaction, $sender, %param) = @_;
|
||||||
@ -49,12 +59,12 @@ sub hook_rcpt {
|
|||||||
my $result = $self->process_sockets;
|
my $result = $self->process_sockets;
|
||||||
if ($result && defined($self->{_rhsbl_zones_map}{$result})) {
|
if ($result && defined($self->{_rhsbl_zones_map}{$result})) {
|
||||||
if ($result =~ /^$host\./ ) {
|
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 {
|
} 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;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ sub hook_data_post { # check_spam
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
my $tests = <SPAMD>;
|
my $tests = <SPAMD>|| '';
|
||||||
close SPAMD;
|
close SPAMD;
|
||||||
$tests =~ s/\015//; # hack for outlook
|
$tests =~ s/\015//; # hack for outlook
|
||||||
$flag = $flag eq 'True' ? 'Yes' : 'No';
|
$flag = $flag eq 'True' ? 'Yes' : 'No';
|
||||||
|
@ -139,6 +139,9 @@ sub register {
|
|||||||
elsif (/back_compat/) {
|
elsif (/back_compat/) {
|
||||||
$self->{_back_compat} = '-i --max-recursion=50';
|
$self->{_back_compat} = '-i --max-recursion=50';
|
||||||
}
|
}
|
||||||
|
elsif (/declined_on_fail/) {
|
||||||
|
$self->{_declined_on_fail} = 1;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin");
|
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin");
|
||||||
return undef;
|
return undef;
|
||||||
@ -149,6 +152,7 @@ sub register {
|
|||||||
$self->{_spool_dir} ||= $self->spool_dir();
|
$self->{_spool_dir} ||= $self->spool_dir();
|
||||||
$self->{_back_compat} ||= ''; # make sure something is set
|
$self->{_back_compat} ||= ''; # make sure something is set
|
||||||
$self->{_clamd_conf} ||= '/etc/clamd/conf'; # 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}) {
|
unless ($self->{_spool_dir}) {
|
||||||
$self->log(LOGERROR, "No spool dir configuration found");
|
$self->log(LOGERROR, "No spool dir configuration found");
|
||||||
@ -187,7 +191,7 @@ sub hook_data_post {
|
|||||||
. " --stdout "
|
. " --stdout "
|
||||||
. $self->{_back_compat}
|
. $self->{_back_compat}
|
||||||
. " --config-file=" . $self->{_clamd_conf}
|
. " --config-file=" . $self->{_clamd_conf}
|
||||||
. " --disable-summary $filename 2>&1";
|
. " --no-summary $filename 2>&1";
|
||||||
$self->log(LOGDEBUG, "Running: $cmd");
|
$self->log(LOGDEBUG, "Running: $cmd");
|
||||||
my $output = `$cmd`;
|
my $output = `$cmd`;
|
||||||
|
|
||||||
@ -202,6 +206,7 @@ sub hook_data_post {
|
|||||||
|
|
||||||
if ($signal) {
|
if ($signal) {
|
||||||
$self->log(LOGINFO, "clamscan exited with signal: $signal");
|
$self->log(LOGINFO, "clamscan exited with signal: $signal");
|
||||||
|
return (DENYSOFT) if (!$self->{_declined_on_fail});
|
||||||
return (DECLINED);
|
return (DECLINED);
|
||||||
}
|
}
|
||||||
if ($result == 1) {
|
if ($result == 1) {
|
||||||
@ -215,6 +220,11 @@ sub hook_data_post {
|
|||||||
}
|
}
|
||||||
elsif ($result) {
|
elsif ($result) {
|
||||||
$self->log(LOGERROR, "ClamAV error: $cmd: $result\n");
|
$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);
|
return (DECLINED);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user