Skip to content

Commit

Permalink
mail/spamassassin: Update to 4.0.0
Browse files Browse the repository at this point in the history
Tested on NetBSD 9 amd64 with postfix and spamass-milter.  NB the rule
renaming below and the modified init.pre, which will not be merged by
updating if init.pre is locally modifed.


Upstream Release Notes:


Introduction
------------

Apache SpamAssassin 4.0.0 contains numerous tweaks and bug fixes over
the past releases. In particular, it includes major changes that
significantly improve the handling of text in international language.

As with any major release, there are countless functional patches and
improvements to upgrade to 4.0.0. Apache SpamAssassin 4.0.0 includes
several years of fixes that significantly improve classification and
performance. It has been thoroughly tested in production systems. We
strongly recommend upgrading as soon as possible.


Notable features:
=================


New plugins
-----------

There are three new plugins added with this release:


#1 Mail::SpamAssassin::Plugin::ExtractText

This plugin uses external tools to extract text from message parts,
and then sets the text as the rendered part. All SpamAssassin rules
that apply to the rendered part will run on the extracted text as
well.


#2 Mail::SpamAssassin::Plugin::DMARC

This plugin checks if emails match DMARC policy after parsing DKIM and
SPF results.


#3 Mail::SpamAssassin::Plugin::DecodeShortURLs

This plugin looks for URLs shortened by a list of URL shortening
services. Upon finding a matching URL, plugin will send a HTTP request
to the shortening service and retrieve the Location-header which
points to the actual shortened URL. It then adds this URL to the list
of URIs extracted by SpamAssassin which can then be accessed by uri
rules and plugins such as URIDNSBL.


Removed plugin
--------------

HashCash module, formerly deprecated, has now been removed completely


Notable changes
---------------

This release includes fixes for the following:

  - Support for international text such as UTF-8 rules has been
     completed and significantly improved to include native UTF-8
     processing

  - Bayes plugin has been improved to skip common words aka noise
     words written in languages other than English

  - OLEVBMacro plugin has been improved in order to detect more
     Microsoft Office macros and dangerous content. It has also been
     improved to extract URIs from Office documents for automatic
     inclusion in rules such as RBL lookups.

  - You can now use Captured Tags to use tags “captured” in one rule
     inside other rules

  - sa-update(1) tool has been improved with three new options:

    #1 forcemirror: forces sa-update to use a specific mirror server,

    #2 score-multiplier: adjust all scores from update channel by a
      given multiplier to quickly level set scores to match your
      preferred threshold

    #3 score-limit adjusts all scores from update channel over a
      specified limit to a new limit

* SSL client certificate support has been improved and made easier to
   implement with spamc/spamd

* DKIM plugin can now detect ARC signatures

* More work on improving the configuration and internal coding to use
  more inclusive and less divisive language

* spamc(1) speed has been improved when both SSL and compression are
  used

* The normalize_charset option is now enabled by default. NOTE: Rules
  should not expect specific non-UTF-8 or UTF-8 encoding in the body.
  Matching is done against the raw body, which may vary depending on
  normalize_charset setting and whether UTF-8 decoding was successful.

* Mail::SPF is now the only supported module used by the SPF plugin.

* Mail::SPF::Query use is deprecated, along with settings
  do_not_use_mail_spf, do_not_use_mail_spf_query.

 * SPF lookups are not done asynchronously and you may consider using
   an SPF filter at the MTA level (pypolicyd-spf / spf-engine / etc)
   which generates a Received-SPF header that can be parsed by
   SpamAssassin.

 * The default sa-update ruleset doesn't make ASN lookups or header
   additions anymore.  Configure desired methods (asn_use_geodb /
   asn_use_dns) and add_header clauses manually, as described in
   documentation for the Mail::SpamAssassin::Plugin::ASN.


New configuration options
-------------------------

All rules, functions, command line options and modules that contain
"whitelist" or "blacklist" have been renamed to "welcomelist" and
"blocklist" terms

Old options will continue to work for backwards compatibility until at
least the Apache SpamAssassin version 4.1.0 release

