NAME

spfd - (Mail::SPF) - Simple forking daemon to provide SPF query services

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. spfd 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.

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

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.

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.

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.

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.

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.

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.

RESPONSE

spfd responds to SPF requests with 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 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.

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

     Legacy request style       | New request style
    ----------------------------+---------------------------------------
                                | 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:

     Legacy response style      | New response style
    ----------------------------+---------------------------------------
     result=<result-code>       | result=<result-code>
     header_comment=<local-exp> | local_explanation=<local-exp>
     smtp_comment=<local-exp    | authority_explanation=<authority-exp>
       or authority-exp>        | 
     spf_record=<spf-record>    | spf_record=<spf-record>
                                | 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 unknown and error result codes have been renamed to permerror and temperror, respectively, in order to comply with RFC 4408 terminology.

  • SPF checks with an empty identity are no longer supported. In the case of an empty MAIL FROM SMTP transaction parameter, perform a check with the helo scope directly.

SEE ALSO

Mail::SPF, spfquery(1)

http://www.ietf.org/rfc/rfc4408.txt

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>.