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

SEE ALSO

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

PREREQUISITES

583       "Mail::SpamAssassin"
584

AUTHORS

586       The SpamAssassin(tm) Project (http://spamassassin.apache.org/)
587

LICENSE

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