New tflag "nolog" added to hide info coming from rules in SpamAssassin
reports

New dns_options "nov4" and "nov6" added.
IMPORTANT:; You must set nov6 if your DNS resolver is filtering IPv6
AAAA replies.

Razor2 razor_fork option added. It will fork separate Razor2 process
and read in the results later asynchronously, increasing
throughput. When this is used, rule priorities are automatically
adjusted to -100.

Pyzor pyzor_fork option added. It will fork separate Pyzor process and
read in the results later asynchronously, increasing throughput. When
this is used, rule priorities are automatically adjusted to -100

urirhsbl and urirhssub rules now support "notrim" tflag, which forces
querying the full hostname, instead of trimmed domain

report_charset now defaults to UTF-8 which may change the rendering of
SpamAssassin reports

Notable Internal changes
------------------------

Meta rules no longer use priority values, they are evaluated
dynamically when the rules they depend on are finished

DNS and other asynchronous lookups like DCC or Razor2 plugins are now
launched when priority -100 is reached. This allows short circuiting
at lower priority without sending unneeded DNS queries

New internal Mail::SpamAssassin::GeoDB module supporting RelayCountry
and URILocalBL plugins provides a unified interface to Geographic IP
modules. These include:
    MaxMind::DB::Reader (GeoIP2)
    Geo::IP
    IP::Country::DB_File
    IP::Country::Fast.

Bayes and TxRep Message-ID tracking now uses a different hashing
method


Optimizations
-------------

Apache SpamAssassin 4.0.0 represents years of work by the project with
numerous improvements, new rule types, and internal native handling of
messages in international languages. These three key optimizations
will improve the efficiency of SpamAssassin:

    DNS queries are now done asynchronously for overall speed
    improvements

    DCC checks can now use dccifd asynchronously for improved throughput

    Pyzor and Razor fork use separate processes done asynchronously
    for increased throughput
  • Loading branch information
gdt committed Dec 17, 2022
1 parent 39def20 commit 3e7af93
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 42 deletions.
12 changes: 6 additions & 6 deletions mail/spamassassin/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# $NetBSD: Makefile,v 1.147 2022/08/16 14:21:48 wiz Exp $
# $NetBSD: Makefile,v 1.148 2022/12/17 14:29:33 gdt Exp $

VERSION= 3.4.6
VERSION= 4.0.0
DISTNAME= Mail-SpamAssassin-${VERSION}
PKGNAME= spamassassin-${VERSION}
PKGREVISION= 3
CATEGORIES= mail perl5
MASTER_SITES= ${MASTER_SITE_APACHE:=spamassassin/source/}
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
Expand All @@ -23,7 +22,7 @@ SMF_METHODS= spamassassin

# The RULESARCHIVE path is taken from the link on the Download page
# reachable from $HOMEPAGE.
RULESARCHIVE= Mail-SpamAssassin-rules-3.4.6.r1888502.tgz
RULESARCHIVE= Mail-SpamAssassin-rules-4.0.0.r1905950.tgz
RULESARCHIVEASC= ${RULESARCHIVE}.asc
#RULESARCHIVESHA= ${RULESARCHIVE}.sha1
FILES_SUBST+= RULESARCHIVE=${RULESDIR}/${RULESARCHIVE}
Expand All @@ -38,6 +37,7 @@ DEPENDS+= p5-HTML-Parser>=3.43:../../www/p5-HTML-Parser
#DEPENDS+= {perl>=5.9.3,p5-IO-Compress-[0-9]*}:../../devel/p5-IO-Compress # Compress::Zlib>=0
#DEPENDS+= {perl>=5.9.3,p5-IO-Zlib>=1.04}:../../devel/p5-IO-Zlib
DEPENDS+= p5-Mail-DKIM>=0.40:../../mail/p5-Mail-DKIM
#DEPENDS+= p5-Mail-DMARC-PurePerl-[0-9]*:../../mail/p5-Mail-DMARC-PurePerl
DEPENDS+= p5-Mail-SPF-[0-9]*:../../mail/p5-Mail-SPF
#DEPENDS+= {p5-MIME-Base64>=2.11,perl>=5.8.0}:../../converters/p5-MIME-Base64
DEPENDS+= p5-NetAddr-IP>=4.007:../../net/p5-NetAddr-IP
Expand Down Expand Up @@ -103,7 +103,7 @@ DOCDIR= ${PREFIX}/${DOC_SUBDIR}
RULE_SUBDIR= share/spamassassin
RULESDIR= ${PREFIX}/${RULE_SUBDIR}

