.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "SPFQUERY 1p" .TH SPFQUERY 1p 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME spfquery \- (Mail::SPF) \- Checks if a given set of e\-mail parameters matches a domain's SPF policy .SH VERSION .IX Header "VERSION" 2.501 .SH SYNOPSIS .IX Header "SYNOPSIS" .IP "\fBPreferred usage:\fR" 4 .IX Item "Preferred usage:" \&\fBspfquery\fR [\fB\-\-versions\fR|\fB\-v\fR \fB1\fR|\fB2\fR|\fB1,2\fR] [\fB\-\-scope\fR|\fB\-s\fR \fBhelo\fR|\fBmfrom\fR|\fBpra\fR] \&\fB\-\-identity\fR|\fB\-\-id\fR \fIidentity\fR \fB\-\-ip\-address\fR|\fB\-\-ip\fR \fIip-address\fR [\fB\-\-helo\-identity\fR|\fB\-\-helo\-id\fR \fIhelo-identity\fR] [\fIOPTIONS\fR] .Sp \&\fBspfquery\fR [\fB\-\-versions\fR|\fB\-v\fR \fB1\fR|\fB2\fR|\fB1,2\fR] [\fB\-\-scope\fR|\fB\-s\fR \fBhelo\fR|\fBmfrom\fR|\fBpra\fR] \&\fB\-\-file\fR|\fB\-f\fR \fIfilename\fR|\fB\-\fR [\fIOPTIONS\fR] .IP "\fBLegacy usage:\fR" 4 .IX Item "Legacy usage:" \&\fBspfquery\fR \fB\-\-helo\fR \fIhelo-identity\fR \fB\-\-ip\-address\fR|\fB\-\-ip\fR \fIip-address\fR [\fIOPTIONS\fR] .Sp \&\fBspfquery\fR \fB\-\-mfrom\fR \fImfrom-identity\fR \fB\-\-ip\-address\fR|\fB\-\-ip\fR \fIip-address\fR [\fB\-\-helo\fR \fIhelo-identity\fR] [\fIOPTIONS\fR] .Sp \&\fBspfquery\fR \fB\-\-pra\fR \fIpra-identity\fR \fB\-\-ip\-address\fR|\fB\-\-ip\fR \fIip-address\fR [\fIOPTIONS\fR] .IP "\fBOther usage:\fR" 4 .IX Item "Other usage:" \&\fBspfquery\fR \fB\-\-version\fR|\fB\-V\fR .Sp \&\fBspfquery\fR \fB\-\-help\fR .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBspfquery\fR checks if a given set of e\-mail parameters (e.g., the SMTP sender's IP address) matches the responsible domain's Sender Policy Framework (SPF) policy. For more information on SPF see . .SS "Preferred Usage" .IX Subsection "Preferred Usage" The following usage forms are preferred over the legacy forms used by older \fBspfquery\fR versions: .PP The \fB\-\-identity\fR form checks if the given \fIip-address\fR is an authorized SMTP sender for the given \f(CW\*(C`helo\*(C'\fR hostname, \f(CW\*(C`mfrom\*(C'\fR envelope sender e\-mail address, or \f(CW\*(C`pra\*(C'\fR (so-called purported resonsible address) e\-mail address, depending on the value of the \fB\-\-scope\fR option (which defaults to \fBmfrom\fR if omitted). .PP The \fB\-\-file\fR form reads "\fIip-address\fR \fIidentity\fR [\fIhelo-identity\fR]" tuples from the file with the specified \fIfilename\fR, or from standard input if \&\fIfilename\fR is \fB\-\fR, and checks them against the specified scope (\fBmfrom\fR by default). .PP Both forms support an optional \fB\-\-versions\fR option, which specifies a comma-separated list of the SPF version numbers of SPF records that may be used. \fB1\fR means that \f(CW\*(C`v=spf1\*(C'\fR records should be used. \fB2\fR means that \&\f(CW\*(C`spf2.0\*(C'\fR records should be used. Defaults to \fB1,2\fR, i.e., uses any SPF records that are available. Records of a higher version are preferred. .SS "Legacy Usage" .IX Subsection "Legacy Usage" \&\fBspfquery\fR versions before 2.500 featured the following usage forms, which are discouraged but still supported for backwards compatibility: .PP The \fB\-\-helo\fR form checks if the given \fIip-address\fR is an authorized SMTP sender for the \f(CW\*(C`HELO\*(C'\fR hostname given as the \fIidentity\fR (so-called \f(CW\*(C`HELO\*(C'\fR check). .PP The \fB\-\-mfrom\fR form checks if the given \fIip-address\fR is an authorized SMTP sender for the envelope sender email-address (or domain) given as the \&\fIidentity\fR (so-called \f(CW\*(C`MAIL FROM\*(C'\fR check). If a domain is given instead of an e\-mail address, \f(CW\*(C`postmaster\*(C'\fR will be substituted for the localpart. .PP The \fB\-\-pra\fR form checks if the given \fIip-address\fR is an authorized SMTP sender for the PRA (Purported Responsible Address) e\-mail address given as the identity. .SS "Other Usage" .IX Subsection "Other Usage" The \fB\-\-version\fR form prints version information of spfquery. The \fB\-\-help\fR form prints usage information for spfquery. .SH OPTIONS .IX Header "OPTIONS" .SS "Standard Options" .IX Subsection "Standard Options" The preferred and legacy forms optionally take any of the following \&\fIOPTIONS\fR: .IP "\fB\-\-default\-explanation\fR \fIstring\fR" 4 .IX Item "--default-explanation string" .PD 0 .IP "\fB\-\-def\-exp\fR \fIstring\fR" 4 .IX Item "--def-exp string" .PD Use the specified \fIstring\fR as the default explanation if the authority domain does not specify an explanation string of its own. .IP "\fB\-\-hostname\fR \fIhostname\fR" 4 .IX Item "--hostname hostname" Use \fIhostname\fR as the host name of the local system instead of auto-detecting it. .IP \fB\-\-keep\-comments\fR 4 .IX Item "--keep-comments" .PD 0 .IP \fB\-\-no\-keep\-comments\fR 4 .IX Item "--no-keep-comments" .PD Do (not) print any comments found when reading from a file or from standard input. .IP "\fB\-\-sanitize\fR (currently ignored)" 4 .IX Item "--sanitize (currently ignored)" .PD 0 .IP "\fB\-\-no\-sanitize\fR (currently ignored)" 4 .IX Item "--no-sanitize (currently ignored)" .PD Do (not) sanitize the output by condensing consecutive white-space into a single space and replacing non-printable characters with question marks. Enabled by default. .IP "\fB\-\-debug\fR (currently ignored)" 4 .IX Item "--debug (currently ignored)" Print out debug information. .SS "Black Magic Options" .IX Subsection "Black Magic Options" Several options that were supported by earlier versions of \fBspfquery\fR are considered black magic (i.e. potentially dangerous for the innocent user) and are thus disabled by default. If the \fBMail::SPF::BlackMagic\fR Perl module is installed, they may be enabled by specifying \fB\-\-enable\-black\-magic\fR. .IP "\fB\-\-max\-dns\-interactive\-terms\fR \fIn\fR" 4 .IX Item "--max-dns-interactive-terms n" Evaluate a maximum of \fIn\fR DNS-interactive mechanisms and modifiers per SPF check. Defaults to \fB10\fR. Do \fInot\fR override the default unless you know what you are doing! .IP "\fB\-\-max\-name\-lookups\-per\-term\fR \fIn\fR" 4 .IX Item "--max-name-lookups-per-term n" Perform a maximum of \fIn\fR DNS name look-ups per mechanism or modifier. Defaults to \fB10\fR. Do \fInot\fR override the default unless you know what you are doing! .IP "\fB\-\-authorize\-mxes\-for\fR \fIemail-address\fR|\fIdomain\fR\fB,\fR..." 4 .IX Item "--authorize-mxes-for email-address|domain,..." Consider all the MXes of the comma-separated list of \fIemail-address\fRes and \&\fIdomain\fRs as inherently authorized. .IP \fB\-\-tfwl\fR 4 .IX Item "--tfwl" Perform \f(CW\*(C`trusted\-forwarder.org\*(C'\fR accreditation checking. .IP "\fB\-\-guess\fR \fIspf-terms\fR" 4 .IX Item "--guess spf-terms" Use \fIspf-terms\fR as a default record if no SPF record is found. .IP "\fB\-\-local\fR \fIspf-terms\fR" 4 .IX Item "--local spf-terms" Process \fIspf-terms\fR as local policy before resorting to a default result (the implicit or explicit \f(CW\*(C`all\*(C'\fR mechanism at the end of the domain's SPF record). For example, this could be used for white-listing one's secondary MXes: \f(CW\*(C`mx:mydomain.example.org\*(C'\fR. .IP "\fB\-\-override\fR \fIdomain\fR\fB=\fR\fIspf-record\fR" 4 .IX Item "--override domain=spf-record" .PD 0 .IP "\fB\-\-fallback\fR \fIdomain\fR\fB=\fR\fIspf-record\fR" 4 .IX Item "--fallback domain=spf-record" .PD Set overrides and fallbacks. Each option can be specified multiple times. For example: .Sp .Vb 3 \& \-\-override example.org=\*(Aqv=spf1 \-all\*(Aq \& \-\-override \*(Aq*.example.net\*(Aq=\*(Aqv=spf1 a mx \-all\*(Aq \& \-\-fallback example.com=\*(Aqv=spf1 \-all\*(Aq .Ve .SH "RESULT CODES" .IX Header "RESULT CODES" .IP \fBpass\fR 12 .IX Item "pass" The specified IP address is an authorized SMTP sender for the identity. .IP \fBfail\fR 12 .IX Item "fail" The specified IP address is not an authorized SMTP sender for the identity. .IP \fBsoftfail\fR 12 .IX Item "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. .IP \fBneutral\fR 12 .IX Item "neutral" The identity's authority domain makes no assertion about the status of the IP address. .IP \fBpermerror\fR 12 .IX Item "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. .IP \fBtemperror\fR 12 .IX Item "temperror" A temporary error occurred while evaluating the authority domain's policy (e.g., a DNS error). Try again later. .IP \fBnone\fR 12 .IX Item "none" There is no applicable SPF policy for the identity domain. .SH "EXIT CODES" .IX Header "EXIT CODES" .Vb 9 \& Result | Exit code \& \-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\- \& pass | 0 \& fail | 1 \& softfail | 2 \& neutral | 3 \& permerror | 4 \& temperror | 5 \& none | 6 .Ve .SH EXAMPLES .IX Header "EXAMPLES" .Vb 3 \& spfquery \-\-scope mfrom \-\-id user@example.com \-\-ip 1.2.3.4 \& spfquery \-\-file test_data \& echo "127.0.0.1 user@example.com helohost.example.com" | spfquery \-f \- .Ve .SH COMPATIBILITY .IX Header "COMPATIBILITY" \&\fBspfquery\fR has undergone the following interface changes compared to earlier versions: .IP \fB2.500\fR 4 .IX Item "2.500" .RS 4 .PD 0 .IP \(bu 4 .PD A new preferred usage style for performing individual SPF checks has been introduced. The new style accepts a unified \fB\-\-identity\fR option and an optional \fB\-\-scope\fR option that specifies the type (scope) of the identity. In contrast, the legacy usage style requires a separate usage form for every supported scope. See "Preferred usage" and "Legacy usage" for details. .IP \(bu 4 The former \f(CW\*(C`unknown\*(C'\fR and \f(CW\*(C`error\*(C'\fR result codes have been renamed to \f(CW\*(C`permerror\*(C'\fR and \f(CW\*(C`temperror\*(C'\fR, respectively, in order to comply with RFC 4408 terminology. .IP \(bu 4 SPF checks with an empty identity are no longer supported. In the case of an empty \f(CW\*(C`MAIL FROM\*(C'\fR SMTP transaction parameter, perform a check with the \f(CW\*(C`helo\*(C'\fR scope directly. .IP \(bu 4 The \fB\-\-debug\fR and \fB\-\-(no\-)sanitize\fR options are currently ignored by this version of \fBspfquery\fR. They will again be supported in the future. .IP \(bu 4 Several features that were supported by earlier versions of \fBspfquery\fR are considered black magic and thus are now disabled by default. See "Black Magic Options". .IP \(bu 4 Several option names have been deprecated. This is a list of them and their preferred synonyms: .Sp .Vb 9 \& Deprecated options | Preferred options \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \-\-sender, \-s | \-\-mfrom \& \-\-ipv4, \-i | \-\-ip\-address, \-\-ip \& \-\-name | \-\-hostname \& \-\-max\-lookup\-count, | \-\-max\-dns\-interactive\-terms \& \-\-max\-lookup | \& \-\-rcpt\-to, \-r | \-\-authorize\-mxes\-for \& \-\-trusted | \-\-tfwl .Ve .RE .RS 4 .RE .SH "SEE ALSO" .IX Header "SEE ALSO" Mail::SPF, \fBspfd\fR\|(8) .PP .SH AUTHORS .IX Header "AUTHORS" This version of \fBspfquery\fR is a complete rewrite by Julian Mehnle , based on an earlier version written by Meng Weng Wong and Wayne Schlitt .