1SPAMD(1)              User Contributed Perl Documentation             SPAMD(1)
2
3
4

NAME

6       spamd - daemonized version of spamassassin
7

SYNOPSIS

9       spamd [options]
10
11       Options:
12
13        -l, --allow-tell                  Allow learning/reporting
14        -c, --create-prefs                Create user preferences files
15        -C path, --configpath=path        Path for default config files
16        --siteconfigpath=path             Path for site configs
17        --cf='config line'                Additional line of configuration
18        -d, --daemonize                   Daemonize
19        -h, --help                        Print usage message
20        -i [ip_or_name[:port]], --listen=[ip_or_name[:port]] Listen on IP addr and port
21        -p port, --port=port              Listen on specified port, may be overridden by -i
22        -4, --ipv4-only, --ipv4           Use IPv4 where applicable, disables IPv6
23        -6                                Use IPv6 where applicable, disables IPv4
24        -A host,..., --allowed-ips=..,..  Restrict to IP addresses which can connect
25        -m num, --max-children=num        Allow maximum num children
26        --min-children=num                Allow minimum num children
27        --min-spare=num                   Lower limit for number of spare children
28        --max-spare=num                   Upper limit for number of spare children
29        --max-conn-per-child=num          Maximum connections accepted by child
30                                          before it is respawned
31        --round-robin                     Use traditional prefork algorithm
32        --timeout-tcp=secs                Connection timeout for client headers
33        --timeout-child=secs              Connection timeout for message checks
34        -q, --sql-config                  Enable SQL config (needs -x)
35        -Q, --setuid-with-sql             Enable SQL config (needs -x,
36                                          enables use of -H)
37        --ldap-config                     Enable LDAP config (needs -x)
38        --setuid-with-ldap                Enable LDAP config (needs -x,
39                                          enables use of -H)
40        --virtual-config-dir=dir          Enable pattern based Virtual configs
41                                          (needs -x)
42        -r pidfile, --pidfile             Write the process id to pidfile
43        -s facility, --syslog=facility    Specify the syslog facility
44        --syslog-socket=type              How to connect to syslogd
45        --log-timestamp-fmt=fmt           strftime(3) format for timestamps, may be
46                                          empty to disable timestamps, or 'default'
47        -u username, --username=username  Run as username
48        -g groupname, --groupname=groupname  Run as groupname
49        -v, --vpopmail                    Enable vpopmail config
50        -x, --nouser-config               Disable user config files
51        --auth-ident                      Use ident to identify spamc user (deprecated)
52        --ident-timeout=timeout           Timeout for ident connections
53        -D, --debug[=areas]               Print debugging messages (for areas)
54        -L, --local                       Use local tests only (no DNS)
55        -P, --paranoid                    Die upon user errors
56        -H [dir], --helper-home-dir[=dir] Specify a different HOME directory
57        --ssl                             Enable SSL on TCP connections
58        --ssl-port port                   Override --port setting for SSL connections
59        --server-key keyfile              Specify an SSL keyfile
60        --server-cert certfile            Specify an SSL certificate
61        --socketpath=path                 Listen on a given UNIX domain socket
62        --socketowner=name                Set UNIX domain socket file's owner
63        --socketgroup=name                Set UNIX domain socket file's group
64        --socketmode=mode                 Set UNIX domain socket file's mode
65        --timing                          Enable timing and logging
66        -V, --version                     Print version and exit
67
68       The --listen option (or -i) may be specified multiple times, its syntax
69       is: [ ssl: ] [ host-name-or-IP-address ] [ : port ]  or an absolute
70       path (filename) of a Unix socket.  If port is omitted it defaults to
71       --port or to 783.  Option --ssl implies a prefix 'ssl:'.  An IPv6
72       address should be enclosed in square brackets, e.g. [::1]:783, an IPv4
73       address may be but need not be enclosed in square brackets.  An
74       asterisk '*' in place of a hostname implies an unspecified address,
75       ('0.0.0.0' or '::'), i.e. it binds to all interfaces. An empty option
76       value implies '*'. A default is '--listen localhost', which binds to a
77       loopback interface only.
78

DESCRIPTION