PRE_FILES= init.pre v310.pre v312.pre v320.pre v330.pre v340.pre
PRE_FILES= init.pre v310.pre v312.pre v320.pre v330.pre v340.pre v400.pre
.for p in ${PRE_FILES}
CONF_FILES+= ${EGDIR}/${p} ${PKG_SYSCONFDIR}/${p}
.endfor
Expand Down Expand Up @@ -141,7 +141,7 @@ SUBST_VARS.sa2+= VARBASE
SUBST_CLASSES+= sa3
SUBST_MESSAGE.sa3= Setting correct paths for pkgsrc (part 2)
SUBST_STAGE.sa3= pre-configure
SUBST_FILES.sa3= INSTALL UPGRADE USAGE ldap/README
SUBST_FILES.sa3= INSTALL USAGE ldap/README
SUBST_FILES.sa3+= spamc/README.qmail spamc/spamc.pod
SUBST_FILES.sa3+= lib/Mail/SpamAssassin/Conf.pm
SUBST_FILES.sa3+= lib/Mail/SpamAssassin/Plugin/Test.pm
Expand Down
24 changes: 12 additions & 12 deletions mail/spamassassin/distinfo
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
$NetBSD: distinfo,v 1.80 2022/08/16 14:21:48 wiz Exp $
$NetBSD: distinfo,v 1.81 2022/12/17 14:29:33 gdt Exp $

