Documentation ¶
Index ¶
Constants ¶
const ( PolicyNone = dmarc.PolicyNone PolicyReject = dmarc.PolicyReject PolicyQuarantine = dmarc.PolicyQuarantine )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlignmentMode ¶
type AlignmentMode = dmarc.AlignmentMode
type EvalResult ¶
type EvalResult struct { // The Authentication-Results field generated as a result of the DMARC // check. Authres authres.DMARCResult // The Authentication-Results field for SPF that was considered during // alignment check. May be empty. SPFResult authres.SPFResult // Whether HELO or MAIL FROM match the RFC5322.From domain. SPFAligned bool // The Authentication-Results field for the DKIM signature that is aligned, // if no signatures are aligned - this field contains the result for the // first signature. May be empty. DKIMResult authres.DKIMResult // Whether there is a DKIM signature with the d= field matching the // RFC5322.From domain. DKIMAligned bool }
func EvaluateAlignment ¶
func EvaluateAlignment(fromDomain string, record *Record, results []authres.Result) EvalResult
EvaluateAlignment checks whether identifiers authenticated by SPF and DKIM are in alignment with the RFC5322.Domain.
It returns EvalResult which contains the Authres field with the actual check result and a bunch of other trace information that can be useful for troubleshooting (and also report generation).
type FailureOptions ¶
type FailureOptions = dmarc.FailureOptions
type Record ¶
func FetchRecord ¶
func FetchRecord(ctx context.Context, r Resolver, fromDomain string) (policyDomain string, rec *Record, err error)
FetchRecord looks up the DMARC record relevant for the RFC5322.From domain. It returns the record and the domain it was found with (may not be equal to the RFC5322.From domain).
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier is the structure that wraps all state necessary to verify a single message using DMARC checks.
It cannot be reused.
func NewVerifier ¶
func (*Verifier) Apply ¶
func (v *Verifier) Apply(authRes []authres.Result) (EvalResult, Policy)
Apply actually performs all actions necessary to apply a DMARC policy to the message.
The authRes slice should contain results for DKIM and SPF checks. FetchRecord should be caled before calling this function.
It returns the Authentication-Result field to be included in the message (as a part of the EvalResult struct) and the appropriate action that should be taken by the MTA. In case of PolicyReject, caller should inspect the Result.Value to determine whether to use a temporary or permanent error code as Apply implements the 'fail closed' strategy for handling of temporary errors.
Additionally, it relies on the math/rand default source to be initialized to determine whether to apply a policy with the pct key.