Compare commits

..

No commits in common. "c9" and "c8" have entirely different histories.
c9 ... c8

6 changed files with 1935 additions and 96 deletions

View File

@ -13,4 +13,4 @@ Documentation=man:sa-update(1)
OnCalendar=daily OnCalendar=daily
[Install] [Install]
WantedBy=timers.target WantedBy=spamassassin.service

View File

@ -0,0 +1,193 @@
diff --git a/MANIFEST b/MANIFEST
index e16e0da..601f886 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -101,7 +101,6 @@ lib/Mail/SpamAssassin/Plugin/Pyzor.pm
lib/Mail/SpamAssassin/Plugin/Razor2.pm
lib/Mail/SpamAssassin/Plugin/RelayCountry.pm
lib/Mail/SpamAssassin/Plugin/RelayEval.pm
-lib/Mail/SpamAssassin/Plugin/ResourceLimits.pm
lib/Mail/SpamAssassin/Plugin/ReplaceTags.pm
lib/Mail/SpamAssassin/Plugin/Reuse.pm
lib/Mail/SpamAssassin/Plugin/Rule2XSBody.pm
diff --git a/lib/Mail/SpamAssassin/Plugin/ResourceLimits.pm b/lib/Mail/SpamAssassin/Plugin/ResourceLimits.pm
deleted file mode 100644
index 9179b93..0000000
--- a/lib/Mail/SpamAssassin/Plugin/ResourceLimits.pm
+++ /dev/null
@@ -1,143 +0,0 @@
-# <@LICENSE>
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# </@LICENSE>
-
-=head1 NAME
-
-Mail::SpamAssassin::Plugin::ResourceLimits - Limit the memory and/or CPU of child spamd processes
-
-=head1 SYNOPSIS
-
- # This plugin is for admin only and cannot be specified in user config.
- loadplugin Mail::SpamAssassin::Plugin::ResourceLimits
-
- # Sets to RLIMIT_CPU from BSD::Resource. The quota is based on max CPU Time seconds.
- resource_limit_cpu 120
-
- # Sets to RLIMIT_RSS and RLIMIT_AS via BSD::Resource.
- resource_limit_cpu 536870912
-
-=head1 DESCRIPTION
-
-This module leverages BSD::Resource to assure your spamd child processes do not exceed
-specified CPU or memory limit. If this happens, the child process will die.
-See the L<BSD::Resource> for more details.
-
-NOTE: Because this plugin uses BSD::Resource, it will not function on Windows.
-
-=head1 ADMINISTRATOR SETTINGS
-
-=over 4
-
-=item resource_limit_cpu 120 (default: 0 or no limit)
-
-How many cpu cycles are allowed on this process before it dies.
-
-=item resource_limit_mem 536870912 (default: 0 or no limit)
-
-The maximum number of bytes of memory allowed both for:
-
-=over
-
-=item *
-
-(virtual) address space bytes
-
-=item *
-
-resident set size
-
-=back
-
-=back
-
-=cut
-
-package Mail::SpamAssassin::Plugin::ResourceLimits;
-
-use Mail::SpamAssassin::Plugin ();
-use Mail::SpamAssassin::Logger ();
-use Mail::SpamAssassin::Util ();
-use Mail::SpamAssassin::Constants qw(:sa);
-
-use strict;
-use warnings;
-
-use BSD::Resource qw(RLIMIT_RSS RLIMIT_AS RLIMIT_CPU);
-
-our @ISA = qw(Mail::SpamAssassin::Plugin);
-
-sub new {
- my $class = shift;
- my $mailsaobject = shift;
-
- $class = ref($class) || $class;
- my $self = $class->SUPER::new($mailsaobject);
- bless( $self, $class );
-
- $self->set_config( $mailsaobject->{conf} );
- return $self;
-}
-
-sub set_config {
- my ( $self, $conf ) = @_;
- my @cmds = ();
-
- push(
- @cmds,
- {
- setting => 'resource_limit_mem',
- is_admin => 1,
- default => '0',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_NUMERIC
- }
- );
-
- push(
- @cmds,
- {
- setting => 'resource_limit_cpu',
- is_admin => 1,
- default => '0',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_NUMERIC
- }
- );
-
- $conf->{parser}->register_commands( \@cmds );
-}
-
-sub spamd_child_init {
- my ($self) = @_;
-
- # Set CPU Resource limits if they were specified.
- Mail::SpamAssassin::Util::dbg("resourcelimitplugin: In spamd_child_init");
- Mail::SpamAssassin::Util::dbg( "resourcelimitplugin: cpu limit: " . $self->{main}->{conf}->{resource_limit_cpu} );
- if ( $self->{main}->{conf}->{resource_limit_cpu} ) {
- BSD::Resource::setrlimit( RLIMIT_CPU, $self->{main}->{conf}->{resource_limit_cpu}, $self->{main}->{conf}->{resource_limit_cpu} )
- || info("resourcelimitplugin: Unable to set RLIMIT_CPU");
- }
-
- # Set Resource limits if they were specified.
- Mail::SpamAssassin::Util::dbg( "resourcelimitplugin: mem limit: " . $self->{main}->{conf}->{resource_limit_mem} );
- if ( $self->{main}->{conf}->{resource_limit_mem} ) {
- BSD::Resource::setrlimit( RLIMIT_RSS, $self->{main}->{conf}->{resource_limit_mem}, $self->{main}->{conf}->{resource_limit_mem} )
- || info("resourcelimitplugin: Unable to set RLIMIT_RSS");
- BSD::Resource::setrlimit( RLIMIT_AS, $self->{main}->{conf}->{resource_limit_mem}, $self->{main}->{conf}->{resource_limit_mem} )
- || info("resourcelimitplugin: Unable to set RLIMIT_AS");
- }
-}
-
-1;
diff --git a/lib/Mail/SpamAssassin/Util/DependencyInfo.pm b/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
index b5b05cf..8223b26 100644
--- a/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
+++ b/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
@@ -234,12 +234,6 @@ our @OPTIONAL_MODULES = (
check for both Net::DNS and Net::DNS::Nameserver. However,
Net::DNS::Nameserver is only used in make test as of June 2014.',
},
-{
- module => 'BSD::Resource',
- version => 0,
- desc => 'BSD::Resource provides BSD process resource limit and priority
- functions. It is used by the optional ResourceLimits Plugin.',
-},
{
module => 'Archive::Zip',
version => 0,
diff --git a/rules/v342.pre b/rules/v342.pre
index 8e0fb07..c4758e9 100644
--- a/rules/v342.pre
+++ b/rules/v342.pre
@@ -19,10 +19,6 @@
# HashBL - Query hashed/unhashed strings, emails, uris etc from DNS lists
# loadplugin Mail::SpamAssassin::Plugin::HashBL
-# ResourceLimits - assure your spamd child processes
-# do not exceed specified CPU or memory limit
-# loadplugin Mail::SpamAssassin::Plugin::ResourceLimits
-
# FromNameSpoof - help stop spam that tries to spoof other domains using
# the from name
# loadplugin Mail::SpamAssassin::Plugin::FromNameSpoof

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
diff --git a/t/all_modules.t b/t/all_modules.t
index 855395f..a976012 100755
--- a/t/all_modules.t
+++ b/t/all_modules.t
@@ -12,15 +12,7 @@ plan tests => 5;
my $plugins = '';
-if (eval { require BSD::Resource; }) {
- $plugins .= "loadplugin Mail::SpamAssassin::Plugin::ResourceLimits\n"
-}
-if (eval { require Net::CIDR::Lite; }) {
- $plugins .= "loadplugin Mail::SpamAssassin::Plugin::URILocalBL\n";
-}
-
tstpre ("
-loadplugin Mail::SpamAssassin::Plugin::RelayCountry
loadplugin Mail::SpamAssassin::Plugin::URIDNSBL
loadplugin Mail::SpamAssassin::Plugin::Hashcash
loadplugin Mail::SpamAssassin::Plugin::SPF
diff --git a/t/data/01_test_rules.pre b/t/data/01_test_rules.pre
index c4681ca..1694ddf 100644
--- a/t/data/01_test_rules.pre
+++ b/t/data/01_test_rules.pre
@@ -21,7 +21,6 @@ loadplugin Mail::SpamAssassin::Plugin::WLBLEval
loadplugin Mail::SpamAssassin::Plugin::VBounce
# Try to load some non-default plugins also
-loadplugin Mail::SpamAssassin::Plugin::RelayCountry
loadplugin Mail::SpamAssassin::Plugin::DCC
loadplugin Mail::SpamAssassin::Plugin::AntiVirus
loadplugin Mail::SpamAssassin::Plugin::AWL
@@ -32,7 +31,6 @@ loadplugin Mail::SpamAssassin::Plugin::Shortcircuit
loadplugin Mail::SpamAssassin::Plugin::ASN
#loadplugin Mail::SpamAssassin::Plugin::PhishTag
#loadplugin Mail::SpamAssassin::Plugin::TxRep
-loadplugin Mail::SpamAssassin::Plugin::URILocalBL
loadplugin Mail::SpamAssassin::Plugin::PDFInfo
loadplugin Mail::SpamAssassin::Plugin::HashBL
#loadplugin Mail::SpamAssassin::Plugin::ResourceLimits

View File

@ -0,0 +1,354 @@
diff --git a/lib/Mail/SpamAssassin/AutoWhitelist.pm b/lib/Mail/SpamAssassin/AutoWhitelist.pm
index 627e249..cc3c97b 100644
--- a/lib/Mail/SpamAssassin/AutoWhitelist.pm
+++ b/lib/Mail/SpamAssassin/AutoWhitelist.pm
@@ -128,35 +128,35 @@ sub check_address {
my $entry = $self->{checker}->get_addr_entry ($fulladdr, $signedby);
$self->{entry} = $entry;
- if (!$entry->{msgcount}) {
+ if (!$entry->{count}) {
# no entry found
if (defined $origip) {
# try upgrading a default entry (probably from "add-addr-to-foo")
my $noipaddr = $self->pack_addr ($addr, undef);
my $noipent = $self->{checker}->get_addr_entry ($noipaddr, undef);
- if (defined $noipent->{msgcount} && $noipent->{msgcount} > 0) {
+ if (defined $noipent->{count} && $noipent->{count} > 0) {
dbg("auto-whitelist: found entry w/o IP address for $addr: replacing with $origip");
$self->{checker}->remove_entry($noipent);
# Now assign proper entry the count and totscore values of the
# no-IP entry instead of assigning the whole value to avoid
# wiping out any information added to the previous entry.
- $entry->{msgcount} = $noipent->{msgcount};
+ $entry->{count} = $noipent->{count};
$entry->{totscore} = $noipent->{totscore};
}
}
}
- if ($entry->{msgcount} < 0 ||
- $entry->{msgcount} != $entry->{msgcount} || # test for NaN
+ if ($entry->{count} < 0 ||
+ $entry->{count} != $entry->{count} || # test for NaN
$entry->{totscore} != $entry->{totscore})
{
warn "auto-whitelist: resetting bad data for ($addr, $origip), ".
- "count: $entry->{msgcount}, totscore: $entry->{totscore}\n";
- $entry->{msgcount} = $entry->{totscore} = 0;
+ "count: $entry->{count}, totscore: $entry->{totscore}\n";
+ $entry->{count} = $entry->{totscore} = 0;
}
- return !$entry->{msgcount} ? undef : $entry->{totscore} / $entry->{msgcount};
+ return !$entry->{count} ? undef : $entry->{totscore} / $entry->{count};
}
###########################################################################
@@ -170,7 +170,7 @@ whitelist correction.
sub count {
my $self = shift;
- return $self->{entry}->{msgcount};
+ return $self->{entry}->{count};
}
@@ -195,7 +195,7 @@ sub add_score {
return; # don't try to add a NaN
}
- $self->{entry}->{msgcount} ||= 0;
+ $self->{entry}->{count} ||= 0;
$self->{checker}->add_score($self->{entry}, $score);
}
diff --git a/lib/Mail/SpamAssassin/DBBasedAddrList.pm b/lib/Mail/SpamAssassin/DBBasedAddrList.pm
index 6aaed86..a1adca3 100644
--- a/lib/Mail/SpamAssassin/DBBasedAddrList.pm
+++ b/lib/Mail/SpamAssassin/DBBasedAddrList.pm
@@ -125,10 +125,10 @@ sub get_addr_entry {
addr => $addr,
};
- $entry->{msgcount} = $self->{accum}->{$addr} || 0;
+ $entry->{count} = $self->{accum}->{$addr} || 0;
$entry->{totscore} = $self->{accum}->{$addr.'|totscore'} || 0;
- dbg("auto-whitelist: db-based $addr scores ".$entry->{msgcount}.'/'.$entry->{totscore});
+ dbg("auto-whitelist: db-based $addr scores ".$entry->{count}.'/'.$entry->{totscore});
return $entry;
}
@@ -137,15 +137,15 @@ sub get_addr_entry {
sub add_score {
my($self, $entry, $score) = @_;
- $entry->{msgcount} ||= 0;
+ $entry->{count} ||= 0;
$entry->{addr} ||= '';
- $entry->{msgcount}++;
+ $entry->{count}++;
$entry->{totscore} += $score;
- dbg("auto-whitelist: add_score: new count: ".$entry->{msgcount}.", new totscore: ".$entry->{totscore});
+ dbg("auto-whitelist: add_score: new count: ".$entry->{count}.", new totscore: ".$entry->{totscore});
- $self->{accum}->{$entry->{addr}} = $entry->{msgcount};
+ $self->{accum}->{$entry->{addr}} = $entry->{count};
$self->{accum}->{$entry->{addr}.'|totscore'} = $entry->{totscore};
return $entry;
}
diff --git a/lib/Mail/SpamAssassin/Plugin/TxRep.pm b/lib/Mail/SpamAssassin/Plugin/TxRep.pm
index 2ef3ddc..08b432b 100644
--- a/lib/Mail/SpamAssassin/Plugin/TxRep.pm
+++ b/lib/Mail/SpamAssassin/Plugin/TxRep.pm
@@ -1521,7 +1521,7 @@ sub check_reputation {
#--------------------------------------------------------------------------
###########################################################################
-sub count {my $self=shift; return (defined $self->{checker})? $self->{entry}->{msgcount} : undef;}
+sub count {my $self=shift; return (defined $self->{checker})? $self->{entry}->{count} : undef;}
sub total {my $self=shift; return (defined $self->{checker})? $self->{entry}->{totscore} : undef;}
###########################################################################
@@ -1538,11 +1538,11 @@ sub get_sender {
$self->{entry} = $entry;
$origip = $origip || 'none';
- if ($entry->{msgcount}<0 || $entry->{msgcount}=~/^(nan|)$/ || $entry->{totscore}=~/^(nan|)$/) {
- warn "TxRep: resetting bad data for ($addr, $origip), count: $entry->{msgcount}, totscore: $entry->{totscore}\n";
- $self->{entry}->{msgcount} = $self->{entry}->{totscore} = 0;
+ if ($entry->{count}<0 || $entry->{count}=~/^(nan|)$/ || $entry->{totscore}=~/^(nan|)$/) {
+ warn "TxRep: resetting bad data for ($addr, $origip), count: $entry->{count}, totscore: $entry->{totscore}\n";
+ $self->{entry}->{count} = $self->{entry}->{totscore} = 0;
}
- return $self->{entry}->{msgcount};
+ return $self->{entry}->{count};
}
@@ -1557,7 +1557,7 @@ sub add_score {
warn "TxRep: attempt to add a $score to TxRep entry ignored\n";
return; # don't try to add a NaN
}
- $self->{entry}->{msgcount} ||= 0;
+ $self->{entry}->{count} ||= 0;
# performing the dilution aging correction
if (defined $self->total() && defined $self->count() && defined $self->{txrep_dilution_factor}) {
@@ -1587,9 +1587,9 @@ sub remove_score {
}
# no reversal dilution aging correction (not easily possible),
# just removing the original message score
- if ($self->{entry}->{msgcount} > 2)
- {$self->{entry}->{msgcount} -= 2;}
- else {$self->{entry}->{msgcount} = 0;}
+ if ($self->{entry}->{count} > 2)
+ {$self->{entry}->{count} -= 2;}
+ else {$self->{entry}->{count} = 0;}
# subtract 2, and add a score; hence decrementing by 1
$self->{checker}->add_score($self->{entry}, -1*$score);
}
diff --git a/lib/Mail/SpamAssassin/SQLBasedAddrList.pm b/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
index 278f792..f3f40b4 100644
--- a/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
+++ b/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
@@ -45,7 +45,7 @@ CREATE TABLE awl (
username varchar(100) NOT NULL default '',
email varchar(255) NOT NULL default '',
ip varchar(40) NOT NULL default '',
- msgcount int(11) NOT NULL default '0',
+ count int(11) NOT NULL default '0',
totscore float NOT NULL default '0',
signedby varchar(255) NOT NULL default '',
PRIMARY KEY (username,email,signedby,ip)
@@ -191,7 +191,7 @@ sub get_addr_entry {
my $entry = { addr => $addr,
exists_p => 0,
- msgcount => 0,
+ count => 0,
totscore => 0,
signedby => $signedby,
};
@@ -200,7 +200,7 @@ sub get_addr_entry {
return $entry unless $email ne '' && (defined $ip || defined $signedby);
- my $sql = "SELECT msgcount, totscore FROM $self->{tablename} " .
+ my $sql = "SELECT count, totscore FROM $self->{tablename} " .
"WHERE username = ? AND email = ?";
my @args = ( $email );
if (!$self->{_with_awl_signer}) {
@@ -225,7 +225,7 @@ sub get_addr_entry {
if (!$rc) { # there was an error, but try to go on
info("auto-whitelist: sql-based get_addr_entry %s: SQL error: %s",
join('|',@args), $sth->errstr);
- $entry->{msgcount} = 0;
+ $entry->{count} = 0;
$entry->{totscore} = 0;
}
else {
@@ -234,8 +234,8 @@ sub get_addr_entry {
# how to combine data if there are several entries (like signed by
# an author domain and by a remailer)? for now just take an average
while ( defined($aryref = $sth->fetchrow_arrayref()) ) {
- if (defined $entry->{msgcount} && defined $aryref->[1]) {
- $entry->{msgcount} = $aryref->[0];
+ if (defined $entry->{count} && defined $aryref->[1]) {
+ $entry->{count} = $aryref->[0];
$entry->{totscore} = $aryref->[1];
}
$entry->{exists_p} = 1;
@@ -247,8 +247,8 @@ sub get_addr_entry {
}
$sth->finish();
- dbg("auto-whitelist: sql-based %s scores %s, msgcount %s",
- join('|',@args), $entry->{totscore}, $entry->{msgcount});
+ dbg("auto-whitelist: sql-based %s scores %s, count %s",
+ join('|',@args), $entry->{totscore}, $entry->{count});
return $entry;
}
@@ -275,7 +275,7 @@ sub add_score {
my ($email, $ip) = $self->_unpack_addr($entry->{addr});
- $entry->{msgcount} += 1;
+ $entry->{count} += 1;
$entry->{totscore} += $score;
my $signedby = $entry->{signedby};
@@ -286,7 +286,7 @@ sub add_score {
my $inserted = 0;
- { my @fields = qw(username email ip msgcount totscore);
+ { my @fields = qw(username email ip count totscore);
my @signedby;
if ($self->{_with_awl_signer}) {
push(@fields, 'signedby');
@@ -327,9 +327,9 @@ sub add_score {
# insert failed, assume primary key constraint, so try the update
my $sql = "UPDATE $self->{tablename} ".
- "SET msgcount = ?, totscore = totscore + ? ".
+ "SET count = ?, totscore = totscore + ? ".
"WHERE username = ? AND email = ?";
- my(@args) = ($entry->{msgcount}, $score, $self->{_username}, $email);
+ my(@args) = ($entry->{count}, $score, $self->{_username}, $email);
if ($self->{_with_awl_signer}) {
my @signedby = !defined $signedby ? () : split(' ', lc $signedby);
if (!@signedby) {
@@ -352,8 +352,8 @@ sub add_score {
join('|',@args), $sth->errstr);
} else {
dbg("auto-whitelist: sql-based add_score/update ".
- "new msgcount: %s, new totscore: %s for %s",
- $entry->{msgcount}, $entry->{totscore}, join('|',@args));
+ "new count: %s, new totscore: %s for %s",
+ $entry->{count}, $entry->{totscore}, join('|',@args));
$entry->{exists_p} = 1;
}
}
diff --git a/sql/README.awl b/sql/README.awl
index 68de4a1..a1ddf40 100644
--- a/sql/README.awl
+++ b/sql/README.awl
@@ -75,7 +75,7 @@ setting: "awl") with at least these fields:
username varchar(100) # this is the username whose e-mail is being filtered
email varchar(200) # this is the address key
ip varchar(40) # this is the ip key (fits IPv4 or IPv6)
- msgcount int(11) # this is the message counter
+ count int(11) # this is the message counter
totscore float # this is the total calculated score
signedby varchar(255) # a DKIM or DomainKeys signing domain(s)
@@ -109,7 +109,7 @@ CREATE TABLE awl (
username varchar(100) NOT NULL default '',
email varchar(255) NOT NULL default '',
ip varchar(40) NOT NULL default '',
- msgcount int(11) NOT NULL default '0',
+ count int(11) NOT NULL default '0',
totscore float NOT NULL default '0',
signedby varchar(255) NOT NULL default '',
PRIMARY KEY (username,email,signedby,ip)
diff --git a/sql/awl_mysql.sql b/sql/awl_mysql.sql
index a8b6926..0bfa99a 100644
--- a/sql/awl_mysql.sql
+++ b/sql/awl_mysql.sql
@@ -2,7 +2,7 @@ CREATE TABLE awl (
username varchar(100) NOT NULL default '',
email varbinary(255) NOT NULL default '',
ip varchar(40) NOT NULL default '',
- msgcount int(11) NOT NULL default '0',
+ count int(11) NOT NULL default '0',
totscore float NOT NULL default '0',
signedby varchar(255) NOT NULL default '',
last_hit timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
diff --git a/sql/awl_pg.sql b/sql/awl_pg.sql
index 2cb3f3e..4f59d72 100644
--- a/sql/awl_pg.sql
+++ b/sql/awl_pg.sql
@@ -2,7 +2,7 @@ CREATE TABLE awl (
username varchar(100) NOT NULL default '',
email varchar(255) NOT NULL default '',
ip varchar(40) NOT NULL default '',
- msgcount bigint NOT NULL default '0',
+ count bigint NOT NULL default '0',
totscore float NOT NULL default '0',
signedby varchar(255) NOT NULL default '',
last_hit timestamp NOT NULL default CURRENT_TIMESTAMP,
diff --git a/sql/txrep_mysql.sql b/sql/txrep_mysql.sql
index 9a4888b..bbe6b95 100644
--- a/sql/txrep_mysql.sql
+++ b/sql/txrep_mysql.sql
@@ -2,7 +2,7 @@ CREATE TABLE txrep (
username varchar(100) NOT NULL default '',
email varchar(255) NOT NULL default '',
ip varchar(40) NOT NULL default '',
- msgcount int(11) NOT NULL default '0',
+ count int(11) NOT NULL default '0',
totscore float NOT NULL default '0',
signedby varchar(255) NOT NULL default '',
last_hit timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
diff --git a/sql/txrep_pg.sql b/sql/txrep_pg.sql
index 191074c..463006b 100644
--- a/sql/txrep_pg.sql
+++ b/sql/txrep_pg.sql
@@ -2,7 +2,7 @@ CREATE TABLE txrep (
username varchar(100) NOT NULL default '',
email varchar(255) NOT NULL default '',
ip varchar(40) NOT NULL default '',
- msgcount bigint NOT NULL default '0',
+ count bigint NOT NULL default '0',
totscore float NOT NULL default '0',
signedby varchar(255) NOT NULL default '',
last_hit timestamp NOT NULL default CURRENT_TIMESTAMP,
diff --git a/UPGRADE b/UPGRADE
index cfd31ab..b555b0b 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -24,18 +24,6 @@ Note for Users Upgrading to SpamAssassin 3.4.3
This is to make sure all the legacy installations and wiki guides etc
still using it needlessly get fixed.
-- TxRep and Awl plugins has been modified to be compatible
- with latest Postgresql versions.
- You should upgrade your sql database running the following command:
- MySQL:
- "ALTER TABLE `txrep` CHANGE `count` `msgcount` INT(11) NOT NULL DEFAULT '0';"
- "ALTER TABLE `awl` CHANGE `count` `msgcount` INT(11) NOT NULL DEFAULT '0';"
- "ALTER TABLE `awl` ADD last_hit timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;"
- PostgreSQL:
- "ALTER TABLE txrep RENAME COLUMN count TO msgcount;"
- "ALTER TABLE awl RENAME COLUMN count TO msgcount;"
- "ALTER TABLE awl ADD last_hit timestamp NOT NULL default CURRENT_TIMESTAMP;"
-
- body_part_scan_size 50000, rawbody_part_scan_size 500000 defaults added (Bug 6582)
These enable safer and faster scanning of large emails.

View File

@ -60,13 +60,14 @@ Summary: Spam filter for email which can be invoked from mail delivery agents
Name: spamassassin Name: spamassassin
Version: 3.4.6 Version: 3.4.6
#Release: 0.8.%%{prerev}%%{?dist} #Release: 0.8.%%{prerev}%%{?dist}
Release: 5%{?dist} Release: 1%{?dist}
License: ASL 2.0 License: ASL 2.0
Group: Applications/Internet
URL: https://spamassassin.apache.org/ URL: https://spamassassin.apache.org/
Source0: https://www.apache.org/dist/%{name}/source/%{real_name}-%{version}.tar.bz2
#Source0: %%{real_name}-%%{version}-%%{prerev}.tar.bz2 #Source0: %%{real_name}-%%{version}-%%{prerev}.tar.bz2
Source1: https://www.apache.org/dist/%{name}/source/%{real_name}-rules-%{version}.r1888502.tgz Source0: https://dlcdn.apache.org/dist/%{name}/source/%{real_name}-%{version}.tar.bz2
#Source1: %%{real_name}-rules-%%{version}.%%{prerev}.tgz #Source1: %%{real_name}-rules-%%{version}.%%{prerev}.tgz
Source1: https://dlcdn.apache.org/dist/%{name}/source/%{real_name}-rules-%{version}.r1888502.tgz
Source2: redhat_local.cf Source2: redhat_local.cf
Source3: spamassassin-default.rc Source3: spamassassin-default.rc
Source4: spamassassin-spamc.rc Source4: spamassassin-spamc.rc
@ -90,14 +91,21 @@ Source17: sa-update.timer
# Switch to using gnupg2 instead of gnupg1 # Switch to using gnupg2 instead of gnupg1
Patch0: spamassassin-3.3.2-gnupg2.patch Patch0: spamassassin-3.3.2-gnupg2.patch
Patch1: spamassassin-3.4.1-add-logfile-homedir-options.patch Patch1: spamassassin-3.4.1-add-logfile-homedir-options.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1607372
Patch2: spamassassin-3.4.6-drop-geoip.patch
Patch3: spamassassin-3.4.6-Drop-the-ResourceLimits-plugin.patch
%if 0%{?rhel} <= 8
Patch4: spamassassin-sql92_syntax.patch
%endif
Patch5: spamassassin-disable_tests_for_deleted_modules.patch
# end of patches # end of patches
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
%if %{use_systemd} == 0 %if %{use_systemd} == 0
Requires: /sbin/chkconfig /sbin/service Requires: /sbin/chkconfig /sbin/service
%endif %endif
Requires(post): diffutils Requires(post): diffutils
BuildRequires: make
BuildRequires: gcc BuildRequires: gcc
BuildRequires: perl-interpreter >= 2:5.8.0 BuildRequires: perl-interpreter >= 2:5.8.0
BuildRequires: perl-generators BuildRequires: perl-generators
@ -106,36 +114,49 @@ BuildRequires: perl(Time::HiRes)
BuildRequires: perl(HTML::Parser) BuildRequires: perl(HTML::Parser)
BuildRequires: perl(NetAddr::IP) BuildRequires: perl(NetAddr::IP)
BuildRequires: openssl-devel BuildRequires: openssl-devel
# These are here for config checking, they are only really needed as Requires (runtime)
BuildRequires: perl(DB_File)
BuildRequires: perl(Mail::SPF)
BuildRequires: perl(Net::CIDR::Lite)
BuildRequires: perl(LWP::UserAgent)
BuildRequires: perl(Digest::SHA1)
BuildRequires: perl(Test::More)
# Fedora package needs fixing before we can depend on it
#BuildRequires: re2c
%if %{use_systemd} %if %{use_systemd}
BuildRequires: systemd-units BuildRequires: systemd-units
%endif %endif
# BuildRequires for test suite
BuildRequires: perl(Test::Builder)
BuildRequires: perl(Test) perl(Test::More)
BuildRequires: perl(Net::DNS::Nameserver)
BuildRequires: perl(DB_File)
BuildRequires: perl(DBI) perl(DBD::mysql)
BuildRequires: perl(Mail::DKIM)
BuildRequires: perl(LWP::UserAgent)
BuildRequires: perl(Archive::Zip)
BuildRequires: perl(IO::String)
buildrequires: wget
%if 0%{?fedora}
BuildRequires: perl(Devel::Cycle)
BuildRequires: perl(Net::Patricia)
%endif
BuildRequires: perl(Mail::SPF)
BuildRequires: perl(IO::Socket::INET6)
BuildRequires: perl(IO::Socket::SSL)
BuildRequires: perl(Encode::Detect::Detector)
Requires: perl(HTTP::Date) Requires: perl(HTTP::Date)
Requires: perl(LWP::UserAgent) Requires: perl(LWP::UserAgent)
Requires: perl(Net::DNS) Requires: perl(Net::DNS)
Requires: perl(Time::HiRes) Requires: perl(Time::HiRes)
Requires: perl(DB_File) Requires: perl(DB_File)
Requires: perl(Mail::SPF) Requires: perl(Mail::SPF)
Requires: perl(Net::CIDR::Lite) Requires: perl(IO::String)
%if %{require_encode_detect} %if %{require_encode_detect}
Requires: perl(Encode::Detect) Requires: perl(Encode::Detect)
%endif %endif
Requires: perl(BSD::Resource)
Requires: procmail Requires: procmail
Requires: gnupg2 Requires: gnupg2
Requires: perl(XSLoader)
Requires: perl(ExtUtils::MakeMaker)
# Fedora package needs fixing before we can depend on it
#Requires: re2c
# Hard requirements # Hard requirements
BuildRequires: perl-HTML-Parser >= 3.43 BuildRequires: perl-HTML-Parser >= 3.43
@ -146,20 +167,16 @@ Requires: perl(Archive::Tar)
# Optional requirements that might make things better/faster # Optional requirements that might make things better/faster
%if %{patricia_deps} %if %{patricia_deps}
Requires: perl(Net::Patricia) Requires: perl(Net::Patricia)
BuildRequires: perl(Net::Patricia)
%endif %endif
%if %{razor_deps} %if %{razor_deps}
Requires: perl-Razor-Agent Requires: perl-Razor-Agent
BuildRequires: perl-Razor-Agent
%endif %endif
%if %{option_ssl} %if %{option_ssl}
# Needed for spamc/spamd SSL # Needed for spamc/spamd SSL
Requires: perl(IO::Socket::SSL) Requires: perl(IO::Socket::SSL)
BuildRequires: perl(IO::Socket::SSL)
# Needed for IPv6 # Needed for IPv6
Requires: perl(IO::Socket::INET6) Requires: perl(IO::Socket::INET6)
BuildRequires: perl(IO::Socket::INET6)
%endif %endif
%if %{perl_devel} %if %{perl_devel}
BuildRequires: perl-devel BuildRequires: perl-devel
@ -167,7 +184,6 @@ BuildRequires: perl-devel
# Mail::DKIM for F12+, works from RHEL5+ from EPEL5 but we don't require them # Mail::DKIM for F12+, works from RHEL5+ from EPEL5 but we don't require them
%if %{dkim_deps} %if %{dkim_deps}
Requires: perl(Mail::DKIM) Requires: perl(Mail::DKIM)
BuildRequires: perl(Mail::DKIM)
%endif %endif
%if %{use_systemd} %if %{use_systemd}
@ -186,6 +202,7 @@ Requires: perl(Digest::MD5)
Requires: perl(Errno) Requires: perl(Errno)
Requires: perl(Exporter) Requires: perl(Exporter)
Requires: perl(List::Util) Requires: perl(List::Util)
Requires: perl(File::Copy)
%description %description
SpamAssassin provides you with a way to reduce if not completely eliminate SpamAssassin provides you with a way to reduce if not completely eliminate
@ -209,6 +226,17 @@ To filter spam for all users, add that line to /etc/procmailrc
# Patches 0-99 are RH specific # Patches 0-99 are RH specific
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1
# Drop the ResourceLimits plugin - it requires perl(BSD::Resource)
# which is not in RHEL-8
%patch3 -p1
# Reverting this in thel8 to not complicate update process
# https://github.com/apache/spamassassin/commit/f7d39bfd3ef2e5ef4a9de480764ee1d73be9349
%if 0%{?rhel} == 8
%patch4 -p1
%endif
%patch5 -p1
# end of patches # end of patches
echo "RHEL=%{?rhel} FEDORA=%{?fedora}" echo "RHEL=%{?rhel} FEDORA=%{?fedora}"
@ -216,12 +244,12 @@ echo "RHEL=%{?rhel} FEDORA=%{?fedora}"
%build %build
export CFLAGS="$RPM_OPT_FLAGS" export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="%{build_ldflags}" export LDFLAGS="%{build_ldflags}"
%{__perl} Makefile.PL DESTDIR=$RPM_BUILD_ROOT/ SYSCONFDIR=%{_sysconfdir} INSTALLDIRS=vendor ENABLE_SSL="yes" < /dev/null %{__perl} Makefile.PL DESTDIR=$RPM_BUILD_ROOT/ SYSCONFDIR=%{_sysconfdir} INSTALLDIRS=vendor ENABLE_SSL=yes < /dev/null
%make_build OPTIMIZE="$RPM_OPT_FLAGS" %{__make} OPTIMIZE="$RPM_OPT_FLAGS" %{?_smp_mflags}
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%make_install PREFIX=%buildroot/%{prefix} \ %makeinstall PREFIX=%buildroot/%{prefix} \
INSTALLMAN1DIR=%buildroot/%{_mandir}/man1 \ INSTALLMAN1DIR=%buildroot/%{_mandir}/man1 \
INSTALLMAN3DIR=%buildroot/%{_mandir}/man3 \ INSTALLMAN3DIR=%buildroot/%{_mandir}/man3 \
LOCAL_RULES_DIR=%{buildroot}/etc/mail/spamassassin LOCAL_RULES_DIR=%{buildroot}/etc/mail/spamassassin
@ -297,6 +325,10 @@ install -m 0644 %{SOURCE13} $RPM_BUILD_DIR/Mail-SpamAssassin-%{version}/
mkdir -m 0700 -p $RPM_BUILD_ROOT%{_sharedstatedir}/razor/ mkdir -m 0700 -p $RPM_BUILD_ROOT%{_sharedstatedir}/razor/
%endif %endif
%check
rm -f t/relaycountry* t/urilocal*
make disttest
%files -f %{name}-%{version}-filelist %files -f %{name}-%{version}-filelist
%doc LICENSE NOTICE CREDITS Changes README TRADEMARK UPGRADE %doc LICENSE NOTICE CREDITS Changes README TRADEMARK UPGRADE
%doc USAGE sample-nonspam.txt sample-spam.txt %doc USAGE sample-nonspam.txt sample-spam.txt
@ -320,6 +352,9 @@ mkdir -m 0700 -p $RPM_BUILD_ROOT%{_sharedstatedir}/razor/
%{_unitdir}/sa-update.service %{_unitdir}/sa-update.service
%{_unitdir}/sa-update.timer %{_unitdir}/sa-update.timer
%endif %endif
# Don't include sa-compile per rhbz#1639367
%exclude %{_bindir}/sa-compile
%exclude %{_mandir}/man1/sa-compile*
%post %post
%if %{use_systemd} == 0 %if %{use_systemd} == 0
@ -388,89 +423,72 @@ exit 0
%endif %endif
%changelog %changelog
* Mon Jan 17 2022 Martin Osvald <mosvald@redhat.com> - 3.4.6-5 * Mon Dec 13 2021 Martin Osvald <mosvald@redhat.com> - 3.4.6-1
- Forgot to reference CVE-2020-1946 as fixed after rebase to 3.4.6 - Rebase to v3.4.6
- Resolves: #1943848
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.6-4 * Thu Jul 29 2021 Pavel Zhukov <pzhukov@redhat.com> - 3.4.4-4.el4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Fix header parsing
Related: rhbz#1991688
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.6-3 * Tue Oct 6 2020 Pavel Zhukov <pzhukov@redhat.com> - 3.4.4-3
- Rebuilt for RHEL 9 BETA for openssl 3.0 - Add tests BRs
Related: rhbz#1971065
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.6-2 * Tue Oct 6 2020 Pavel Zhukov <pzhukov@redhat.com> - 3.4.4-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - New version v3.4.4
- Enable tests
* Wed Apr 14 2021 Pavel Zhukov <pzhukov@redhat.com> - 3.4.6-1 * Mon Jun 15 2020 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-10
- New release 3.4.6 (#1948520) - Fixed CVE-2018-11805
- Resolves: rhbz#1787514
- Fixed CVE-2020-1930
- Resolves: rhbz#1820649
- Fixed CVE-2020-1931
- Resolves: rhbz#1820650
* Tue Apr 06 2021 Pavel Zhukov <landgraf@fedoraproject.org> - 3.4.5-2 * Thu Apr 09 2020 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-9
- Bump config version - Fix CVE-2019-12420
- Resolves: rhbz#1812977
* Thu Mar 25 2021 Kevin Fenzi <kevin@scrye.com> - 3.4.5-1 * Wed Mar 18 2020 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-8
- Update to 3.4.5. Fixes rhbz#1942575 - Removed the obsolete SOUGHT channel for rule updates
- Fixes CVE-2020-1946 - Resolves: rhbz#1630362
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Nov 21 2020 Kevin Fenzi <kevin@scrye.com> - 3.4.4-7
- Add upstreamed patch for GeoIP handling.
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 3.4.4-5
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jun 23 2020 Jitka Plesnikova <jplesnik@redhat.com> - 3.4.4-4
- Perl 5.32 rebuild
* Wed Apr 22 2020 Kevin Fenzi <kevin@scrye.com> - 3.4.4-3
- Switch update timer to not need spamassassin service. Fixes bug #1645826
* Wed Mar 18 2020 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.4-2
- Remove references to the SOUGHT channel
* Mon Feb 03 2020 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.4-1
- Update to 3.4.4
- Resolves: rhbz#1796196
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jan 04 2020 Kevin Fenzi <kevin@scrye.com> - 3.4.3-2
- Fix mistaken version in rules. Fixes bug #1787739
* Thu Dec 12 2019 Kevin Fenzi <kevin@scrye.com> - 3.4.3-1
- Update to 3.4.3. Fixes bug #1782611
* Tue Oct 01 2019 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-8
- Fix issues found by Coverity Scan
* Tue Oct 01 2019 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-7 * Tue Oct 01 2019 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-7
- Fix rawbody rules documentation - Fix rawbody rules documentation
- Resolves: rhbz#1639251
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.2-6 * Mon Dec 17 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Re-add perl-Encode-Detect and perl-Mail-DKIM dependency
- Resolves: rhbz#1637527
* Fri May 31 2019 Jitka Plesnikova <jplesnik@redhat.com> - 3.4.2-5 * Tue Oct 16 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-5
- Perl 5.30 rebuild - Add dependency for perl(File::Copy)
- Related: rhbz#1639367
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.2-4 * Tue Oct 16 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - Drop non-functioning sa-compile script
- Resolves: rhbz#1639367
* Mon Oct 15 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-3 * Fri Oct 05 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-3
- Add missing dependencies of sa-compile - Temporarily drop dependency on perl-Encode-Detect and perl-Mail-DKIM
- Resolves: rhbz#1636379
* Thu Sep 20 2018 Kevin Fenzi <kevin@scrye.com> - 3.4.2-2 * Wed Oct 03 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-2
- Misc small bug fixes and cleanups. - Support systemd, not SysV init, drop initscripts requirement
- Resolves: rhbz#1610288
- Fix issues found by Coverity Scan
- Resolves: rhbz#1602695
* Sun Sep 16 2018 Kevin Fenzi <kevin@scrye.com> - 3.4.2-1 * Mon Sep 17 2018 Ondřej Lysoněk <olysonek@redhat.com> - 3.4.2-1
- Update to 3.4.2 - New version
- Fixes: CVE-2017-15705, CVE-2016-1238, CVE-2018-11780 & CVE-2018-11781 - Fixes CVE-2017-15705, CVE-2018-11780 and CVE-2018-11781
- Resolves: rhbz#1629523
- Resolves: rhbz#1629535
- Resolves: rhbz#1629538
* Mon Jul 23 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 3.4.1-26
- Dropped GeoIP and optional plugins requiring it
Resolves: rhbz#1607372
* Mon Jul 23 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 3.4.1-25 * Mon Jul 23 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 3.4.1-25
- perl-Razor-Agent and perl-Net-Patricia not used on RHEL - perl-Razor-Agent and perl-Net-Patricia not used on RHEL