BLAKE2s (Mail-SpamAssassin-3.4.6.tar.gz) = d330863c4775e9dfc3ffb8158e3b145a3e43ff9122e686a074be7c2d1a2cb65d
SHA512 (Mail-SpamAssassin-3.4.6.tar.gz) = 7910852f04463a7363a2fc3b70a35adadf5714552e57c5b8ca57beaa534ee18d9f06526cdbcf8bcd5781e5ca778f98d2f84ef2efd1872fa550cfe1689440364a
Size (Mail-SpamAssassin-3.4.6.tar.gz) = 6572574 bytes
BLAKE2s (Mail-SpamAssassin-rules-3.4.6.r1888502.tgz) = 5ac6070924cf3093fda442bf1cbc059ea3dd98df0d9eea7eaad45eea6f7a177e
SHA512 (Mail-SpamAssassin-rules-3.4.6.r1888502.tgz) = 29167c2ab50de26954181ad53395d4270b8b15b7d3bb13d6c62aa2f13ed3bb7a54adcda944bbd4c8d0cf4fe918a2eb0f542ef420af2bd96a121cb3d9b55dd572
Size (Mail-SpamAssassin-rules-3.4.6.r1888502.tgz) = 369768 bytes
BLAKE2s (Mail-SpamAssassin-rules-3.4.6.r1888502.tgz.asc) = e1c0171d935698f2f3241a45ae16e34d990727ba8c0d6195e658eb77e4959b04
SHA512 (Mail-SpamAssassin-rules-3.4.6.r1888502.tgz.asc) = 97066dfe751aa067b14368ebd0388666522257945bd0fd37d921371682209be6bd658199ca817bb0dd345c4ddb1cebe02015ca9ca3a33f167d68b7d029a07b0c
Size (Mail-SpamAssassin-rules-3.4.6.r1888502.tgz.asc) = 833 bytes
SHA1 (patch-Makefile.PL) = bcf48afe3adce57fbe4ff0de583ca23bf5177aab
BLAKE2s (Mail-SpamAssassin-4.0.0.tar.gz) = fdcc278214de88b9796e678b5902ded5100e2c30dbb5725c4b5aea027980e340
SHA512 (Mail-SpamAssassin-4.0.0.tar.gz) = db8e5d0249d9fabfa89bc4c7309a7eafd103ae07617ed9bd32e6b35473c5efc05b1a913b4a3d4bb0ff19093400e3510ae602bf9e96290c63e7946a1d0df6de47
Size (Mail-SpamAssassin-4.0.0.tar.gz) = 6779828 bytes
BLAKE2s (Mail-SpamAssassin-rules-4.0.0.r1905950.tgz) = f69d64dbe6ac98e556013540cf61889b8013dbca890577a1142a4ef6f5d33a5f
SHA512 (Mail-SpamAssassin-rules-4.0.0.r1905950.tgz) = 8ff0e68e18dc52a88fec83239bb9dc3a1d34f2dcb4c03cd6c566b97fa91242e3c8d006612aeb4df0acf43929eaaa59d542eb5cf904498343adf5eadefcb89255
Size (Mail-SpamAssassin-rules-4.0.0.r1905950.tgz) = 355737 bytes
BLAKE2s (Mail-SpamAssassin-rules-4.0.0.r1905950.tgz.asc) = 445aee22649a330357df398cd0694535cd09e83abbaf8f3d338de5f842ed8160
SHA512 (Mail-SpamAssassin-rules-4.0.0.r1905950.tgz.asc) = 517dbf83b4cf984036cb7cbf92a290ea0c8eea1da87f80d202275e71d2823b7b2eed4efff2f71742ca28090d355a690346f1bf97cfc15a3ea26a6d52792b1882
Size (Mail-SpamAssassin-rules-4.0.0.r1905950.tgz.asc) = 833 bytes
SHA1 (patch-Makefile.PL) = f190b064069506aa9afb1b6ecd8affea78104699
SHA1 (patch-README) = 5d2aaecc4791e4f76df1078c17036cc23a39a8d0
SHA1 (patch-ae) = e6e83c1de1002b8db647779d17740e67103b69d8
SHA1 (patch-sa-update) = 0cac6f2315db8f80cd313473e8d141b49edb791f
SHA1 (patch-spamc_libspamc.c) = 757b845df445414d4ba0c2fb039dbc6d9e68b85f
SHA1 (patch-spamc_libspamc.c) = 6e634b5e4e795bd1e2bddbe4b192e2826de8ba5a
SHA1 (patch-spamd_netbsd-rc-script.sh) = 192fc1876ee30a4475c0efd9be6340e87d9fa2f4
10 changes: 6 additions & 4 deletions mail/spamassassin/patches/patch-Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
$NetBSD: patch-Makefile.PL,v 1.6 2020/03/23 18:45:47 gdt Exp $
$NetBSD: patch-Makefile.PL,v 1.7 2022/12/17 14:29:33 gdt Exp $

- enable build of qmail-spamc
- some files (local.cf, *.pre) are managed by pkgsrc, disable
their installation.
- pkgsrc creates B_DATADIR, so there is no need to re-set permissions

