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 with -u set to the
263           vpopmail user, this allows spamd to lookup/create user_prefs in the
264           vpopmail user's own maildir.  This option is useful for vpopmail
265           virtual users who do not have an entry in the system /etc/passwd
266           file.
267
268           Currently, use of this without -u is not supported. This inhibits
269           setuid.
270
271       -s facility, --syslog=facility
272           Specify the syslog facility to use (default: mail).  If "stderr" is
273           specified, output will be written to stderr. (This is useful if
274           you're running "spamd" under the "daemontools" package.) With a
275           facility of "file", all output goes to spamd.log. facility is
276           interpreted as a file name to log to if it contains any characters
277           except a-z and 0-9. "null" disables logging completely (used
278           internally).
279
280           Examples:
281
282                   spamd -s mail                 # use syslog, facility mail (default)
283                   spamd -s ./mail               # log to file ./mail
284                   spamd -s stderr 2>/dev/null   # log to stderr, throw messages away
285                   spamd -s null                 # the same as above
286                   spamd -s file                 # log to file ./spamd.log
287                   spamd -s /var/log/spamd.log   # log to file /var/log/spamd.log
288
289           If logging to a file is enabled and that log file is rotated, the
290           spamd server must be restarted with a SIGHUP. (If the log file is
291           just truncated, this is not needed but still recommended.)
292
293           Note that logging to a file does not use locking, so you cannot
294           intermix logging from spamd and other processes into the same file.
295           If you want to mix logging like this, use syslog instead.
296
297           If you use syslog logging, it is essential to send a SIGHUP to the
298           spamd daemon when you restart the syslogd daemon.  (This is due to
299           a shortcoming in Perl's syslog handling, where the disappearance of
300           the connection to the syslogd is considered a fatal error.)
301
302       --syslog-socket=type
303           Specify how spamd should send messages to syslogd. The type can be
304           any of the socket types or logging mechanisms as accepted by the
305           subroutine Sys::Syslog::setlogsock(). Depending on a version of
306           Sys::Syslog and on the underlying operating system, one of the
307           following values (or their subset) can be used: "native",
308           "eventlog", "tcp", "udp", "inet", "unix", "stream", "pipe", or
309           "console".  The value "eventlog" is specific to Win32 events logger
310           and requires a perl module Win32::EventLog to be installed.  For
311           more information please consult the Sys::Syslog documentation.
312
313           A historical setting --syslog-socket=none is mapped to
314           --syslog=stderr.
315
316           A default for Windows platforms is "none", otherwise the default is
317           to try "unix" first, falling back to "inet" if perl detects errors
318           in its "unix" support.
319
320           Some platforms, or versions of perl, are shipped with old or
321           dysfunctional versions of the Sys::Syslog module which do not
322           support some socket types, so you may need to set this option
323           explicitly.  If you get error messages regarding __PATH_LOG or
324           similar spamd, try changing this setting.
325
326           The socket types "file" is used internally and should not be
327           specified.  Use the "-s" switch instead.
328
329       --log-timestamp-fmt=format
330           The --log-timestamp-fmt option can provide a POSIX strftime(3)
331           format for timestamps included in each logged message. Each logger
332           (stderr, file, syslog) has its own default value for a timestamp
333           format, which applies when --log-timestamp-fmt option is not given,
334           or with --log-timestamp-fmt=default .  Timestamps can be turned off
335           by specifying an empty string with this option, e.g.
336           --log-timestamp-fmt='' or just --log-timestamp-fmt= .  Typical use:
337           --log-timestamp-fmt='%a %b %e %H:%M:%S %Y' (provides localized
338           weekday and month names in the ctime(3) style), or '%a, %e %b %Y
339           %H:%M:%S %z (%Z)' for a RFC 2822 format, or maybe '%Y-%m-%d
340           %H:%M:%S%z' for an ISO 8601 (EN 28601) format, or just
341           '%Y%m%dT%H%M%S' .
342
343       -u username, --username=username
344           Run as the named user.  If this option is not set, the default
345           behaviour is to setuid() to the user running "spamc", if "spamd" is
346           running as root.
347
348           Note: "--username=root" is not a valid option.  If specified,
349           "spamd" will exit with a fatal error on startup.
350
351       -g groupname, --groupname=groupname
352           Run as the named group if --username is being used. If this option
353           is not set when --username is used then the primary group for the
354           user given to --username is used.
355
356       -x, --nouser-config, --user-config
357           Turn off (on) reading of per-user configuration files (user_prefs)
358           from the user's home directory.  The default behaviour is to read
359           per-user configuration from the user's home directory
360           (--user-config).
361
362           This option does not disable or otherwise influence the SQL, LDAP
363           or Virtual Config Dir settings.
364
365       --auth-ident
366           Verify the username provided by spamc using ident.  This is only
367           useful if connections are only allowed from trusted hosts (because
368           an identd that lies is trivial to create) and if spamc REALLY
369           SHOULD be running as the user it represents.  Connections are
370           terminated immediately if authentication fails.  In this case,
371           spamc will pass the mail through unchecked.  Failure to connect to
372           an ident server, and response timeouts are considered
373           authentication failures.  This requires that Net::Ident be
374           installed. Deprecated.
375
376       --ident-timeout=timeout
377           Wait at most timeout seconds for a response to ident queries.
378           Ident query that takes longer that timeout seconds will fail, and
379           mail will not be processed.  Setting this to 0.0 or less results in
380           no timeout, which is STRONGLY discouraged.  The default is 5
381           seconds.
382
383       -A host,..., --allowed-ips=host,...
384           Specify a comma-separated list of authorized hosts or networks
385           which can connect to this spamd instance. Each element of the list
386           is either a single IP addresses, or a range of IP addresses in
387           address/masklength CIDR notation, or ranges of IPv4 addresses by
388           specifying 3 or less octets with a trailing dot.  Hostnames are not
389           supported, only IPv4 or IPv6 addresses.  This option can be
390           specified multiple times, or can take a list of addresses separated
391           by commas.  IPv6 addresses may be (but need not be) enclosed in
392           square brackets for consistency with option --listen.  Examples:
393
394           -A 10.11.12.13 -- only allow connections from 10.11.12.13.
395
396           -A 10.11.12.13,10.11.12.14 -- only allow connections from
397           10.11.12.13 and 10.11.12.14.
398
399           -A 10.200.300.0/24 -- allow connections from any machine in the
400           range "10.200.300.*".
401
402           -A 10. -- allow connections from any machine in the range
403           "10.*.*.*".
404
405           -A [2001:db8::]/32,192.0.2.0/24,::1,127.0.0.0/8 -- only accept
406           connections from specified test networks and from localhost.
407
408           In absence of the -A option, connections are only accepted from IP
409           address 127.0.0.1 or ::1, i.e. from localhost on a loopback
410           interface.
411
412       -D [area,...], --debug [area,...]
413           Produce debugging output. If no areas are listed, all debugging
414           information is printed. Diagnostic output can also be enabled for
415           each area individually; area is the area of the code to instrument.
416           For example, to produce diagnostic output on bayes, learn, and dns,
417           use:
418
419                   spamassassin -D bayes,learn,dns
420
421           Higher priority informational messages that are suitable for
422           logging in normal circumstances are available with an area of
423           "info".
424
425           For more information about which areas (also known as channels) are
426           available, please see the documentation at:
427
428                   C<http://wiki.apache.org/spamassassin/DebugChannels>
429
430       -4, --ipv4only, --ipv4-only, --ipv4
431           Use IPv4 where applicable, do not use IPv6.  The option affects a
432           set of listen sockets (see option "--listen") and disables IPv6 for
433           DNS tests.
434
435       -6  Use IPv6 where applicable, do not use IPv4.  The option affects a
436           set of listen sockets (see option "--listen") and disables IPv4 for
437           DNS tests. Installing a module IO::Socket::IP is recommended if
438           spamd is expected to receive requests over IPv6.
439
440       -L, --local
441           Perform only local tests on all mail.  In other words, skip DNS and
442           other network tests.  Works the same as the "-L" flag to
443           spamassassin(1).
444
445       -P, --paranoid
446           Die on user errors (for the user passed from spamc) instead of
447           falling back to user nobody and using the default configuration.
448
449       -m number , --max-children=number
450           This option specifies the maximum number of children to spawn.
451           Spamd will spawn that number of children, then sleep in the
452           background until a child dies, wherein it will go and spawn a new
453           child.
454
455           Incoming connections can still occur if all of the children are
456           busy, however those connections will be queued waiting for a free
457           child.  The minimum value is 1, the default value is 5.
458
459           Please note that there is a OS specific maximum of connections that
460           can be queued (Try "perl -MSocket -e'print SOMAXCONN'" to find this
461           maximum).
462
463           Note that if you run too many servers for the amount of free RAM
464           available, you run the danger of hurting performance by causing a
465           high swap load as server processes are swapped in and out
466           continually.
467
468       --min-children=number
469           The minimum number of children that will be kept running.  The
470           minimum value is 1, the default value is 1.  If you have lots of
471           free RAM, you may want to increase this.
472
473       --min-spare=number
474           The lower limit for the number of spare children allowed to run.  A
475           spare, or idle, child is one that is not handling a scan request.
476           If there are too few spare children available, a new server will be
477           started every second or so.  The default value is 1.
478
479       --max-spare=number
480           The upper limit for the number of spare children allowed to run.
481           If there are too many spare children, one will be killed every
482           second or so until the number of idle children is in the desired
483           range.  The default value is 2.
484
485       --max-conn-per-child=number
486           This option specifies the maximum number of connections each child
487           should process before dying and letting the master spamd process
488           spawn a new child.  The minimum value is 1, the default value is
489           200.
490
491       --round-robin
492           By default, "spamd" will attempt to keep a small number of "hot"
493           child processes as busy as possible, and keep any others as idle as
494           possible, using something similar to the Apache httpd server
495           scaling algorithm.  This is accomplished by the master process
496           coordinating the activities of the children.  This switch will
497           disable this scaling algorithm, and the behaviour seen in the 3.0.x
498           versions will be used instead, where all processes receive an equal
499           load and no scaling takes place.
500
501       --timeout-tcp=number
502           This option specifies the number of seconds to wait for headers
503           from a client (spamc) before closing the connection.  The minimum
504           value is 1, the default value is 30, and a value of 0 will disable
505           socket timeouts completely.
506
507       --timeout-child=number
508           This option specifies the number of seconds to wait for a spamd
509           child to process or check a message.  The minimum value is 1, the
510           default value is 300, and a value of 0 will disable child timeouts
511           completely.
512
513       -H directory, --helper-home-dir=directory
514           Specify that external programs such as Razor, DCC, and Pyzor should
515           have a HOME environment variable set to a specific directory.  The
516           default is to use the HOME environment variable setting from the
517           shell running spamd.  By specifying no argument, spamd will use the
518           spamc caller's home directory instead.
519
520       --ssl
521           Accept only SSL connections on the associated port.  The
522           IO::Socket::SSL perl module must be installed.
523
524           If the --ssl switch is used, and --ssl-port is not supplied, then
525           --port port will be used to accept SSL connections instead of
526           unencrypted connections.  If the --ssl switch is used, and
527           --ssl-port is set, then unencrypted connections will be accepted on
528           the --port, at the same time as encrypted connections are accepted
529           at --ssl-port.
530
531       --ssl-port=port
532           Optionally specifies the port number for the server to listen on
533           for SSL connections (default: whatever --port uses).  See --ssl for
534           more details.
535
536       --server-key keyfile
537           Specify the SSL key file to use for SSL connections.
538
539       --server-cert certfile
540           Specify the SSL certificate file to use for SSL connections.
541
542       --socketpath pathname
543           Listen on a UNIX domain socket at path pathname, in addition to
544           sockets specified with a "--listen" option. This option is provided
545           for compatibility with older versions of spamd. Starting with
546           version 3.4.0 the "--listen" option can also take a UNIX domain
547           socket as its value (an absolute path name). Unlike "--socketpath",
548           the "--listen" option may be specified multiple times if spamd
549           needs to listen on multiple UNIX or INET or INET6 sockets.
550
551           Warning: the Perl support on BSD platforms for UNIX domain sockets
552           seems to have a bug regarding paths of over 100 bytes or so
553           (SpamAssassin bug 4380).  If you see a 'could not find newly-
554           created UNIX socket' error message, and the path appears truncated,
555           this may be the cause.  Try using a shorter path to the socket.
556
557           By default, use of --socketpath without --listen will inhibit SSL
558           connections and unencrypted TCP connections.  To add other sockets,
559           specify them with --listen, e.g. '--listen=:' or '--listen=*:'
560
561       --socketowner name
562           Set UNIX domain socket to be owned by the user named name.  Note
563           that this requires that spamd be started as "root", and if "-u" is
564           used, that user should have write permissions to unlink the file
565           later, for when the "spamd" server is killed.
566
567       --socketgroup name
568           Set UNIX domain socket to be owned by the group named name.  See
569           "--socketowner" for notes on ownership and permissions.
570
571       --socketmode mode
572           Set UNIX domain socket to use the octal mode mode.  Note that if
573           "-u" is used, that user should have write permissions to unlink the
574           file later, for when the "spamd" server is killed.
575
576       --timing
577             Enable timing measurements and output the information for logging.  This
578             is the same information as provided by the TIMING tag.
579

SEE ALSO

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

PREREQUISITES

585       "Mail::SpamAssassin"
586

AUTHORS

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

LICENSE

591       SpamAssassin is distributed under the Apache License, Version 2.0, as
592       described in the file "LICENSE" included with the distribution.
593
594
595
596perl v5.30.1                      2020-02-03                          SPAMD(1)
Impressum