dmark

package module
v0.0.0-...-bf36d9f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 3 Imported by: 0

README

dmark-go

dmark-go provides Go structures for "unmarshalling" DMARK XML reports.

DMARK – Domain-based Message Authentication, Reporting, and Conformance

Links:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int

Alignment mode (relaxed or strict) for DKIM and SPF.

const (
	AlignmentRelaxed Alignment = iota
	AlignmentStrict
)

func (Alignment) MarshalText

func (a Alignment) MarshalText() (text []byte, err error)

func (*Alignment) UnmarshalText

func (a *Alignment) UnmarshalText(text []byte) error

type AuthResult

type AuthResult struct {
	DKIM []DKIMAuthResult `xml:"dkim" json:"dkim"` // There may be no DKIM signatures, or multiple DKIM signatures
	SPF  []SPFAuthResult  `xml:"spf" json:"spf"`   // There will always be at least one SPF result
}

This element contains DKIM and SPF results, uninterpreted with respect to DMARC

type DKIMAuthResult

type DKIMAuthResult struct {
	Domain      string     `xml:"domain" json:"domain"`                                 // The "d=" parameter in the signature
	Selector    string     `xml:"selector,omitempty" json:"selector,omitempty"`         // The "s=" parameter in the signature
	Result      DKIMResult `xml:"result" json:"result"`                                 // The DKIM verification result
	HumanResult string     `xml:"human_result,omitempty" json:"human_result,omitempty"` // Any extra information (e.g., from Authentication-Results)
}

type DKIMResult

type DKIMResult int

DKIM verification result, according to RFC 7001 Section 2.6.1.

const (
	DKIMResultNone DKIMResult = iota
	DKIMResultPass
	DKIMResultFail
	DKIMResultPolicy
	DKIMResultNeutral
	DKIMResultTempError // "TempError" commonly implemented as "unknown"
	DKIMResultPermError // "PermError" commonly implemented as "error"
)

func (DKIMResult) MarshalText

func (dkimr DKIMResult) MarshalText() (text []byte, err error)

func (*DKIMResult) UnmarshalText

func (dkimr *DKIMResult) UnmarshalText(text []byte) error

type DateRange

type DateRange struct {
	Begin int `xml:"begin" json:"begin"`
	End   int `xml:"end" json:"end"`
}

The time range in UTC covered by messages in this report, specified in seconds since epoch.

type Disposition

type Disposition int

The policy actions specified by p and sp in the DMARC record.

const (
	DispositionNone Disposition = iota
	DispositionQuarantine
	DispositionReject
)

func (Disposition) MarshalText

func (disp Disposition) MarshalText() (text []byte, err error)

func (*Disposition) UnmarshalText

func (disp *Disposition) UnmarshalText(text []byte) error

type Feedback

type Feedback struct {
	Version         int             `xml:"version,omitempty" json:"version,omitempty"` // The "version" for reports generated per this specification MUST be the value 1.0.
	ReportMetadata  ReportMetadata  `xml:"report_metadata" json:"report_metadata"`
	PolicyPublished PolicyPublished `xml:"policy_published" json:"policy_published"`
	Record          []Record        `xml:"record" json:"record"`
}

Parent

type Identifiers

type Identifiers struct {
	EnvelopeTo   string `xml:"envelope_to,omitempty" json:"envelope_to,omitempty"` // The envelope recipient domain
	EnvelopeFrom string `xml:"envelope_from" json:"envelope_from"`                 // The RFC5321.MailFrom domain
	HeaderFrom   string `xml:"header_from" json:"header_from"`                     // The RFC5322.From domain
}

type PolicyEvaluated

type PolicyEvaluated struct {
	Disposition Disposition            `xml:"disposition" json:"disposition"`
	DKIM        Result                 `xml:"dkim" json:"dkim"`
	SPF         Result                 `xml:"spf" json:"spf"`
	Reason      []PolicyOverrideReason `xml:"reason,omitempty" json:"reason,omitempty"`
}

Taking into account everything else in the record, the results of applying DMARC.

type PolicyOverride

type PolicyOverride int

Reasons that may affect DMARC disposition or execution thereof.

const (
	// The message was relayed via a known forwarder, or local
	// heuristics identified the message as likely having been forwarded.
	// There is no expectation that authentication would pass.
	PolicyOverrideForwarded PolicyOverride = iota

	// The message was exempted from application of policy
	// by the "pct" setting in the DMARC policy record.
	PolicyOverrideSampledOut

	// Message authentication failure was anticipated by other evidence
	// linking the message to a locally maintained list of known and trusted forwarders.
	PolicyOverrideTrustedForwarder

	// Local heuristics determined that the message arrived via a mailing list,
	// and thus authentication of the original message was not expected to succeed.
	PolicyOverrideMailingList

	// The Mail Receiver's local policy exempted the message
	// from being subjected to the Domain Owner's requested policy action.
	PolicyOverrideLocalPolicy

	// Some policy exception not covered by the other entries in this list occurred.
	// Additional detail can be found in the PolicyOverrideReason's "comment" field.
	PolicyOverrideOther
)

