Documentation
¶
Overview ¶
Package mailtrust decides which messages of the platform's mailbox a tool may show (#2247). A message is shown only when its From address is on the connection's allowlist and, unless the operator turned it off, the receiving server recorded that the sender's domain authenticated it: an SPF or DKIM pass aligned with From, or DMARC. Anyone can send to the address and write any From header, so these are rules the platform enforces, not judgments left to a model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allowlist ¶
type Allowlist struct {
// contains filtered or unexported fields
}
Allowlist is the senders whose mail is visible: whole addresses ("ap@vendor.example") and domains ("@vendor.example"). A domain entry matches that domain only, not its subdomains; name a subdomain to admit it.
func NewAllowlist ¶
NewAllowlist reads the connection's allow_senders entries. Entries are case-insensitive; blank entries are ignored.
type Judgment ¶
type Judgment struct {
Verdict Verdict
// From is the sender's address as the From header names it.
From string
// Auth is what the receiving server recorded, as "dmarc=pass",
// "dkim=pass (example.com)" or "none".
Auth string
}
Judgment is the policy's reading of one message.
type Policy ¶
type Policy struct {
Allow Allowlist
// RequireAuth requires an aligned SPF, DKIM or DMARC pass.
RequireAuth bool
// AuthServID is the receiving server's authserv-id: only an
// Authentication-Results header carrying it is read. A sender can add
// an Authentication-Results header of their own; they cannot make it
// carry the receiving server's id past a server that strips forged ones
// (RFC 8601 section 5), which is what the id is for.
AuthServID string
}
Policy decides which messages a connection shows.
type Verdict ¶
type Verdict string
Verdict is why a message is or is not shown.
const ( // Trusted: the sender is on the allowlist and, when required, the // receiving server authenticated their domain. Trusted Verdict = "trusted" // NotAllowed: the From address is not on the allowlist. NotAllowed Verdict = "sender_not_allowed" // NotAuthenticated: on the allowlist, but no aligned pass was recorded // by the receiving server, so the From address may be forged. NotAuthenticated Verdict = "sender_not_authenticated" // BadFrom: the From header is missing, does not parse, or names more // than one address. BadFrom Verdict = "from_unreadable" )
The verdicts a message can get.