Skip to content

Commit 24bd323

Browse files
committed
Update changelog and POD file.
1 parent 0aa55f3 commit 24bd323

File tree

2 files changed

+111
-55
lines changed

2 files changed

+111
-55
lines changed

changelog.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ SpamPD Change Log
88
! : important change, change of default behavior, etc.
99
-----------------------------------------------------------
1010

11-
2.61 (30-Jul-21)
11+
2.61 (3-Aug-21)
1212

13-
Minor bug fixes. Thanks to Simon Matter for reporting and testing.
13+
Bug fixes, new features, and some optimization. Thanks to Simon Matter for reporting, suggestions, and testing!
1414

1515
* Restore syslog as default logging destination (https://github.com/mpaperno/spampd/issues/31)
1616
* Fix issues with older Perl versions (https://github.com/mpaperno/spampd/issues/30)
17+
~ Optimize initial header processing when building message line array in process_message().
18+
~ Slight optimization to LMTP multi-recipient handling in process_request().
19+
~ Optimize how rewritten (tagged) message is saved back to temp file.
20+
+ Add detection and logging of "RULESVERSION" tag with SA >= v3.4.0.
21+
+ Add tracking of some per-child runtime statistics which by default are now shown in the child process names.
22+
+ Add ability to provide a custom child process name template string (or not modify the child name at all).
23+
Template format documented in POD. (https://github.com/mpaperno/spampd/issues/32)
24+
+ Add _SPAMPDVERSION_ as a "template tag" (macro), eg. for use in SA add_header directives.
1725

1826

1927
2.60 (26-Jul-21)
@@ -30,7 +38,7 @@ This version brings quite a few changes, though the base functionality and compa
3038
+ Add --show <thing> argument for printing default option values and other debug.
3139
* Fix SpamAssassin debug logging with versions 3.1+ (output was going to stderr/wrong syslog/null).
3240
* Fix for IPv6 addresses being used on --host and --relayhost options (was not possible due to ":<port>" check).
33-
! SIGHUP will now reload SpamAssassin and SpamPD configuration files, still with graceful child process shutdown.
41+
! SIGHUP will now reload SpamAssassin and SpamPD configuration files (and all module code), still with graceful child process shutdown.
3442
! Use SpamAssassin::Logger module (with SA 3.1+) for all logging. This now inits logging much earlier.
3543
! Log to stderr by default if running non-daemonized (with --nodetach).
3644
! Child processes are now renamed to "spampd child" to distinguish them from the parent in task lists.

spampd.pod

+100-52
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Options:
5555
--maxrequests or -r <n> Maximum requests that each child can process.
5656
--childtimeout <n> Time out children after this many seconds.
5757
--satimeout <n> Time out SpamAssassin after this many seconds.
58+
--child-name-template [s] Template for formatting child process name.
5859

5960
--pid or -p <filename> Store the daemon's process ID in this file.
6061
--user or -u <user> Specifies the user that the daemon runs as.
@@ -70,7 +71,7 @@ Options:
7071
--set-envelope-from Set X-Envelope-From header only.
7172

7273
--local-only or -L Turn off all SA network-based tests.
73-
--homedir path Use the specified directory as SA home.
74+
--homedir <path> Use the specified directory as SA home.
7475
--saconfig <filename> Use the file for SA "user_prefs" configuration.
7576

7677
--logfile or -o <dest> Destination for logs (syslog|stderr|<filename>).
@@ -215,11 +216,19 @@ to peruse the MIAB L<setup|https://github.com/mail-in-a-box/mailinabox/tree/mast
215216
L<configuration|https://github.com/mail-in-a-box/mailinabox/tree/master/conf> files for reference.
216217

217218
All I<spampd> options have reasonable defaults, especially for a Postfix-centric
218-
installation. You may want to specify the --children option if you have an
219+
installation. You may want to specify the C<--max-servers> option if you have an
219220
especially beefy or weak server box because I<spampd> is a memory-hungry
220221
program. Check the L<"Options"> for details on this and all other parameters.
221222

222-
Note that B<I<spampd> replaces I<spamd>> from the I<SpamAssassin> distribution
223+
To show default values for all options, run C<spampd --show defaults>.
224+
225+
B<Since v2.61> I<spampd> injects a C<_SPAMPDVERSION_>
226+
L<"template tag"|https://spamassassin.apache.org/doc/Mail_SpamAssassin_Conf.html#TEMPLATE-TAGS>
227+
macro at message processing time. This can be used in an C<add_header> SA config file directive, for example.
228+
229+
add_header all Filter-Version SpamAssassin _VERSION_ (_SUBVERSION_, Rules: _RULESVERSION_) / SpamPD _SPAMPDVERSION_
230+
231+
Note that B< I<spampd> replaces I<spamd> > from the I<SpamAssassin> distribution
223232
in function. You do not need to run I<spamd> in order for I<spampd> to work.
224233
This has apparently been the source of some confusion, so now you know.
225234

@@ -303,6 +312,7 @@ Also note that v2.60 added the ability to use a L</"CONFIGURATION FILE"> for spe
303312
[--max-servers | -mxs <n>] [--maxsize <n> ] [--[no]detach ]
304313
[--maxrequests | -r <n>] [--local-only | -L ] [--[no]setsid ]
305314
[--childtimeout <n>] [--tagall | -a ] [--log-rules-hit | -rh]
315+
[ --child-name-template | -cnt [<template>] ] [--homedir <path> ]
306316
[ [--set-envelope-headers | -seh] | [--set-envelope-from | -sef] ]
307317

308318
[ --logfile | -o (syslog|stderr|<filename>) ][...]
@@ -326,7 +336,7 @@ same option loaded from config file(s).
326336
Please be sure to also read the general information about specifying option
327337
arguments in the above L</"USAGE"> section.
328338

329-
To show default values for all options, run C<spampd --show defaults>.
339+
To view B<default values> for all options, run C<spampd --show defaults>.
330340

331341
=over 5
332342

@@ -360,9 +370,9 @@ public interface (IP address) unless you know exactly what you're doing!
360370

361371
=item B<--port> I<<n>>
362372

363-
Specifies what port I<spampd> listens on. By default, it listens on
364-
port 10025. This is an alternate to using the above --host=ip:port notation.
365-
Note that a I<port> specified in the C<--host> option will override this one.
373+
Specifies what port I<spampd> listens on. This is an alternate to using the above
374+
C<--host=ip:port> notation. Note that a I<port> specified in the C<--host> option
375+
will override this one.
366376

367377

368378
=item B<--socket> I<<socketpath>>
@@ -380,8 +390,7 @@ format, e.g. 700 to specify acces only for the user I<spampd> is run as.
380390
=item B<--relayhost> I<< (<ip>|<hostname>)[:<port>] >>
381391

382392
Specifies the hostname/IP to which I<spampd> will relay all
383-
messages. Defaults to 127.0.0.1 (localhost). If the port is not provided, that
384-
defaults to 25.
393+
messages. Defaults to 127.0.0.1 (localhost) on port 25.
385394

386395
As of v2.60 this option can also handle IPv6 addresses in the form of
387396
C<--relayhost n:n:n> or, with port, C<--relayhost [n:n:n]:port> (the square brackets
@@ -392,7 +401,7 @@ Note that the I<port> specified this way implicitly overrides the C<--relayport>
392401

393402
=item B<--relayport> I<<n>>
394403

395-
Specifies what port I<spampd> will relay to. Default is 25. This is an
404+
Specifies what port I<spampd> will relay to. This is an
396405
alternate to using the above --relayhost=ip:port notation. Note that a I<port>
397406
specified in the C<--relayhost> option will override this one.
398407

@@ -429,7 +438,7 @@ and C<--max-servers>, based on demand.
429438
You may want to set your origination mail server to limit the
430439
number of concurrent connections to I<spampd> to match this setting (for
431440
Postfix this is the C<xxxx_destination_concurrency_limit> setting where
432-
'xxxx' is the transport being used, usually 'smtp', and the default is 100).
441+
'xxxx' is the transport being used, usually 'smtp' or 'lmtp').
433442

434443
See also C<--min-servers>, C<--min-spare>, and C<--max-spare> options.
435444

@@ -471,7 +480,7 @@ I<spampd> works by forking child servers to handle each message. The
471480
B<maxrequests> parameter specifies how many requests will be handled
472481
before the child exits. Since a child never gives back memory, a large
473482
message can cause it to become quite bloated; the only way to reclaim
474-
the memory is for the child to exit. The default is 20.
483+
the memory is for the child to exit.
475484

476485

477486
=item B<--childtimeout> I<<n>>
@@ -481,29 +490,68 @@ a transaction. In an S/LMTP transaction the timer is reset for every command.
481490
This timeout includes time it would take to send the message data, so it should
482491
not be too short. Note that it's more likely the origination or destination
483492
mail servers will timeout first, which is fine. This is just a "sane" failsafe.
484-
Default is 360 seconds (6 minutes).
485493

486494

487495
=item B<--satimeout> I<<n>>
488496

489497
This is the number of seconds to allow for processing a message with
490498
SpamAssassin (including feeding it the message, analyzing it, and adding
491499
the headers/report if necessary).
500+
492501
This should be less than your origination and destination servers' timeout
493-
settings for the DATA command. For Postfix the default is 300 seconds in both
494-
cases (smtp_data_done_timeout and smtpd_timeout). In the event of timeout
495-
while processing the message, the problem is logged and the message is passed
496-
on anyway (w/out spam tagging, obviously). To fail the message with a temp
497-
450 error, see the --dose (die-on-sa-errors) option, below.
498-
Default is 285 seconds.
502+
settings for the DATA command. (For Postfix this is set in C<(smtp|lmtp)_data_done_timeout>
503+
and C<smtpd_timeout>). In the event of timeout while processing the message, the problem is
504+
logged and the message is passed on anyway (w/out spam tagging, obviously). To fail the
505+
message with a temp 450 error, see the C<--dose> (die-on-sa-errors) option, below.
506+
507+
508+
=item B<--child-name-template> or B<-cnt> I<[<template>]> C<new in v2.61>
509+
510+
Template for formatting child process name. Use a blank string (just the argument name
511+
without a value) to leave the child process name unchanged (will be same as parent command line).
512+
513+
The template uses C<printf()> style formatting, but with named parameter placeholders.
514+
For example (wrapped for clarity):
515+
516+
%base_name: child #%child_count(%child_status)
517+
[req %req_count/%req_max, time lst/avg/ttl %(req_time_last).4f/%(req_time_avg).4f/%(req_time_ttl).4f,
518+
ham/spm %req_ham/%req_spam, rules v%sa_rls_ver)]'
519+
520+
Would produce something like:
521+
522+
spampd: child #4(D) [req 8/30, time lst/avg/ttl 0.0222/0.0256/0.2045, ham/spm 3/5, rules v1891891]
523+
524+
Parameters are specified like: "Value of %(my_name)s is %(my_float_value).4f", with names
525+
in parenthesis followed by standard a C<printf()> style formatting specifier (C<s> is default),
526+
or simply as "Value of %my_name is %my_value" with the default format being a string
527+
(works for numerics also).
528+
529+
The following variables are available:
530+
531+
base_name # Base script name, eg. "spampd"
532+
spampd_ver # SpamPD version, eg. "2.61"
533+
perl_ver # Perl version, eg. "5.28.1"
534+
ns_ver # Net::Server version, eg. "2.009"
535+
ns_typ # Net::Server type, "PreFork" or "PreForkSimple"
536+
ns_typ_acr # Net::Server type acronym, "PF" or "PFS"
537+
sa_ver # SpamAassassin version, eg. "3.4.2"
538+
sa_rls_ver # SpamAassassin rules update version, eg. "1891891" or "(unknown)"
539+
child_count # total number of children launched so far (current child number)
540+
child_status # child status, "C" for connected, or "D" for disconnected
541+
req_count # number of requests child has processed so far
542+
req_max # maximum child requests before exit
543+
req_time_last # [s] time to process the last message
544+
req_time_ttl # [s] total processing time for this child
545+
req_time_avg # [s] average processing time for this child (req_time_ttl / req_count)
546+
req_ham # count of ham messages scored by child
547+
req_spam # count of spam messages scored by child
499548

500549

501550
=item B<--pid> or B<-p> I<<filename>>
502551

503552
Specifies a filename where I<spampd> will write its process ID so
504553
that it is easy to kill it later. The directory that will contain this
505-
file must be writable by the I<spampd> user. The default is
506-
F</var/run/spampd.pid>.
554+
file must be writable by the I<spampd> user.
507555

508556

509557
=item B<--logfile> or B<-o> I<< (syslog|stderr|<filename>) >> C<new in v2.60>
@@ -567,20 +615,18 @@ The default was C<unix> except on HP-UX and SunOS (Solaris) systems it is C<inet
567615

568616
=item B<--logident> or B<-li> I<<name>> C<new in v2.60>
569617

570-
Syslog identity name to use. This may also be used in log files written directly (w/out syslog). Default is C<spampd>.
618+
Syslog identity name to use. This may also be used in log files written directly (w/out syslog).
571619

572620

573621
=item B<--logfacility> or B<-lf> I<<name>> C<new in v2.60>
574622

575-
Syslog facility name to use. This is typically the name of the system-wide log file to be written to. Default is C<mail>.
623+
Syslog facility name to use. This is typically the name of the system-wide log file to be written to.
576624

577625

578626
=item B<--[no]detach> I<[0|1]> C<new in v2.20>
579627

580-
By default I<spampd> will detach from the console and fork into the
581-
background ("daemonize"). Use C<--nodetach> to override this.
582-
This can be useful for running under control of some daemon
583-
management tools or testing from a command line.
628+
Tells I<spampd> to detach from the console and fork into the background ("daemonize").
629+
Using C<--nodetach> can be useful for running under control of some daemon management tools or testing from a command line.
584630

585631

586632
=item B<--[no]setsid> I<[0|1]> C<new in v2.51>
@@ -592,25 +638,25 @@ daemonize. Only used if C<--nodetach> isn't specified.
592638

593639
=item B<--maxsize> I<<n>>
594640

595-
The maximum message size to send to SpamAssassin, in KBytes. By default messages
596-
over 64KB are not scanned at all, and an appropriate message is logged
641+
The maximum message size to send to SpamAssassin, in KBytes. Messages
642+
over this size are not scanned at all, and an appropriate message is logged
597643
indicating this. The size includes headers and attachments (if any).
598644

599645

600646
=item B<--dose> I<[0|1]>
601647

602-
Acronym for (d)ie (o)n (s)pamAssassin (e)rrors. By default if I<spampd>
603-
encounters a problem with processing the message through Spam Assassin (timeout
604-
or other error), it will still pass the mail on to the destination server. If
605-
you specify this option however, the mail is instead rejected with a temporary
606-
error (code 450, which means the origination server should keep retrying to send
607-
it). See the related --satimeout option, above.
648+
Acronym for (d)ie (o)n (s)pamAssassin (e)rrors. When disabled and I<spampd>
649+
encounters a problem with processing the message through SpamAssassin (timeout
650+
or other error), it will still pass the mail on to the destination server.
651+
When enabled, the mail is instead rejected with a temporary error (code 450,
652+
which means the origination server should keep retrying to send it). See the
653+
related C<--satimeout> option, above.
608654

609655

610656
=item B<--tagall> or B<-a> I<[0|1]>
611657

612658
Tells I<spampd> to have SpamAssassin add headers to all scanned mail,
613-
not just spam. By default I<spampd> will only rewrite messages which
659+
not just spam. Otherwise I<spampd> will only rewrite messages which
614660
exceed the spam threshold score (as defined in the SA settings). Note that
615661
for this option to work as of SA-2.50, the I<always_add_report> and/or
616662
I<always_add_headers> settings in your SpamAssassin F<local.cf> need to be
@@ -653,18 +699,18 @@ Turn off all SA network-based tests (DNS, Razor, etc).
653699

654700
Use the specified directory as home directory for the spamassassin process.
655701
Things like the auto-whitelist and other plugin (razor/pyzor) files get
656-
written to here.
657-
Default is /var/spool/spamassassin/spampd. A good place for this is in the same
658-
place your bayes_path SA config setting points to (if any). Make sure this
659-
directory is accessible to the user that spampd is running as (default: mail).
702+
written to here. A good place for this is in the same
703+
place your C<bayes_path> SA config setting points to (if any). Make sure this
704+
directory is accessible to the user that spampd is running as.
705+
660706
Thanks to Alexander Wirt for this fix.
661707

662708

663709
=item B<--saconfig> I<<filename>>
664710

665711
Use the specified file for SpamAssassin configuration options in addition to the
666712
default local.cf file. Any options specified here will override the same
667-
option from local.cf. Default is to not use any additional configuration file.
713+
option from local.cf.
668714

669715

670716
=item B<--debug> or B<-d> I<< [<area,...>|1|0] >> C<(updated in v2.60)>
@@ -677,7 +723,7 @@ to 4 (debug), adding yet more info (but not too much) (new in v2.2).
677723
C<New in v2.60:>
678724

679725
Setting the value to 1 (one) is the same as using no parameter (eg. simply I<-d>).
680-
The value of 0 (zero) disables debug logging (this is the default).
726+
The value of 0 (zero) disables debug logging.
681727

682728
The I<area> list is passed on directly to SpamAssassin and controls logging
683729
facilities. If no I<area>s are listed (and debug logging is enabled), all
@@ -986,15 +1032,18 @@ permissions on the relaysocket!
9861032
=head1 CREDITS
9871033

9881034
I<spampd> is written and maintained by Maxim Paperno <[email protected]>.
989-
See L<http://www.WorldDesign.com/index.cfm/rd/mta/spampd.htm> for latest info.
1035+
The open source code repository is located at L<https://github.com/mpaperno/spampd/>.
1036+
See L<http://www.WorldDesign.com/index.cfm/rd/mta/spampd.htm> for historical info.
9901037

991-
I<spampd> v2 uses two Perl modules by Bennett Todd and Copyright (C) 2001 Morgan
992-
Stanley Dean Witter. These are distributed under the GNU GPL (see
993-
module code for more details). Both modules have been slightly modified
994-
from the originals and are included in this file under new names.
1038+
I<spampd> v2 uses two Perl modules (I<MSDW::SMTP::Client> and I<MSDW::SMTP::Server>)
1039+
by Bennett Todd and Copyright (C) 2001 Morgan Stanley Dean Witter.
1040+
These are distributed under the GNU GPL (see module code for more details).
1041+
Both modules have been slightly modified from the originals and are included in
1042+
this file under new names (I<SpamPD::Client> and I<SpamPD::Server>, respectively).
9951043

996-
Also thanks to Bennett Todd for the example smtpproxy script which helped create
997-
this version of I<spampd>. See http://bent.latency.net/smtpprox/ .
1044+
Also thanks to Bennett Todd for the example I<smtpproxy> script which helped create
1045+
this version of I<spampd>. See L<http://bent.latency.net/smtpprox/> (seems to be down)
1046+
or L<https://github.com/jnorell/smtpprox>.
9981047

9991048
I<spampd> v1 was based on code by Dave Carrigan named I<assassind>. Trace
10001049
amounts of his code or documentation may still remain. Thanks to him for the
@@ -1019,8 +1068,7 @@ See also: L<https://github.com/mpaperno/spampd/graphs/contributors/>
10191068

10201069
=head1 COPYRIGHT, LICENSE, AND DISCLAIMER
10211070

1022-
I<spampd> is Copyright (c) 2002-2006, 2009-2010, 2013, 2018-2019 Maxim Paperno;
1023-
All Rights Reserved.
1071+
I<spampd> is Copyright (c) Maxim Paperno; All Rights Reserved.
10241072

10251073
Portions are Copyright (c) 2001 Morgan Stanley Dean Witter as mentioned above
10261074
in the Credits section.
@@ -1109,7 +1157,7 @@ L<Integrating SpamAssassin into Postfix using spampd|https://wiki.apache.org/spa
11091157
return word.replace(word[0], word[0].toUpperCase());
11101158
}).join(' ');
11111159
};
1112-
var list = document.querySelectorAll("a[href*=podtop] h1, ul#index > li > a, h1 a.u, li.indexItem1 > a");
1160+
var list = document.querySelectorAll("a[href*=podtop] h1, ul#index > li > a, h1 a.u, body > h1[id], li.indexItem1 > a");
11131161
for (let item of list)
11141162
item.innerText = titleCase(item.innerText);
11151163
}

0 commit comments

Comments
 (0)