ending the spam.assassin.prefs.conf madness.

Rick Cooper rcooper at dwford.com
Tue Nov 22 12:15:24 GMT 2005



> -----Original Message-----
> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]On
> Behalf Of Julian Field
> Sent: Tuesday, November 22, 2005 6:14 AM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: ending the spam.assassin.prefs.conf madness.
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
>
> On 22 Nov 2005, at 10:17, Anthony Peacock wrote:
>
> > Hi,
> >
> >> Julian Field wrote:
> >>> Therein lies the problem. I could run the "spamassassin" or
> >>> "sa-learn" script to try to find out, but I equally well won't know
> >>> where they are, they may not be on the $PATH (e.g. Solaris).
> >>>
> >>> But if we say I can find the "spamassassin" script (I'll work on
> >>> that), then which of these lines is the one that states the
> >>> directory I should be using? And what should the file be called? Is
> >>> it local.cf or something else? I need to get this right this time.
> >>
> >> I would suggest using mailscanner.cf as a filename. This way you are
> >> unlikely to muck-up a user's already existing local.cf file.
> >>
> >> (SA will automatically parse *.cf in the site rules dir, so both will
> >> get parsed. Since parsing is in alphabetic order, and last-parsed
> >> wins, options in mailscanner.cf will over-ride options in local.cf)
> >
> > I would agree with this as a suggestion.  It would also mean that the
> > MailScanner sitewide config options would be picked up by the command
> > line SpamAssassin utilities.  That way when someone wanted to test a
> > email against SpamAssassin they would be using the same
> > configuration.  The same goes for using sa-learn.
> >
> > As well as doing this the comments at the top of the
> > spam.assassin.prefs file should make it clear that a new sitewide .cf
> > file has been created so that admins can check that it is not
> > overiding anything that is already set up and working.
>
> I entirely agree. One request though: I have been trying to dig
> through the SA data structures to work out how to get at the
> properties mentioned to calculate the directory path names so I know
> where to put the mailscanner.cf file. I can't figure it out.


This will get all relevent paths and version,

#!/usr/bin/perl
use Mail::SpamAssassin ;
my $test = Mail::SpamAssassin->new();

my $SAVersion = $Mail::SpamAssassin::VERSION;
my $siterules = $test->{site_rules_filename};
$siterules ||= $test->first_existing_path
(@Mail::SpamAssassin::site_rules_path);

my $defaultrules = $test->{default_rules_path};
$defaultrules ||= $test->first_existing_path
(@Mail::SpamAssassin::default_rules_path);

my $defaultprefs = $test->{default_prefs_path};
$defaultprefs ||= $test->first_existing_path
(@Mail::SpamAssassin::default_prefs_path);

my $defaultuserprefs = $test->{default_userprefs_path};
$defaultuserprefs ||= $test->first_existing_path
(@Mail::SpamAssassin::default_userprefs_path);

my $defaultuserstate = $test->{default_userstate_dir};
$defaultuserstate ||= $test->first_existing_path
(@Mail::SpamAssassin::default_userstate_dir);

print "SpamAssassin Version\t: $SAVersion\n";
print "Site Rules Path\t\t: $siterules\n";
print "Default Rules Path\t: $defaultrules\n";
print "Default Prefs Path\t: $defaultprefs\n";
print "Default User Prefs\t: $defaultuserprefs\n";
print "Default User State\t: $defaultuserstate\n";


Rick


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





More information about the MailScanner mailing list