Package spampd Tags 344373 + patch Thanks Maxim Paperno wrote on 23/12/2005 17:48: > At 12/23/2005 04:47 PM +0100, Sven Mueller wrote: > > >>I could say that setting up a mailserver with any kind of mail filtering >>isn't something for an unexperienced user. However, I'm not gonna do >>this (I would consider that cheating). > > > Whoops.... 0:-] > > > >>It would still make sense to configure spamassassin to use some central >>storage for the bayes and awl databases, but this could now be done in a >>configuration file only evaluated when SpamAssassin is used through >>spampd (or when the user uses --prefs-file=/etc/spampd.conf when >>executing spamassassin or sa-learn). This would stop spampd usage from >>interfering with local spamassasssin users. And if we add a commandline >>option for this, it would even make it possible for multiple instances >>of spampd to use different spamassassin configurations. > > I like it as an option, for all the reasons you mention. Actually makes > the setup more complex, potentially anyway, but that's what options > are all about :) I don't know that it makes sense to distribute spampd > with this option enabled (ie. an extra config file to worry about), but > that's up to you. This should be pretty easy to add (if I can get my dev > box to boot... ugh).
Alright, I finally found some time to spend on this bug. Attached is the patch to spampd itself for this. It adds a commandline option (--config= or --C=) to specify an _additional_ configuration file. It works like the --prefs-file= option to spamassassin would, i.e. it overrides options given in the normal spamassassin configuration. The filename has a default (/etc/spampd.conf). If the file doesn't exist or isn't readable by the spampd user, SpamAssassin might issue a warning, but it doesn't ever try to create that file. /me is currently thinking wether to make the default value an empty string (or undef) and user the compile_now(0) if it is empty (or undef) and compile_now() if it is not. Opinions? Hmm, I think that's the best thing to do. I will work on that and send that patch later. The Debian spampd package will ship with a /etc/spampd.conf file following the next upload. The file will essentially only contain a few comments and commented-out configuration options, but is suitable as an example of what might need configuration and what values to use there. The package will also include a directory suitable for lock files and/or autowhitelist/bayes-DBs. Regards, Sven
#! /bin/sh /usr/share/dpatch/dpatch-run
## 60-dont-open-userprefs.dpatch by Sven Mueller <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Dont open user preferences for spamassassin
@DPATCH@
diff -urNad trunk/spampd /tmp/dpep.86ko1E/trunk/spampd
--- trunk/spampd 2006-06-13 16:29:54.000000000 +0200
+++ /tmp/dpep.86ko1E/trunk/spampd 2006-06-13 17:08:52.002725067 +0200
@@ -778,6 +778,7 @@
my $satimeout = 285; # SpamAssassin timeout in seconds (15s less than Postfix
# default for smtp_data_done_timeout)
my $pidfile = '/var/run/spampd.pid'; # write pid to file
+my $configfile = '/etc/spampd.conf'; # file to read spampd specific config from
my $user = 'mail'; # user to run as
my $group = 'mail'; # group to run as
my $tagall = 0; # mark-up all msgs with SA, not just spam
@@ -809,6 +810,7 @@
relayhost => \$relayhost,
relayport => \$relayport,
pid => \$pidfile,
+ config => \$configfile,
user => \$user,
group => \$group,
maxrequests => \$maxrequests,
@@ -845,6 +847,7 @@
'debug|d',
'help|h|?',
'local-only|l',
+ 'config|C=s',
'log-rules-hit|rh',
'dose',
'add-sc-header|ash', # deprecated
@@ -869,6 +872,7 @@
if ( $options{'nodetach'} ) { $background = undef; }
if ( $options{'set-envelope-headers'} ) { $envelopeheaders = 1; }
if ( $options{'set-envelope-from'} ) { $setenvelopefrom = 1; }
+if ( $options{'config'} ) { $configfile = $options{'config'}; }
# if ( !$options{maxchildren} or $maxchildren < $children ) { $maxchildren =
$children; }
if ( $children < 1 ) { print "Option --children must be greater than zero!\n";
exit shift; }
@@ -887,6 +891,7 @@
my $assassin = Mail::SpamAssassin->new({
'dont_copy_prefs' => 1,
'debug' => $debug,
+ 'userprefs_filename' => $options{'config'},
'local_tests_only' => $options{'local-only'} || 0 });
$options{'auto-whitelist'} and eval {
@@ -1087,6 +1092,7 @@
[B<--set-envelope-from|sef>]
[B<--auto-whitelist|aw>]
[B<--local-only|L>]
+[B<--config|C=filename>]
[B<--debug|d>]
B<spampd> B<--help>
@@ -1416,6 +1422,12 @@
Turn off all SA network-based tests (DNS, Razor, etc).
+=item B<--config=filename> or B<--C filename>
+
+Use the specified filename as the config read by spampd (note: In addition
+to SpamAssassin's normal configuration files, like a user config). Defaults
+to /etc/spampd.conf.
+
=item B<--debug> or B<--d>
Turns on SpamAssassin debug messages which print to the system mail log
signature.asc
Description: OpenPGP digital signature

