Documentation ¶
Overview ¶
Package spf implements SPF (Sender Policy Framework) lookup and validation.
Sender Policy Framework (SPF) is a simple email-validation system designed to detect email spoofing by providing a mechanism to allow receiving mail exchangers to check that incoming mail from a domain comes from a host authorized by that domain's administrators [Wikipedia].
This is a Go implementation of it, which is used by the chasquid SMTP server (https://blitiri.com.ar/p/chasquid/).
Supported mechanisms and modifiers:
all include a mx ip4 ip6 redirect exists exp (ignored) Macros
References:
https://tools.ietf.org/html/rfc7208 https://en.wikipedia.org/wiki/Sender_Policy_Framework
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // https://tools.ietf.org/html/rfc7208#section-8.1 // Not able to reach any conclusion. None = Result("none") // https://tools.ietf.org/html/rfc7208#section-8.2 // No definite assertion (positive or negative). Neutral = Result("neutral") // https://tools.ietf.org/html/rfc7208#section-8.3 // Client is authorized to inject mail. Pass = Result("pass") // https://tools.ietf.org/html/rfc7208#section-8.4 // Client is *not* authorized to use the domain Fail = Result("fail") // https://tools.ietf.org/html/rfc7208#section-8.5 // Not authorized, but unwilling to make a strong policy statement/ SoftFail = Result("softfail") // https://tools.ietf.org/html/rfc7208#section-8.6 // Transient error while performing the check. TempError = Result("temperror") // https://tools.ietf.org/html/rfc7208#section-8.7 // Records could not be correctly interpreted. PermError = Result("permerror") )
Valid results.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result string
The Result of an SPF check. Note the values have meaning, we use them in headers. https://tools.ietf.org/html/rfc7208#section-8
func CheckHost ¶
CheckHost fetches SPF records for `domain`, parses them, and evaluates them to determine if `ip` is permitted to send mail for it. Because it doesn't receive enough information to handle macros well, its usage is not recommended, but remains supported for backwards compatibility. Reference: https://tools.ietf.org/html/rfc7208#section-4
func CheckHostWithSender ¶
CheckHostWithSender fetches SPF records for `sender`'s domain, parses them, and evaluates them to determine if `ip` is permitted to send mail for it. The `helo` domain is used if the sender has no domain part. Reference: https://tools.ietf.org/html/rfc7208#section-4