80       The purpose of this program is to provide a daemonized version of the
81       spamassassin executable.  The goal is improving throughput performance
82       for automated mail checking.
83
84       This is intended to be used alongside "spamc", a fast, low-overhead C
85       client program.
86
87       See the README file in the "spamd" directory of the SpamAssassin
88       distribution for more details.
89
90       Note: Although "spamd" will check per-user config files for every
91       message, any changes to the system-wide config files will require
92       either restarting spamd or forcing it to reload itself via SIGHUP for
93       the changes to take effect.
94
95       Note: If "spamd" receives a SIGHUP, it internally reloads itself, which
96       means that it will change its pid and might not restart at all if its
97       environment changed  (ie. if it can't change back into its own
98       directory).  If you plan to use SIGHUP, you should always start "spamd"
99       with the -r switch to know its current pid.
100

OPTIONS

102       Options of the long form can be shortened as long as they remain
103       unambiguous.  (i.e. --dae can be used instead of --daemonize) Also,
104       boolean options (like --user-config) can be negated by adding no
105       (--nouser-config), however, this is usually unnecessary.
106
107       -l, --allow-tell
108           Allow learning and forgetting (to a local Bayes database),
109           reporting and revoking (to a remote database) by spamd. The client
110           issues a TELL command to tell what type of message is being
111           processed and whether local (learn/forget) or remote
112           (report/revoke) databases should be updated.
113
114           Note that spamd always trusts the username passed in (unless
115           --auth-ident is used) so clients could maliciously learn messages
116           for other users. (This is not usually a concern with an SQL Bayes
117           store as users will typically have read-write access directly to
118           the database, and can also use "sa-learn" with the -u option to
119           achieve the same result.)
120
121       -c, --create-prefs
122           Create user preferences files if they don't exist (default: don't).
123
124       -C path, --configpath=path
125           Use the specified path for locating the distributed configuration
126           files.  Ignore the default directories (usually
127           "/usr/share/spamassassin" or similar).
128
129       --siteconfigpath=path
130           Use the specified path for locating site-specific configuration
131           files.  Ignore the default directories (usually
132           "/etc/mail/spamassassin" or similar).
133
134       --cf='config line'
135           Add additional lines of configuration directly from the command-
136           line, parsed after the configuration files are read.   Multiple
137           --cf arguments can be used, and each will be considered a separate
138           line of configuration.
139
140       -d, --daemonize
141           Detach from starting process and run in background (daemonize).
142
143       -h, --help
144           Print a brief help message, then exit without further action.
145
146       -V, --version
147           Print version information, then exit without further action.
148
149       -i [ipaddress[:<port>]], --listen[=ipaddress[:<port>]]
150           Additional alias names for this option are --listen-ip and
151           --ip-address.  Tells spamd to listen on the specified IP address,
152           defaults to a loopback interface, i.e. "--listen localhost").  If
153           no value is specified after the switch, or if an asterisk '*'
154           stands in place of an <ipaddress>, spamd will listen on all
155           interfaces - this is equivalent to address '0.0.0.0' for IPv4 and
156           to '::' for IPv6. You can also use a valid hostname which will make
157           spamd listen on all addresses that a name resolves to. The option
158           may be specified multiple times. See also options -4 and -6 for
159           restricting address family to IPv4 or to IPv6. If a port is
160           specified it overrides for this socket the global --port (and
161           --ssl-port) setting. An IPv6 addresses should be enclosed in square
162           brackets, e.g. [::1]:783. For compatibility square brackets on an
163           IPv6 address may be omitted if a port number specification is also
164           omitted.
165
166       -p port, --port=port
167           Optionally specifies the port number for the server to listen on
168           (default: 783).
169
170           If the --ssl switch is used, and --ssl-port is not supplied, then
171           this port will be used to accept SSL connections instead of
172           unencrypted connections.  If the --ssl switch is used, and
173           --ssl-port is set, then unencrypted connections will be accepted on
174           the --port at the same time as encrypted connections are accepted
175           at --ssl-port.
176
177       -q, --sql-config
178           Turn on SQL lookups even when per-user config files have been
179           disabled with -x. this is useful for spamd hosts which don't have
180           user's home directories but do want to load user preferences from
181           an SQL database.
182
183           If your spamc client does not support sending the "User:" header,
184           like "exiscan", then the SQL username used will always be nobody.
185
186           This inhibits the setuid() behavior, so the "-u" option is
187           required. If you want the setuid() behaviour, use "-Q" or
188           "--setuid-with-sql" instead.
189
190       --ldap-config
191           Turn on LDAP lookups. This is completely analog to "--sql-config",
192           only it is using an LDAP server.
193
194           Like "--sql-config", this disables the setuid behavior, and
195           requires "-u". If you want it, use "--setuid-with-ldap" instead.
196
197       -Q, --setuid-with-sql
198           Turn on SQL lookups even when per-user config files have been
199           disabled with -x and also setuid to the user.  This is useful for
200           spamd hosts which want to load user preferences from an SQL
201           database but also wish to support the use of -H (Helper home
202           directories.)
203
204       --setuid-with-ldap
205           Turn on LDAP lookups even when per-user config files have been
206           disabled with -x and also setuid to the user.  This is again
207           completely analog to "--setuid-with-sql", only it is using an LDAP
208           server.
209
210       --virtual-config-dir=pattern
211           This option specifies where per-user preferences can be found for
212           virtual users, for the -x switch. The pattern is used as a base
213           pattern for the directory name.  Any of the following escapes can
214           be used:
215
216           %u -- replaced with the full name of the current user, as sent by
217           spamc.
218           %l -- replaced with the 'local part' of the current username.  In
219           other words, if the username is an email address, this is the part
220           before the "@" sign.
221           %d -- replaced with the 'domain' of the current username.  In other
222           words, if the username is an email address, this is the part after
223           the "@" sign.
224           %x -- replaced with the full name of the current user, as sent by
225           spamc. If the resulting config directory does not exist, replace
226           with the domain part to use a domain-wide default.
227           %% -- replaced with a single percent sign (%).
228
229           So for example, if "/vhome/users/%u/spamassassin" is specified, and
230           spamc sends a virtual username of "jm@example.com", the directory
231           "/vhome/users/jm@example.com/spamassassin" will be used.
232
233           The set of characters allowed in the virtual username for this path
234           are restricted to:
235
236                   A-Z a-z 0-9 - + _ . , @ =
237
238           All others will be replaced by underscores ("_").
239
240           This path must be a writable directory.  It will be created if it
241           does not already exist.  If a file called user_prefs exists in this
242           directory (note: not in a ".spamassassin" subdirectory!), it will
243           be loaded as the user's preferences.  The Bayes databases for that
244           user will be stored in this directory.
245
246           Note that this requires that -x is used, and cannot be combined
247           with SQL- or LDAP-based configuration.
248
249           The pattern must expand to an absolute directory when spamd is
250           running daemonized (-d).
251
252           Currently, use of this without -u is not supported. This inhibits
253           setuid.
254
255       -r pidfile, --pidfile=pidfile
256           Write the process ID of the spamd parent to the file specified by
257           pidfile.  The file will be unlinked when the parent exits.  Note
258           that when running with the -u option, the file must be writable by
259           that user.
260
261       -v, --vpopmail
262           Enable vpopmail config.  If specified with -u set to the vpopmail
263           user, this allows spamd to lookup/create user_prefs in the vpopmail
264           user's own maildir.  This option is useful for vpopmail virtual
265           users who do not have an entry in the system /etc/passwd file.
266
267           Currently, use of this without -u is not supported. This inhibits
268           setuid.
269
270       -s facility, --syslog=facility
271           Specify the syslog facility to use (default: mail).  If "stderr" is
272           specified, output will be written to stderr. (This is useful if
273           you're running "spamd" under the "daemontools" package.) With a
274           facility of "file", all output goes to spamd.log. facility is
275           interpreted as a file name to log to if it contains any characters
276           except a-z and 0-9. "null" disables logging completely (used
277           internally).
278
279           Examples:
280
281                   spamd -s mail                 # use syslog, facility mail (default)
282                   spamd -s ./mail               # log to file ./mail
283                   spamd -s stderr 2>/dev/null   # log to stderr, throw messages away
284                   spamd -s null                 # the same as above
285                   spamd -s file                 # log to file ./spamd.log
286                   spamd -s /var/log/spamd.log   # log to file /var/log/spamd.log
287
288           If logging to a file is enabled and that log file is rotated, the
289           spamd server must be restarted with a SIGHUP. (If the log file is
290           just truncated, this is not needed but still recommended.)
291
292           Note that logging to a file does not use locking, so you cannot
293           intermix logging from spamd and other processes into the same file.
294           If you want to mix logging like this, use syslog instead.
295
296           If you use syslog logging, it is essential to send a SIGHUP to the
297           spamd daemon when you restart the syslogd daemon.  (This is due to
298           a shortcoming in Perl's syslog handling, where the disappearance of
299           the connection to the syslogd is considered a fatal error.)
300
301       --syslog-socket=type
302           Specify how spamd should send messages to syslogd. The type can be
303           any of the socket types or logging mechanisms as accepted by the
304           subroutine Sys::Syslog::setlogsock(). Depending on a version of
305           Sys::Syslog and on the underlying operating system, one of the
306           following values (or their subset) can be used: "native",
307           "eventlog", "tcp", "udp", "inet", "unix", "stream", "pipe", or
308           "console".  The value "eventlog" is specific to Win32 events logger
309           and requires a perl module Win32::EventLog to be installed.  For
310           more information please consult the Sys::Syslog documentation.
311
312           A historical setting --syslog-socket=none is mapped to
313           --syslog=stderr.
314
315           A default for Windows platforms is "none", otherwise the default is
316           to try "unix" first, falling back to "inet" if perl detects errors
317           in its "unix" support.
318
319           Some platforms, or versions of perl, are shipped with old or
320           dysfunctional versions of the Sys::Syslog module which do not
321           support some socket types, so you may need to set this option
322           explicitly.  If you get error messages regarding __PATH_LOG or
323           similar spamd, try changing this setting.
324
325           The socket types "file" is used internally and should not be
326           specified.  Use the "-s" switch instead.
327
328       --log-timestamp-fmt=format
329           The --log-timestamp-fmt option can provide a POSIX strftime(3)
330           format for timestamps included in each logged message. Each logger
331           (stderr, file, syslog) has its own default value for a timestamp
332           format, which applies when --log-timestamp-fmt option is not given,
333           or with --log-timestamp-fmt=default .  Timestamps can be turned off
334           by specifying an empty string with this option, e.g.
335           --log-timestamp-fmt='' or just --log-timestamp-fmt= .  Typical use:
336           --log-timestamp-fmt='%a %b %e %H:%M:%S %Y' (provides localized
337           weekday and month names in the ctime(3) style), or '%a, %e %b %Y
338           %H:%M:%S %z (%Z)' for a RFC 2822 format, or maybe '%Y-%m-%d
339           %H:%M:%S%z' for an ISO 8601 (EN 28601) format, or just
340           '%Y%m%dT%H%M%S' .
341
342       -u username, --username=username
343           Run as the named user.  If this option is not set, the default
344           behaviour is to setuid() to the user running "spamc", if "spamd" is
345           running as root.
346
347           Note: "--username=root" is not a valid option.  If specified,
348           "spamd" will exit with a fatal error on startup.
349
350       -g groupname, --groupname=groupname
351           Run as the named group if --username is being used. If this option
352           is not set when --username is used then the primary group for the
353           user given to --username is used.
354
355       -x, --nouser-config, --user-config
356           Turn off (on) reading of per-user configuration files (user_prefs)
357           from the user's home directory.  The default behaviour is to read
358           per-user configuration from the user's home directory
359           (--user-config).
360
361           This option does not disable or otherwise influence the SQL, LDAP
362           or Virtual Config Dir settings.
363
364       --auth-ident
365           Verify the username provided by spamc using ident.  This is only
366           useful if connections are only allowed from trusted hosts (because
367           an identd that lies is trivial to create) and if spamc REALLY
368           SHOULD be running as the user it represents.  Connections are
369           terminated immediately if authentication fails.  In this case,
370           spamc will pass the mail through unchecked.  Failure to connect to
371           an ident server, and response timeouts are considered
372           authentication failures.  This requires that Net::Ident be
373           installed. Deprecated.
374
375       --ident-timeout=timeout
376           Wait at most timeout seconds for a response to ident queries.
377           Ident query that takes longer that timeout seconds will fail, and
378           mail will not be processed.  Setting this to 0.0 or less results in
379           no timeout, which is STRONGLY discouraged.  The default is 5
380           seconds.
381
382       -A host,..., --allowed-ips=host,...
383           Specify a comma-separated list of authorized hosts or networks
384           which can connect to this spamd instance. Each element of the list
385           is either a single IP addresses, or a range of IP addresses in
386           address/masklength CIDR notation, or ranges of IPv4 addresses by
387           specifying 3 or less octets with a trailing dot.  Hostnames are not
388           supported, only IPv4 or IPv6 addresses.  This option can be
389           specified multiple times, or can take a list of addresses separated
390           by commas.  IPv6 addresses may be (but need not be) enclosed in
391           square brackets for consistency with option --listen.  Examples:
392
393           -A 10.11.12.13 -- only allow connections from 10.11.12.13.
394
395           -A 10.11.12.13,10.11.12.14 -- only allow connections from
396           10.11.12.13 and 10.11.12.14.
397
398           -A 10.200.300.0/24 -- allow connections from any machine in the
399           range "10.200.300.*".
400
401           -A 10. -- allow connections from any machine in the range
402           "10.*.*.*".
403
404           -A [2001:db8::]/32,192.0.2.0/24,::1,127.0.0.0/8 -- only accept
405           connections from specified test networks and from localhost.
406
407           In absence of the -A option, connections are only accepted from IP
408           address 127.0.0.1 or ::1, i.e. from localhost on a loopback
409           interface.
410
411       -D [area,...], --debug [area,...]
412           Produce debugging output. If no areas are listed, all debugging
413           information is printed. Diagnostic output can also be enabled for
414           each area individually; area is the area of the code to instrument.
415           For example, to produce diagnostic output on bayes, learn, and dns,
416           use:
417
418                   spamassassin -D bayes,learn,dns
419
420           Higher priority informational messages that are suitable for
421           logging in normal circumstances are available with an area of
422           "info".
423
424           For more information about which areas (also known as channels) are
425           available, please see the documentation at:
426
427                   C<http://wiki.apache.org/spamassassin/DebugChannels>
428
429       -4, --ipv4only, --ipv4-only, --ipv4
430           Use IPv4 where applicable, do not use IPv6.  The option affects a
431           set of listen sockets (see option "--listen") and disables IPv6 for
432           DNS tests.
433
434       -6  Use IPv6 where applicable, do not use IPv4.  The option affects a
435           set of listen sockets (see option "--listen") and disables IPv4 for
436           DNS tests. Installing a module IO::Socket::IP is recommended if
437           spamd is expected to receive requests over IPv6.
438
439       -L, --local
440           Perform only local tests on all mail.  In other words, skip DNS and
441           other network tests.  Works the same as the "-L" flag to
442           spamassassin(1).
443
444       -P, --paranoid
445           Die on user errors (for the user passed from spamc) instead of
446           falling back to user nobody and using the default configuration.
447
448       -m number , --max-children=number
449           This option specifies the maximum number of children to spawn.
450           Spamd will spawn that number of children, then sleep in the
451           background until a child dies, wherein it will go and spawn a new
452           child.
453
454           Incoming connections can still occur if all of the children are
455           busy, however those connections will be queued waiting for a free
456           child.  The minimum value is 1, the default value is 5.
457
458           Please note that there is a OS specific maximum of connections that
459           can be queued (Try "perl -MSocket -e'print SOMAXCONN'" to find this
460           maximum).
461
462           Note that if you run too many servers for the amount of free RAM
463           available, you run the danger of hurting performance by causing a
464           high swap load as server processes are swapped in and out
465           continually.
466
467       --min-children=number
468           The minimum number of children that will be kept running.  The
469           minimum value is 1, the default value is 1.  If you have lots of
470           free RAM, you may want to increase this.
471
472       --min-spare=number
473           The lower limit for the number of spare children allowed to run.  A
474           spare, or idle, child is one that is not handling a scan request.
475           If there are too few spare children available, a new server will be
476           started every second or so.  The default value is 1.
477
478       --max-spare=number
479           The upper limit for the number of spare children allowed to run.
480           If there are too many spare children, one will be killed every
481           second or so until the number of idle children is in the desired
482           range.  The default value is 2.
483
484       --max-conn-per-child=number
485           This option specifies the maximum number of connections each child
486           should process before dying and letting the master spamd process
487           spawn a new child.  The minimum value is 1, the default value is
488           200.
489
490       --round-robin
491           By default, "spamd" will attempt to keep a small number of "hot"
492           child processes as busy as possible, and keep any others as idle as
493           possible, using something similar to the Apache httpd server
494           scaling algorithm.  This is accomplished by the master process
495           coordinating the activities of the children.  This switch will
496           disable this scaling algorithm, and the behaviour seen in the 3.0.x
497           versions will be used instead, where all processes receive an equal
498           load and no scaling takes place.
499
500       --timeout-tcp=number
501           This option specifies the number of seconds to wait for headers
502           from a client (spamc) before closing the connection.  The minimum
503           value is 1, the default value is 30, and a value of 0 will disable
504           socket timeouts completely.
505
506       --timeout-child=number
507           This option specifies the number of seconds to wait for a spamd
508           child to process or check a message.  The minimum value is 1, the
509           default value is 300, and a value of 0 will disable child timeouts
510           completely.
511
512       -H directory, --helper-home-dir=directory
513           Specify that external programs such as Razor, DCC, and Pyzor should
514           have a HOME environment variable set to a specific directory.  The
515           default is to use the HOME environment variable setting from the
516           shell running spamd.  By specifying no argument, spamd will use the
517           spamc caller's home directory instead.
518
519       --ssl
520           Accept only SSL connections on the associated port.  The
521           IO::Socket::SSL perl module must be installed.
522
523           If the --ssl switch is used, and --ssl-port is not supplied, then
524           --port port will be used to accept SSL connections instead of
525           unencrypted connections.  If the --ssl switch is used, and
526           --ssl-port is set, then unencrypted connections will be accepted on
527           the --port, at the same time as encrypted connections are accepted
528           at --ssl-port.
529
530       --ssl-port=port
531           Optionally specifies the port number for the server to listen on
532           for SSL connections (default: whatever --port uses).  See --ssl for
533           more details.
534
535       --server-key keyfile
536           Specify the SSL key file to use for SSL connections.
537
538       --server-cert certfile
539           Specify the SSL certificate file to use for SSL connections.
540
541       --socketpath pathname
542           Listen on a UNIX domain socket at path pathname, in addition to
543           sockets specified with a "--listen" option. This option is provided
544           for compatibility with older versions of spamd. Starting with
545           version 3.4.0 the "--listen" option can also take a UNIX domain
546           socket as its value (an absolute path name). Unlike "--socketpath",
547           the "--listen" option may be specified multiple times if spamd
548           needs to listen on multiple UNIX or INET or INET6 sockets.
549
550           Warning: the Perl support on BSD platforms for UNIX domain sockets
551           seems to have a bug regarding paths of over 100 bytes or so
552           (SpamAssassin bug 4380).  If you see a 'could not find newly-
553           created UNIX socket' error message, and the path appears truncated,
554           this may be the cause.  Try using a shorter path to the socket.
555
556           By default, use of --socketpath without --listen will inhibit SSL
557           connections and unencrypted TCP connections.  To add other sockets,
558           specify them with --listen, e.g. '--listen=:' or '--listen=*:'
559
560       --socketowner name
561           Set UNIX domain socket to be owned by the user named name.  Note
562           that this requires that spamd be started as "root", and if "-u" is
563           used, that user should have write permissions to unlink the file
564           later, for when the "spamd" server is killed.
565
566       --socketgroup name
567           Set UNIX domain socket to be owned by the group named name.  See
568           "--socketowner" for notes on ownership and permissions.
569
570       --socketmode mode
571           Set UNIX domain socket to use the octal mode mode.  Note that if
572           "-u" is used, that user should have write permissions to unlink the
573           file later, for when the "spamd" server is killed.
574
575       --timing
576             Enable timing measurements and output the information for logging.  This
577             is the same information as provided by the TIMING tag.
578

SEE ALSO

580       spamc(1) spamassassin(1) Mail::SpamAssassin::Conf(3)
581       Mail::SpamAssassin(3)
582

PREREQUISITES

584       "Mail::SpamAssassin"
585

AUTHORS

587       The SpamAssassin(tm) Project (https://spamassassin.apache.org/)
588

LICENSE

590       SpamAssassin is distributed under the Apache License, Version 2.0, as
591       described in the file "LICENSE" included with the distribution.
592
593
594
595perl v5.32.1                      2021-04-14                          SPAMD(1)
Impressum