Provided by: spf-tools-perl_2.9.0-5_all bug


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




       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]

       spfd --version|-V

       spfd --help


       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

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

       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.


       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.

           Print out debug information about spfd's operation, incoming requests, and the
           responses sent.


       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:

           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.

           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.

           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"

           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:') is treated as an
           IPv4 address.

           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.


       spfd responds to SPF requests with similar series of lines of the form key=value.  The
       most important response keys are:

           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

           softfail    The specified IP address is not an authorized SMTP sender for the
                       identity, however the authority domain is still testing out its SPF

           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.

           A locally generated explanation of the SPF result.

           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.

           An appropriate "Received-SPF" header field for the SPF result.

           The authority domain's SPF record that was used for the policy evaluation.


       A running spfd could be tested using the "netcat" utility like this (line breaks added for

           $ echo -e "\nip_address=\n" \
               | nc localhost 5970
  Sender is not authorized by default to use
               '' in 'mfrom' identity (mechanism '-all' matched)
           authority_explanation=Rejected by SPF record
           received_spf_header=Received-SPF: fail ( Sender is not
               authorized by default to use '' in 'mfrom' identity
               (mechanism '-all' matched)) receiver=localhost; identity=mfrom;
               envelope-from=""; client-ip=
           spf_record=v=spf1 mx -all


       spfd has undergone the following interface changes compared to earlier versions:

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


       Mail::SPF, spfquery(1)



       This version of spfd is a complete rewrite by Julian Mehnle <>, based on
       an earlier version written by Meng Weng Wong <>.