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