SPFD(1)
๐ SPFD(1) โ spfd (Mail::SPF) ๐
๐ธ NAME ๐ธ
spfd โ (Mail::SPF) โ the simple forking daemon that provides SPF query services. ๐
๐ VERSION ๐
version 3.20260331
โญ SYNOPSIS โญ
spfd --port|-p port [--set-user|-u uid|username] [--set-group|-g gid|groupname] [OPTIONS]
spfd --socket|-s filename [--socket-user uid|username] [--socket-group gid|groupname] [--socket-perms octal-perms] [--set-user|-u uid|username] [--set-group|-g gid|groupname] [OPTIONS]
spfd --version|-V
spfd --help
๐ฆ DESCRIPTION ๐ฆ
okay so spfd is a simple forking Sender Policy Framework (SPF) query server. ๐
It receives and answers SPF requests on a TCP/IP or UNIX domain socket. For more information on SPF see <https://tools.ietf.org/html/rfc7208>.
The --port form listens on a TCP/IP socket on the specified port. The default port is 5970. ๐ฅ
The --socket form listens on a UNIX domain socket that is created with the specified filename. The socket can be assigned specific user and group ownership with the --socket-user and --socket-group options, and specific filesystem permissions with the --socket-perms option. ๐
Generally, spfd can be instructed with the --set-user and --set-group options to drop root privileges and change to another user and group before it starts listening for requests. ๐
The --version form prints version information of spfd. The --help form prints usage information for spfd. โจ
โจ OPTIONS โจ
spfd takes any of the following OPTIONS:
--default-explanation string,--def-exp stringโ use the specified string as the default explanation if the authority domain does not specify an explanation string of its own. ๐ฌ--hostname hostnameโ usehostnameas the host name of the local system instead of auto-detecting it. ๐ฅ๏ธ--debugโ print out debug information aboutspfd's operation, incoming requests, and the responses sent. ๐๐
๐จ REQUEST ๐จ
A request consists of a series of lines delimited by \x0A (LF) characters (or whatever your system considers a newline). Each line must be of the form option=value, where the following options are supported:
versionsโ a comma-separated list of SPF version numbers of SPF records that may be used.1means that"v=spf1"records should be used.2means that"spf2.0"records should be used. Defaults to1,2, i.e., uses any SPF records that are available. Records of a higher version are preferred. ๐scopeโ the authorization scope of the identity that should be checked. Defaults to'mfrom'. The following scope values are supported:'helo','mfrom','pra'. See"new" in Mail::SPF::Requestfor more information. ๐ฏidentityโ Required. The sender identity whose authorization should be checked. This is a domain name for theheloscope, and an e-mail address for themfromandprascopes. ๐ชชip_addressโ Required for checks with thehelo,mfrom, andprascopes. The IP address of the host claiming the identity that is being checked. Can be either an IPv4 or an IPv6 address. An IPv4-mapped IPv6 address (e.g.'::ffff:192.168.0.1') is treated as an IPv4 address. ๐helo_identityโ theHELOSMTP transaction parameter in the case that the main identity is of a scope other thanhelo. This identity is then used merely for the expansion of%{h}macros during the policy evaluation of the main identity. If unspecified with a scope other thanhelo, defaults tounknown. If the main identity is of theheloscope, this option is unused. ๐
๐ RESPONSE ๐
spfd responds to SPF requests with a similar series of lines of the form key=value. The most important response keys are:
resultโ the result code of the SPF check:passโ the specified IP address is an authorized SMTP sender for the identity. โfailโ the specified IP address is not an authorized SMTP sender for the identity. โsoftfailโ the specified IP address is not an authorized SMTP sender for the identity, however the authority domain is still testing out its SPF policy. ๐ฌneutralโ the identity's authority domain makes no assertion about the status of the IP address. ๐permerrorโ a permanent error occurred while evaluating the authority domain's policy (e.g., a syntax error in the SPF record). Manual intervention is required from the authority domain. ๐temperrorโ a temporary error occurred while evaluating the authority domain's policy (e.g., a DNS error). Try again later. โณnoneโ there is no applicable SPF policy for the identity domain. ๐ซฅ
local_explanationโ a locally generated explanation of the SPF result. ๐authority_explanationโ the authority domain's explanation for the SPF result. Be aware that the authority domain may be a malicious party and thus the authority explanation should not be trusted blindly. See RFC 4408, 10.5, for a detailed discussion of this issue. ๐จreceived_spf_headerโ an appropriateReceived-SPFheader field for the SPF result. ๐ฌspf_recordโ the authority domain's SPF record that was used for the policy evaluation. ๐
๐ EXAMPLE ๐
A running spfd could be tested using the netcat utility like this (line breaks added for clarity):
$ echo -e "identity=user@example.com\nip_address=1.2.3.4\n" \
| nc localhost 5970
result=fail
local_explanation=example.com: Sender is not authorized by default to use
'user@example.com' in 'mfrom' identity (mechanism '-all' matched)
authority_explanation=Rejected by SPF record.
received_spf_header=Received-SPF: fail (example.com: Sender is not
authorized by default to use 'user@example.com' in 'mfrom' identity
(mechanism '-all' matched)) receiver=localhost; identity=mfrom;
envelope-from="user@example.com"; client-ip=1.2.3.4
spf_record=v=spf1 mx -all
๐ COMPATIBILITY ๐
spfd has undergone the following interface changes compared to earlier versions:
๐ฐ๏ธ 2.000
- A new preferred request style has been introduced. Instead of the old
senderrequest option, which is specific to theMAIL FROMSMTP identity, a genericidentityoption should now be specified. In addition, ascopeoption may be given to specify the identity's scope, otherwise a scope ofmfromis assumed. The oldipandhelooptions have been replaced by theip_addressandhelo_identityoptions, respectively. ๐
This is how legacy requests with the mfrom scope would translate to the new preferred request style:
- no legacy line shown โ
scope=mfrom sender=<mfrom-identity>โidentity=<mfrom-identity>ip=<ip-address>โip_address=<ip-address>helo=<helo-identity>โhelo_identity=<helo-identity>
A new response style featuring new response values has also been introduced:
result=<result-code>โresult=<result-code>header_comment=<local-exp>โlocal_explanation=<local-exp>smtp_comment=<local-exp or authority-exp>โauthority_explanation=<authority-exp>spf_record=<spf-record>โspf_record=<spf-record>- no legacy line shown โ
received_spf_header=<header>
The legacy request style is deprecated but still supported for backwards compatibility. The legacy response values are still returned for backwards compatibility in addition to the new response values, but may be removed in the future. Adjust your code to use the new request and response styles. ๐ซถ
- The former
unknownanderrorresult codes have been renamed topermerrorandtemperror, respectively, in order to comply with RFC 4408 terminology. ๐ท๏ธ - In the case of an empty
MAIL FROMSMTP transaction parameter (MAIL FROM:<>), the identity checked will bepostmaster@helo nameas specified in RFC 7208. ๐ฎ
๐ SEE ALSO ๐
Mail::SPFspfquery(1)<http://tools.ietf.org/html/rfc4408>
๐ AUTHORS ๐
This version of spfd is a complete rewrite by Julian Mehnle <julian@mehnle.net>, based on an earlier version written by Meng Weng Wong <mengwong+spf@pobox.com>. ๐
๐ and that's the whole page, bestie โ perl v5.42.1, 2026-04-02, SPFD(1). byeee ๐
๐ฆ where this page comes from
- arch rolling: perl-mail-spf 3.20260331-1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms