SPAMD(1)
π
SPAMD(1) β like, the spamd manual page, bestie
okay so this is spamd, from the "User Contributed Perl Documentation" section of your man pages π and we're gonna get through it together, no cap. grab a snack, there's a lot here and every single bit of it matters.
β¨ NAME β¨
spamd β the daemonized version of spamassassin. yes. that's the whole name section. slay.
πΈ SYNOPSIS πΈ
spamd [options]
Options, and I'm giving you the whole list exactly as it is, because I would never do you dirty like that:
-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
so about --listen (aka -i) π¦ β the way this one works is you can literally hand it multiple times, and the syntax is:
[ ssl: ] [ host-name-or-IP-address ] [ : port ] or an absolute path (filename) of a Unix socket
if you dip on the port, it defaults to --port or to 783. and guess what, --ssl implies a prefix of ssl:. an IPv6 address should be wrapped in square brackets, like [::1]:783, and an IPv4 address may be but doesn't have to be in square brackets. an asterisk '*' where a hostname would go implies an unspecified address ('0.0.0.0' or '::'), meaning it binds to all interfaces. an empty option value implies '*'. and the default is '--listen localhost', which β you guessed it β binds to a loopback interface only. π«
π DESCRIPTION π
okay so the whole point of this program is to give you a daemonized version of the spamassassin executable. the goal? improving throughput performance for automated mail checking. it's giving efficiency, it's giving main character energy.
this is meant to be used alongside "spamc", which is a fast, low-overhead C client program. they're a duo, your honor. π«Ά
for the full tea, check the README file in the "spamd" directory of the SpamAssassin distribution.
β οΈ note time, bestie: even though "spamd" will check per-user config files for every message, any changes to the system-wide config files require either restarting spamd or forcing it to reload itself via SIGHUP for those changes to actually take effect. no sneaky hot-reloading of the system-wide stuff. π
β οΈ another one: if"spamd"receives a SIGHUP, it internally reloads itself, which means 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). so if you plan to use SIGHUP, you should always start"spamd"with the-rswitch so you know its current pid. literally do not skip this. π₯
π OPTIONS π
before we get into the list β long-form options can be shortened as long as they stay 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. iykyk. π
-l,--allow-tellβ Allow learning and forgetting (to a local Bayes database), reporting and revoking (to a remote database) by spamd. The client issues aTELLcommand to tell what type of message is being processed and whether local (learn/forget) or remote (report/revoke) databases should be updated.
π 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-uoption to achieve the same result.)
-c,--create-prefsβ Create user preferences files if they don't exist (default: don't). simple as that. β¨-C path,--configpath=pathβ Use the specified path for locating the distributed configuration files. Ignore the default directories (usually"/usr/share/spamassassin"or similar). ποΈ--siteconfigpath=pathβ Use the specified path for locating site-specific configuration files. Ignore the default directories (usually"/etc/mail/spamassassin"or similar). ποΈ--cf='config line'β Add additional lines of configuration directly from the command-line, parsed after the configuration files are read. Multiple--cfarguments can be used, and each will be considered a separate line of configuration. π--pre='config line'β Add additional lines of.preconfiguration directly from the command-line, parsed before the configuration files are read. Multiple--prearguments can be used, and each will be considered a separate line of configuration. π-d,--daemonizeβ Detach from starting process and run in background (daemonize). bye, see you never, off to the background you go π¨-h,--helpβ Print a brief help message, then exit without further action. π«Ά-V,--versionβ Print version information, then exit without further action. β-i [ipaddress[:<port>]],--listen[=ipaddress[:<port>]]β Additional alias names for this option are--listen-ipand--ip-address. Tells spamd to listen on the specified IP address, defaults to a loopback interface, i.e."--listen localhost". If no value is specified after the switch, or if an asterisk'*'stands in place of an <ipaddress>, spamd will listen on all interfaces β this is equivalent to address'0.0.0.0'for IPv4 and to'::'for IPv6. You can also use a valid hostname, which will make spamd listen on all addresses that a name resolves to. The option may be specified multiple times. See also options-4and-6for restricting address family to IPv4 or to IPv6. If a port is specified it overrides for this socket the global--port(and--ssl-port) setting. An IPv6 addresses should be enclosed in square brackets, e.g.[::1]:783. For compatibility, square brackets on an IPv6 address may be omitted if a port number specification is also omitted. π₯-p port,--port=portβ Optionally specifies the port number for the server to listen on (default:783).
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. π
-q,--sql-configβ Turn on SQL lookups even when per-user config files have been disabled with-x. this is useful for spamd hosts which don't have user's home directories but do want to load user preferences from an SQL database.
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. π
--ldap-configβ Turn on LDAP lookups. This is completely analog to"--sql-config", only it is using an LDAP server.
Like "--sql-config", this disables the setuid behavior, and requires "-u". If you want it, use "--setuid-with-ldap" instead. π
-Q,--setuid-with-sqlβ Turn on SQL lookups even when per-user config files have been disabled with-xand also setuid to the user. This is useful for spamd hosts which want to load user preferences from an SQL database but also wish to support the use of-H(Helper home directories.) π--setuid-with-ldapβ Turn on LDAP lookups even when per-user config files have been disabled with-xand also setuid to the user. This is again completely analog to"--setuid-with-sql", only it is using an LDAP server. π--virtual-config-dir=patternβ this one is the β¨per-user prefsβ¨ hookup for virtual users, and it's what makes-xdo its thing. Thepatternis your base pattern for the directory name, and you get these escapes to play with:%uβ swapped for the full name of the current user, exactly asspamcsent it.%lβ swapped for the 'local part' of the current username. Basically if the username is an email address, it's the bit before the@. π%dβ swapped for the 'domain' of the current username. So the part after the@if it's an email address.%xβ swapped for the full name of the current user as sent byspamc, but if the resulting config directory doesn't exist, it gets replaced with the domain part instead, so you fall back to a domain-wide default. π¦%%β swapped for a single percent sign (%).
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 is restricted to:
A-Z a-z 0-9 - + _ . , @ =
Everything else gets replaced by underscores (_).
This path must be a writable directory. It will be created if it doesn't 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 get stored in this directory too. πΎ
Heads up: this requires that -x is used, and it 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. π
-r pidfile,--pidfile=pidfileβ write the process ID of thespamdparent to the file specified by pidfile. That file gets unlinked when the parent exits. Note that when running with the-uoption, the file must be writable by that user. π-v,--vpopmailβ enables vpopmail config. If you specify this with-uset to the vpopmail user,spamdcan look up / createuser_prefsin the vpopmail user's own maildir. This option is useful for vpopmail virtual users who don't have an entry in the system/etc/passwdfile. π«Ά
Currently, use of this without -u is not supported. This inhibits setuid.
-s facility,--syslog=facilityβ tell it which syslog facility to use (default:mail). Ifstderris specified, output gets written to stderr. (Super useful if you're runningspamdunder thedaemontoolspackage.) With a facility offile, all output goes tospamd.log. Oh and bestie, facility is interpreted as a file name to log to if it contains any characters excepta-zand0-9.nulldisables logging completely (used internally). π
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 gets rotated, the spamd server must be restarted with a SIGHUP. (If the log file is just truncated, this isn't needed but it's 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. π)
--syslog-socket=typeβ how shouldspamdsend messages tosyslogd? type can be any of the socket types or logging mechanisms accepted by the subroutineSys::Syslog::setlogsock(). Depending on the version ofSys::Syslogand on the underlying operating system, one of the following values (or a subset of them) can be used:native,eventlog,tcp,udp,inet,unix,stream,pipe, orconsole. The valueeventlogis specific to the Win32 events logger and requires a perl moduleWin32::EventLogto be installed. For more info, go consult theSys::Syslogdocumentation. π
A historical setting --syslog-socket=none is mapped to --syslog=stderr.
The 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) ship with old or straight-up dysfunctional versions of the Sys::Syslog module that don't support some socket types, so you may need to set this option explicitly. If you get error messages regarding __PATH_LOG or similar from spamd, try changing this setting.
The socket typefileis used internally and should not be specified. Use the-sswitch instead.
--log-timestamp-fmt=formatβ this one lets you provide a POSIXstrftime(3)format for the timestamps included in each logged message. Each logger (stderr, file, syslog) has its own default value for a timestamp format, and that default applies when the--log-timestamp-fmtoption isn't given, or with--log-timestamp-fmt=default. Timestamps can be turned off entirely by specifying an empty string with this option, e.g.--log-timestamp-fmt=''or just--log-timestamp-fmt=. πΈ Typical use:--log-timestamp-fmt='%a %b %e %H:%M:%S %Y'(gives you localized weekday and month names in thectime(3)style), or'%a, %e %b %Y %H:%M:%S %z (%Z)'for an RFC 2822 format, or maybe'%Y-%m-%d %H:%M:%S%z'for an ISO 8601 (EN 28601) format, or just'%Y%m%dT%H%M%S'.-u username,--username=usernameβ run as the named user. If this option isn't set, the default behaviour is tosetuid()to the user runningspamc, ifspamdis running as root. π
Note:--username=rootis not a valid option. If specified,spamdwill exit with a fatal error on startup. Fr fr, don't do it.
-g groupname,--groupname=groupnameβ run as the named group if--usernameis being used. If this option isn't set when--usernameis used, then the primary group for the user given to--usernameis used. π-x,--nouser-config,--user-configβ turns off (or on) reading of per-user configuration files (user_prefs) from the user's home directory. The default behaviour is to read per-user configuration from the user's home directory (--user-config). β¨
This option does not disable or otherwise influence the SQL, LDAP or Virtual Config Dir settings.
-U username,--default-user=usernameβ fall back to this username if the username provided byspamcisn't found. Default isnobody, which might not exist or might not have a usable home directory β so use this setting to define a suitable user if you need to. π«Ά-A host,...,--allowed-ips=host,...β the guest list, basically. π Specify a comma-separated list of authorized hosts or networks which can connect to thisspamdinstance. Each element of the list is either a single IP address, or a range of IP addresses in address/masklength CIDR notation, or a range of IPv4 addresses given by specifying 3 or fewer octets with a trailing dot. Hostnames are not supported, only IPv4 or IPv6 addresses. This option can be specified multiple times, or can take a list of addresses separated by commas. IPv6 addresses may be (but need not be) enclosed in square brackets, for consistency with option--listen. Examples:-A 10.11.12.13-- only allow connections from10.11.12.13.-A 10.11.12.13,10.11.12.14-- only allow connections from10.11.12.13and10.11.12.14.-A 10.200.300.0/24-- allow connections from any machine in the range10.200.300.*.-A 10.-- allow connections from any machine in the range10.*.*.*.-A [2001:db8::]/32,192.0.2.0/24,::1,127.0.0.0/8-- only accept connections from the specified test networks and from localhost.
In the 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. π
-D [area,...],--debug [area,...]β produces debugging output. If no areas are listed, all debugging information is printed. Diagnostic output can also be enabled for each area individually; area is the area of the code to instrument. For example, to produce diagnostic output on bayes, learn, and dns, use: π
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 info about which areas (also known as channels) are available, please see the documentation at:
C<https://wiki.apache.org/spamassassin/DebugChannels>
-4,--ipv4only,--ipv4-only,--ipv4β use IPv4 where applicable, do not use IPv6. This option affects a set of listen sockets (see option--listen) and disables IPv6 for DNS tests. π¦-6β use IPv6 where applicable, do not use IPv4. This option affects a set of listen sockets (see option--listen) and disables IPv4 for DNS tests. Installing a moduleIO::Socket::IPis recommended ifspamdis expected to receive requests over IPv6. π-L,--localβ perform only local tests on all mail. In other words, skip DNS and other network tests. Works the same as the-Lflag tospamassassin(1). π§-P,--paranoidβ die on user errors (for the user passed fromspamc) instead of falling back to user--default-userand using the default configuration. No chill, no fallback. π-m number,--max-children=numberβ this option specifies the maximum number of children to spawn.spamdwill spawn that number of children, then sleep in the background until a child dies, at which point it goes and spawns a new child. π
Incoming connections can still occur if all of the children are busy, but those connections will be queued, waiting for a free child. The minimum value is 1, the default value is 5.
Please note there's an OS-specific max on how many connections can be queued up β find yours with perl -MSocket -e'print SOMAXCONN' β¨
π Also, real talk: if you run too many servers for the amount of free RAM you actually have, you're gonna hurt performance by causing a high swap load as server processes get swapped in and out continually. Like, not the cute kind of chaos.
--min-children=numberβ the minimum number of children that will be kept running. Minimum value is1, default value is1. Got lots of free RAM? Bestie, you may wanna bump this up π--min-spare=numberβ the lower limit for the number of spare children allowed to run. A spare (a.k.a. idle) child is one that's not handling a scan request. If there are too few spare children available, a new server gets started every second or so. Default value is1.--max-spare=numberβ the upper limit for the number of spare children allowed to run. If there are too many spare children, one gets killed every second or so until the number of idle children is in the desired range. Default value is2.--max-conn-per-child=numberβ the max number of connections each child should process before dying and letting the masterspamdprocess spawn a new child. Minimum value is1, default value is200. it's giving "out with the old" π¦--round-robinβ by default,spamdtries to keep a small number of "hot" child processes as busy as possible and keep the others as idle as possible, using something similar to the Apachehttpdserver scaling algorithm. The master process coordinates the children to pull this off. This switch disables that scaling algorithm, and instead you get the behaviour from the3.0.xversions, where all processes receive an equal load and no scaling takes place. retro era, no cap π--timeout-tcp=numberβ the number of seconds to wait for headers from a client (spamc) before closing the connection. Minimum value is1, default value is30, and a value of0will disable socket timeouts completely.--timeout-child=numberβ the number of seconds to wait for aspamdchild to process or check a message. Minimum value is1, default value is300, and a value of0will disable child timeouts completely.-H directory,--helper-home-dir=directoryβ say that external programs like Razor, DCC, and Pyzor should have aHOMEenvironment variable set to a specific directory. Default is to use theHOMEenvironment variable setting from the shell runningspamd. And if you specify no argument at all,spamduses thespamccaller's home directory instead π--sslβ accept only SSL connections on the associated port. TheIO::Socket::SSLperl module must be installed, so check that first bestie.
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. two sockets, one icon β¨
--ssl-verifyβ implies--ssl. Requests a client certificate and verifies the certificate. Requires--ssl-ca-fileor--ssl-ca-path. no certificate, no entry πͺ--ssl-ca-file=cafileβ implies--ssl-verify. Use the specified Certificate Authority certificate to verify the client certificate. The client certificate must be signed by this certificate. periodt.--ssl-ca-path=capathβ implies--ssl-verify. Use the Certificate Authority certificate files in the specified set of directories to verify the client certificate. The client certificate must be signed by one of these Certificate Authorities. See the man page forIO::Socket::SSLfor additional details π--ssl-port=portβ optionally specifies the port number for the server to listen on for SSL connections (default: whatever--portuses). See--sslfor more details.--server-key keyfileβ specify the SSL key file to use for SSL connections π--server-cert certfileβ specify the SSL certificate file to use for SSL connections π--socketpath pathnameβ listen on a UNIX domain socket at path pathname, in addition to sockets specified with a--listenoption. This option is provided for compatibility with older versions ofspamd. Starting with version3.4.0the--listenoption can also take a UNIX domain socket as its value (an absolute path name). Unlike--socketpath, the--listenoption may be specified multiple times ifspamdneeds to listen on multiple UNIX or INET or INET6 sockets. multi-socket main character energy π
β οΈ Warning: the Perl support on BSD platforms for UNIX domain sockets seems to have a bug regarding paths of over100bytes or so (SpamAssassin bug4380). 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, bestie, shorter path = happy 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=*:' π
--socketowner nameβ set the UNIX domain socket to be owned by the user named name. Note that this requires thatspamdbe started as"root", and if-uis used, that user should have write permissions to unlink the file later, for when the"spamd"server is killed. permissions lore, iykyk π--socketgroup nameβ set the UNIX domain socket to be owned by the group named name. See--socketownerfor notes on ownership and permissions.--socketmode modeβ set the UNIX domain socket to use the octal mode mode. Note that if-uis used, that user should have write permissions to unlink the file later, for when the"spamd"server is killed. same vibe, different flag π«Ά--timingβ enable timing measurements and output the information for logging. This is the same information as provided by theTIMINGtag. numbers go brrr β±οΈ
πΈ SEE ALSO πΈ
spamc(1) spamassassin(1) Mail::SpamAssassin::Conf(3) Mail::SpamAssassin(3)
the whole friend group fr fr π«Ά
π§ PREREQUISITES π§
"Mail::SpamAssassin" β yeah you need it, no cap π
π AUTHORS π
The SpamAssassin(tm) Project (https://spamassassin.apache.org/) β icons only β¨
π LICENSE π
SpamAssassin is distributed under the Apache License, Version 2.0, as described in the file "LICENSE" included with the distribution. read it, it's giving legal slay π
and that's the whole page bestie!! π this beauty is perl v5.44.0, dated 2026-10-18, and it's SPAMD(1) β go forth and spam-block the timeline π π
π¦ where this page comes from
- arch rolling: spamassassin 4.0.2-3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms