| SPAMD(8p) | User Contributed Perl Documentation | SPAMD(8p) |
spamd - daemonized version of spamassassin
spamd [options]
Options:
-l, --allow-tell Allow learning/reporting
-c, --create-prefs Create user preferences files
-C path, --configpath=path Path for default config files
--siteconfigpath=path Path for site configs
--cf='config line' Additional line of configuration
--pre='config line' Additional line of ".pre" (prepended to configuration)
-d, --daemonize Daemonize
-h, --help Print usage message
-i [ip_or_name[:port]], --listen=[ip_or_name[:port]] Listen on IP addr and port
-p port, --port=port Listen on specified port, may be overridden by -i
-4, --ipv4-only, --ipv4 Use IPv4 where applicable, disables IPv6
-6 Use IPv6 where applicable, disables IPv4
-A host,..., --allowed-ips=..,.. Restrict to IP addresses which can connect
-m num, --max-children=num Allow maximum num children
--min-children=num Allow minimum num children
--min-spare=num Lower limit for number of spare children
--max-spare=num Upper limit for number of spare children
--max-conn-per-child=num Maximum connections accepted by child
before it is respawned
--round-robin Use traditional prefork algorithm
--timeout-tcp=secs Connection timeout for client headers
--timeout-child=secs Connection timeout for message checks
-q, --sql-config Enable SQL config (needs -x)
-Q, --setuid-with-sql Enable SQL config (needs -x,
enables use of -H)
--ldap-config Enable LDAP config (needs -x)
--setuid-with-ldap Enable LDAP config (needs -x,
enables use of -H)
--virtual-config-dir=dir Enable pattern based Virtual configs
(needs -x)
-r pidfile, --pidfile Write the process id to pidfile
-s facility, --syslog=facility Specify the syslog facility
--syslog-socket=type How to connect to syslogd
--log-timestamp-fmt=fmt strftime(3) format for timestamps, may be
empty to disable timestamps, or 'default'
-u username, --username=username Run as username
-g groupname, --groupname=groupname Run as groupname
-v, --vpopmail Enable vpopmail config
-x, --nouser-config Disable user config files
-U username, --default-user=username Fall back to this username if spamc user
is not found (default: nobody)
-D, --debug[=areas] Print debugging messages (for areas)
-L, --local Use local tests only (no DNS)
-P, --paranoid Die upon user errors
-H [dir], --helper-home-dir[=dir] Specify a different HOME directory
--ssl Enable SSL on TCP connections
--ssl-verify Request a client certificate and verify it
--ssl-ca-file cafile Certificate Authority certificate file
--ssl-ca-path capath Certificate Authority directory
--ssl-port port Override --port setting for SSL connections
--server-key keyfile Specify an SSL keyfile
--server-cert certfile Specify an SSL certificate
--socketpath=path Listen on a given UNIX domain socket
--socketowner=name Set UNIX domain socket file's owner
--socketgroup=name Set UNIX domain socket file's group
--socketmode=mode Set UNIX domain socket file's mode
--timing Enable timing and logging
-V, --version Print version and exit
The --listen option (or -i) may be specified multiple times, its syntax is: [ ssl: ] [ host-name-or-IP-address ] [ : port ] or an absolute path (filename) of a Unix socket. If port is omitted it defaults to --port or to 783. Option --ssl implies a prefix 'ssl:'. An IPv6 address should be enclosed in square brackets, e.g. [::1]:783, an IPv4 address may be but need not be enclosed in square brackets. An asterisk '*' in place of a hostname implies an unspecified address, ('0.0.0.0' or '::'), i.e. it binds to all interfaces. An empty option value implies '*'. A default is '--listen localhost', which binds to a loopback interface only.
The purpose of this program is to provide a daemonized version of the spamassassin executable. The goal is improving throughput performance for automated mail checking.
This is intended to be used alongside "spamc", a fast, low-overhead C client program.
See the README file in the "spamd" directory of the SpamAssassin distribution for more details.
Note: Although "spamd" will check per-user config files for every message, any changes to the system-wide config files will require either restarting spamd or forcing it to reload itself via SIGHUP for the changes to take effect.
Note: If "spamd" receives a SIGHUP, it internally reloads itself, which means that it will change its pid and might not restart at all if its environment changed (ie. if it can't change back into its own directory). If you plan to use SIGHUP, you should always start "spamd" with the -r switch to know its current pid.
Options of the long form can be shortened as long as they remain unambiguous. (i.e. --dae can be used instead of --daemonize) Also, boolean options (like --user-config) can be negated by adding no (--nouser-config), however, this is usually unnecessary.
Note that spamd always trusts the username passed in so clients could maliciously learn messages for other users. (This is not usually a concern with an SQL Bayes store as users will typically have read-write access directly to the database, and can also use "sa-learn" with the -u option to achieve the same result.)
If the --ssl switch is used, and --ssl-port is not supplied, then this port will be used to accept SSL connections instead of unencrypted connections. If the --ssl switch is used, and --ssl-port is set, then unencrypted connections will be accepted on the --port at the same time as encrypted connections are accepted at --ssl-port.
If your spamc client does not support sending the "User:" header, like "exiscan", then the SQL username used will always be nobody.
This inhibits the setuid() behavior, so the "-u" option is required. If you want the setuid() behaviour, use "-Q" or "--setuid-with-sql" instead.
Like "--sql-config", this disables the setuid behavior, and requires "-u". If you want it, use "--setuid-with-ldap" instead.
So for example, if "/vhome/users/%u/spamassassin" is specified, and spamc sends a virtual username of "jm@example.com", the directory "/vhome/users/jm@example.com/spamassassin" will be used.
The set of characters allowed in the virtual username for this path are restricted to:
A-Z a-z 0-9 - + _ . , @ =
All others will be replaced by underscores ("_").
This path must be a writable directory. It will be created if it does not already exist. If a file called user_prefs exists in this directory (note: not in a ".spamassassin" subdirectory!), it will be loaded as the user's preferences. The Bayes databases for that user will be stored in this directory.
Note that this requires that -x is used, and cannot be combined with SQL- or LDAP-based configuration.
The pattern must expand to an absolute directory when spamd is running daemonized (-d).
Currently, use of this without -u is not supported. This inhibits setuid.
Currently, use of this without -u is not supported. This inhibits setuid.
Examples:
spamd -s mail # use syslog, facility mail (default)
spamd -s ./mail # log to file ./mail
spamd -s stderr 2>/dev/null # log to stderr, throw messages away
spamd -s null # the same as above
spamd -s file # log to file ./spamd.log
spamd -s /var/log/spamd.log # log to file /var/log/spamd.log
If logging to a file is enabled and that log file is rotated, the spamd server must be restarted with a SIGHUP. (If the log file is just truncated, this is not needed but still recommended.)
Note that logging to a file does not use locking, so you cannot intermix logging from spamd and other processes into the same file. If you want to mix logging like this, use syslog instead.
If you use syslog logging, it is essential to send a SIGHUP to the spamd daemon when you restart the syslogd daemon. (This is due to a shortcoming in Perl's syslog handling, where the disappearance of the connection to the syslogd is considered a fatal error.)
A historical setting --syslog-socket=none is mapped to --syslog=stderr.
A default for Windows platforms is "none", otherwise the default is to try "unix" first, falling back to "inet" if perl detects errors in its "unix" support.
Some platforms, or versions of perl, are shipped with old or dysfunctional versions of the Sys::Syslog module which do not support some socket types, so you may need to set this option explicitly. If you get error messages regarding __PATH_LOG or similar spamd, try changing this setting.
The socket types "file" is used internally and should not be specified. Use the "-s" switch instead.
Note: "--username=root" is not a valid option. If specified, "spamd" will exit with a fatal error on startup.
This option does not disable or otherwise influence the SQL, LDAP or Virtual Config Dir settings.
-A 10.11.12.13 -- only allow connections from 10.11.12.13.
-A 10.11.12.13,10.11.12.14 -- only allow connections from 10.11.12.13 and 10.11.12.14.
-A 10.200.300.0/24 -- allow connections from any machine in the range "10.200.300.*".
-A 10. -- allow connections from any machine in the range "10.*.*.*".
-A [2001:db8::]/32,192.0.2.0/24,::1,127.0.0.0/8 -- only accept connections from specified test networks and from localhost.
In absence of the -A option, connections are only accepted from IP address 127.0.0.1 or ::1, i.e. from localhost on a loopback interface.
spamassassin -D bayes,learn,dns
Higher priority informational messages that are suitable for logging in normal circumstances are available with an area of "info".
For more information about which areas (also known as channels) are available, please see the documentation at:
C<https://wiki.apache.org/spamassassin/DebugChannels>
Incoming connections can still occur if all of the children are busy, however those connections will be queued waiting for a free child. The minimum value is 1, the default value is 5.
Please note that there is a OS specific maximum of connections that can be queued (Try "perl -MSocket -e'print SOMAXCONN'" to find this maximum).
Note that if you run too many servers for the amount of free RAM available, you run the danger of hurting performance by causing a high swap load as server processes are swapped in and out continually.
If the --ssl switch is used, and --ssl-port is not supplied, then --port port will be used to accept SSL connections instead of unencrypted connections. If the --ssl switch is used, and --ssl-port is set, then unencrypted connections will be accepted on the --port, at the same time as encrypted connections are accepted at --ssl-port.
Warning: the Perl support on BSD platforms for UNIX domain sockets seems to have a bug regarding paths of over 100 bytes or so (SpamAssassin bug 4380). If you see a 'could not find newly-created UNIX socket' error message, and the path appears truncated, this may be the cause. Try using a shorter path to the socket.
By default, use of --socketpath without --listen will inhibit SSL connections and unencrypted TCP connections. To add other sockets, specify them with --listen, e.g. '--listen=:' or '--listen=*:'
Enable timing measurements and output the information for logging. This
is the same information as provided by the TIMING tag.
spamc(1) spamassassin(1) Mail::SpamAssassin::Conf(3) Mail::SpamAssassin(3)
"Mail::SpamAssassin"
The SpamAssassin(tm) Project (https://spamassassin.apache.org/)
SpamAssassin is distributed under the Apache License, Version 2.0, as described in the file "LICENSE" included with the distribution.
| 2024-04-12 | perl v5.38.2 |