--- Makefile.PL.orig 2020-01-25 02:51:33.000000000 +0000
--- Makefile.PL.orig 2022-12-06 23:27:28.000000000 +0000
+++ Makefile.PL
@@ -139,6 +139,7 @@ my %makefile = (
@@ -134,6 +134,7 @@ my %makefile = (
'spamassassin.raw' => 'spamassassin',
'sa-learn.raw' => 'sa-learn',
'sa-update.raw' => 'sa-update',
+ 'spamc/qmail-spamc.c' => 'spamc/qmail-spamc$(EXE_EXT)',
'sa-compile.raw' => 'sa-compile',
'sa-awl.raw' => 'sa-awl',
'sa-check_spamd.raw' => 'sa-check_spamd',
@@ -1120,22 +1121,24 @@ qmail/qmail-spamc$(EXE_EXT): spamc/qmail
@@ -1150,23 +1151,25 @@ qmail/qmail-spamc$(EXE_EXT): spamc/qmail

conf__install:
-$(MKPATH) $(B_CONFDIR)
Expand All @@ -29,6 +29,7 @@ $NetBSD: patch-Makefile.PL,v 1.6 2020/03/23 18:45:47 gdt Exp $
- $(PERL) -MFile::Copy -e "copy(q[rules/v341.pre], q[$(B_CONFDIR)/v341.pre]) unless -f q[$(B_CONFDIR)/v341.pre]"
- $(PERL) -MFile::Copy -e "copy(q[rules/v342.pre], q[$(B_CONFDIR)/v342.pre]) unless -f q[$(B_CONFDIR)/v342.pre]"
- $(PERL) -MFile::Copy -e "copy(q[rules/v343.pre], q[$(B_CONFDIR)/v343.pre]) unless -f q[$(B_CONFDIR)/v343.pre]"
- $(PERL) -MFile::Copy -e "copy(q[rules/v400.pre], q[$(B_CONFDIR)/v400.pre]) unless -f q[$(B_CONFDIR)/v400.pre]"
+ # manage local.cf and *.pre through pkgsrc .mk files
+ # $(PERL) -MFile::Copy -e "copy(q[rules/local.cf], q[$(B_CONFDIR)/local.cf]) unless -f q[$(B_CONFDIR)/local.cf]"
+ # $(PERL) -MFile::Copy -e "copy(q[rules/init.pre], q[$(B_CONFDIR)/init.pre]) unless -f q[$(B_CONFDIR)/init.pre]"
Expand All @@ -40,6 +41,7 @@ $NetBSD: patch-Makefile.PL,v 1.6 2020/03/23 18:45:47 gdt Exp $
+ # $(PERL) -MFile::Copy -e "copy(q[rules/v341.pre], q[$(B_CONFDIR)/v341.pre]) unless -f q[$(B_CONFDIR)/v341.pre]"
+ # $(PERL) -MFile::Copy -e "copy(q[rules/v342.pre], q[$(B_CONFDIR)/v342.pre]) unless -f q[$(B_CONFDIR)/v342.pre]"
+ # $(PERL) -MFile::Copy -e "copy(q[rules/v343.pre], q[$(B_CONFDIR)/v343.pre]) unless -f q[$(B_CONFDIR)/v343.pre]"
+ # $(PERL) -MFile::Copy -e "copy(q[rules/v400.pre], q[$(B_CONFDIR)/v400.pre]) unless -f q[$(B_CONFDIR)/v400.pre]"

data__install:
-$(MKPATH) $(B_DATADIR)
Expand Down
31 changes: 11 additions & 20 deletions mail/spamassassin/patches/patch-spamc_libspamc.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
$NetBSD: patch-spamc_libspamc.c,v 1.2 2018/10/18 19:54:32 bsiegert Exp $
$NetBSD: patch-spamc_libspamc.c,v 1.3 2022/12/17 14:29:33 gdt Exp $

Set the client protocol to TLS instead of SSLv3.
Fixes build with current openssl.

--- spamc/libspamc.c.orig 2015-04-28 19:56:59.000000000 +0000
--- spamc/libspamc.c.orig 2022-12-06 23:27:29.000000000 +0000
+++ spamc/libspamc.c
@@ -1214,7 +1214,7 @@
if (flags & SPAMC_USE_SSL) {
#ifdef SPAMC_SSL
SSLeay_add_ssl_algorithms();
- meth = SSLv23_client_method();
+ meth = TLSv1_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new(meth);
#else
@@ -1601,7 +1601,7 @@
if (flags & SPAMC_USE_SSL) {
#ifdef SPAMC_SSL
SSLeay_add_ssl_algorithms();
- meth = SSLv23_client_method();
+ meth = TLSv1_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new(meth);
#else
@@ -636,7 +636,7 @@ static SSL_CTX * _try_ssl_ctx_init(int f
SSLeay_add_ssl_algorithms();
SSL_load_error_strings();
/* this method allows negotiation of version */
- meth = SSLv23_client_method();
+ meth = TLSv1_client_method();
ctx = SSL_CTX_new(meth);
if (ctx == NULL) {
libspamc_log(flags, LOG_ERR, "cannot create SSL CTX context: %s",

0 comments on commit 3e7af93

Please sign in to comment.