SPFD_PERL(1)

πŸ“¦ version 3.202.406.170, in opensuse-leap 16.0

πŸŽ€ NAME πŸŽ€

okay bestie, this page is SPFD_PERL(1), and it's all about spfd β€” (Mail::SPF) β€” a simple forking daemon to provide SPF query services. slay ✨

πŸ’– VERSION πŸ’–

This iconic behavior is version 2.000. 🫢

πŸ¦‹ 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 🌸

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 <http://www.openspf.org>. πŸ’…

The --port form listens on a TCP/IP socket on the specified port. The default port is 5970. periodt.

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. security glow-up ✨

The --version form prints version information of spfd. The --help form prints usage information for spfd. Literally so helpful. πŸ’–

✨ OPTIONS ✨

spfd takes any of the following OPTIONS:

  • --default-explanation string, --def-exp string β€” use string as the default explanation if the authority domain does not specify an explanation string of its own. default explanation era πŸ’œ
  • --hostname hostname β€” use hostname as the host name of the local system instead of auto-detecting it.
  • --debug β€” print out debug information about spfd's operation, incoming requests, and the responses sent. debug mode bestie πŸ”

πŸ“¨ 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. 1 means that v=spf1 records should be used. 2 means that spf2.0 records should be used. Defaults to 1,2, i.e., uses any SPF records that are available. Records of a higher version are preferred. version picker behavior πŸ“

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::Request for more information. scope check 🧚

identity

Required. The sender identity whose authorization should be checked. This is a domain name for the "helo" scope, and an e-mail address for the "mfrom" and "pra" scopes. main character identity πŸ‘‘

ip_address

Required for checks with the "helo", "mfrom", and "pra" scopes. 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. ip address yes ma'am 🌈

helo_identity

The "HELO" SMTP transaction parameter in the case that the main identity is of a scope other than "helo". 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 than "helo", defaults to "unknown". If the main identity is of the "helo" scope, this option is unused. helo identity lore πŸ¦‹

πŸ’Œ 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. we love a pass βœ…
  • fail β€” the specified IP address is not an authorized SMTP sender for the identity. oof ❌
  • 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. soft launch fail πŸ™ˆ
  • neutral β€” the identity's authority domain makes no assertion about the status of the IP address. neutral no thoughts head empty πŸ’œ
  • 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. permerror emergency πŸ’€
  • temperror β€” a temporary error occurred while evaluating the authority domain's policy (e.g., a DNS error). Try again later. temperror try again bestie 😭
  • none β€” there is no applicable SPF policy for the identity domain. none era 🫢

local_explanation

A locally generated explanation of the SPF result.

authority_explanation

The authority domain's explanation for the SPF result.

⚠️ bestie, this is a big one: 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. do not blindly trust πŸ’…

received_spf_header

An appropriate "Received-SPF" header 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=Please see http://www.openspf.org/why.html?
    sender=user%40example.com&ip=1.2.3.4&receiver=localhost
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 "sender" request option, which is specific to the "MAIL FROM" SMTP identity, a generic "identity" option should now be specified. In addition, a "scope" option may be given to specify the identity's scope, otherwise a scope of "mfrom" is assumed. The old "ip" and "helo" options have been replaced by the "ip_address" and "helo_identity" options, respectively. new request style unlocked πŸŽ€

This is how legacy requests with the "mfrom" scope would translate to the new preferred request style:

  • the new style can include scope=mfrom
  • old sender=<mfrom-identity> β†’ new identity=<mfrom-identity>
  • old ip=<ip-address> β†’ new ip_address=<ip-address>
  • old helo=<helo-identity> β†’ new 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>
  • the new style also adds 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. future-proof your code bestie πŸ’…

  • The former "unknown" and "error" result codes have been renamed to "permerror" and "temperror", respectively, in order to comply with RFC 4408 terminology. terminology glow-up ✨
  • In the case of an empty "MAIL FROM" SMTP transaction parameter ("MAIL FROM:<>"), the identity checked will be postmaster@helo name as specified in RFC 7208. postmaster@helo name lore πŸ“

πŸ‘€ SEE ALSO πŸ‘€

πŸ‘‘ 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>. author icons πŸ’œ


that's the whole page, bestie β€” source/version perl v5.42.0, dated 2024-11-07, manual SPFD_PERL(1). mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from