[Mimedefang] differing spamassassin configs

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Fri Jan 23 08:37:04 EST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 22 Jan 2015, John Nemeth wrote:

>     I've started looking at scanning outbound mail for spam.  This
> is to prevent being added to RBLs.  As part of this, I would like
> to be able to call spamassassin with different settings.  All
> outbound mail is either coming from the same system or authenticated
> users, so when scanning outbound mail I don't want any RBLs being
> consulted.  However, I still want RBLs to be consulted for inbound
> mail.  I've looked at mimedefang.pl and don't see any easy way to
> do this.  The only obvious thing is to set $SASpamTester to undef
> before each call to spamassassin.  I'm wondering if a destructor
> function should be called or if this would result in a memory leak.
> Does anybody have any other suggestions?

Checkout the top of the mimedefang-filter

# The next lines force SpamAssassin modules to be loaded and rules
# to be compiled immediately.  This may improve performance on busy
# mail servers.  Comment the lines out if you don't like them.
if ($Features{"SpamAssassin"}) {
     spam_assassin_init()->compile_now(1) if defined(spam_assassin_init());

     # If you want to use auto-whitelisting:
#   if (defined($SASpamTester)) {
#       use Mail::SpamAssassin::DBBasedAddrList;
#       my $awl = Mail::SpamAssassin::DBBasedAddrList->new();
#       $SASpamTester->set_persistent_address_list_factory($awl) if defined($awl);
#   }
}

Do this once for one config, save the $SASpamTester in yet another global 
var, e.g. my_SA_inbound; undef $SASpamTester; do this for the second 
config and save $SASpamTester into, say, my_SA_outbound

Now, before you scan, assign either my_SA_* to $SASpamTester.

However, if you have a large ruleset, you load it twice into memory. Also 
look at $SALocalTestsOnly .

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEVAwUBVMJOgFGgR0+MU/4GAQJxLQf9GvPkwjotUVXmCDo5VZ3aLo/65hg6eUKc
GZ0LETWOJoyYRICSByTzp9IQwqxnRER70XaiTbGm1l852NIx+tRBdAzp5xH5baPU
XkgNMBMoQKO6qe8nfcIzscj1FNHXCjOdwpDxwS7FrGStyFtAuLsY8WLuIIDDxAL/
3MITqiLv4YnXPuWxWuBIb8aH4zvaHZ7FRFC38YIdGFv1a9wJp03gSOyDK+x41P+X
2cYKBftTNPX64JQNCCvmrQT+QELocBEUjIJ7yxmdiEcuUJkhzfMSk0SH/+rnJGon
vIuIHn50BuMD3lylR2kvrmcCwNUNTCTmvL9fP081MNEwC1JAwKwmoA==
=2G+8
-----END PGP SIGNATURE-----



More information about the MIMEDefang mailing list