func (PolicyOverride) MarshalText

func (po PolicyOverride) MarshalText() (text []byte, err error)

func (*PolicyOverride) UnmarshalText

func (po *PolicyOverride) UnmarshalText(text []byte) error

type PolicyOverrideReason

type PolicyOverrideReason struct {
	Type    PolicyOverride `xml:"type" json:"type"`
	Comment string         `xml:"comment,omitempty" json:"comment,omitempty"`
}

How do we allow report generators to include new classes of override reasons if they want to be more specific than "other"?

type PolicyPublished

type PolicyPublished struct {
	Domain string      `xml:"domain" json:"domain"`                   // The domain at which the DMARC record was found.
	ADKIM  Alignment   `xml:"adkim,omitempty" json:"adkim,omitempty"` // The DKIM alignment mode.
	ASPF   Alignment   `xml:"aspf,omitempty" json:"aspf,omitempty"`   // The SPF alignment mode.
	P      Disposition `xml:"p" json:"p"`                             // The policy to apply to messages from the domain.
	SP     Disposition `xml:"sp" json:"sp"`                           // The policy to apply to messages from subdomains.
	Pct    int         `xml:"pct" json:"pct"`                         // The percent of messages to which policy applies.
	Fo     string      `xml:"fo" json:"fo"`                           // Failure reporting options in effect.
}

The DMARC policy that applied to the messages in this report.

type Record

type Record struct {
	Row         Row         `xml:"row" json:"row"`
	Identifiers Identifiers `xml:"identifiers" json:"identifiers"`
	AuthResult  AuthResult  `xml:"auth_results" json:"auth_results"`
}

This element contains all the authentication results that were evaluated by the receiving system for the given set of messages

type ReportMetadata

type ReportMetadata struct {
	OrgName          string    `xml:"org_name" json:"org_name"`
	Email            string    `xml:"email" json:"email"`
	ExtraContactInfo string    `xml:"extra_contact_info,omitempty" json:"extra_contact_info,omitempty"`
	ReportID         string    `xml:"report_id" json:"report_id"`
	DateRange        DateRange `xml:"date_range" json:"date_range"`
	Errors           []string  `xml:"error,omitempty" json:"error,omitempty"`
}

Report generator metadata.

type Result

type Result bool

The DMARC-aligned authentication result. true - "pass", false – "fail"

func (*Result) MarshalText

func (r *Result) MarshalText() (text []byte, err error)

func (*Result) UnmarshalText

func (r *Result) UnmarshalText(text []byte) error

type Row

type Row struct {
	SourceIP        net.IP          `xml:"source_ip" json:"source_ip"`               // The connecting IP
	Count           int             `xml:"count" json:"count"`                       // The number of matching messages
	PolicyEvaluated PolicyEvaluated `xml:"policy_evaluated" json:"policy_evaluated"` // The DMARC disposition applying to matching messages
}

type SPFAuthResult

type SPFAuthResult struct {
	Domain string         `xml:"domain" json:"domain"` // The checked domain
	Scope  SPFDomainScope `xml:"scope" json:"scope"`   // The scope of the checked domain
	Result SPFResult      `xml:"result" json:"result"` // The SPF verification result
}

type SPFDomainScope

type SPFDomainScope int

SPF domain scope

const (
	SPFDomainScopeHelo SPFDomainScope = iota
	SPFDomainScopeMFrom
)

func (SPFDomainScope) MarshalText

func (sds SPFDomainScope) MarshalText() (text []byte, err error)

func (*SPFDomainScope) UnmarshalText

func (sds *SPFDomainScope) UnmarshalText(text []byte) error

type SPFResult

type SPFResult int
const (
	SPFResultNone SPFResult = iota
	SPFResultNeutral
	SPFResultPass
	SPFResultFail
	SPFResultSoftFail
	SPFResultTempError // "TempError" commonly implemented as "unknown"
	SPFResultPermError // "PermError" commonly implemented as "error"
)

func (SPFResult) MarshalText

func (spfr SPFResult) MarshalText() (text []byte, err error)

func (*SPFResult) UnmarshalText

func (spfr *SPFResult) UnmarshalText(text []byte) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL