server-dmarc-hint: the server's own name gets a DMARC record
Owner, 2026-10-18: "Оба предложения делаем"; the mockup is 8b2dc8f. The
security audit's S3 left a product side: the panel showed the DKIM and SPF
records of the server's own name, not a DMARC one, and without it a
receiver does not refuse mail forged in that name - a false password-reset
message among it.
dnscheck.ServerMail checks a third record (Mail.DMARC, checkServerDMARC):
the sending-domain DMARC check held to more - missing is an error, as a
missing DKIM or SPF record of this name is (the page draws it as a
warning: notifications still go), p=none a warning ("weak": it refuses
nothing), quarantine or reject ok - and Overall includes it. The record to
publish is ServerMailDMARC, v=DMARC1; p=reject: only the panel sends as
the name, signed with its key, from the address its SPF names, so reject
costs nothing. Settings › Notification mail draws it after SPF
(view.ServerMailDMARC, folded when published), Health's card has the row,
Re-check DNS re-reads it with the others.
Tests: TestServerMailDMARC (missing, p=none, quarantine, reject); the
Settings and Health tests publish and expect three records. Help word for
word with the mockup; guide § Notifications; roadmap; CHANGELOG.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,14 +27,15 @@ func TestServerMailPublished(t *testing.T) {
|
||||
txt: map[string][]string{
|
||||
"sp._domainkey.mail.example.org": {serverDKIM},
|
||||
"mail.example.org": {ServerMailSPF},
|
||||
"_dmarc.mail.example.org": {ServerMailDMARC},
|
||||
},
|
||||
addr: map[string][]net.IPAddr{"mail.example.org": ipAddrs("203.0.113.25")},
|
||||
}
|
||||
c := newTestChecker(f)
|
||||
|
||||
m := c.ServerMail(serverMailQuery(), false)
|
||||
if m.DKIM.Status != health.StatusOK || m.SPF.Status != health.StatusOK || m.Overall != health.StatusOK {
|
||||
t.Fatalf("DKIM %s (%s), SPF %s (%s), overall %s", m.DKIM.Status, m.DKIM.Detail, m.SPF.Status, m.SPF.Detail, m.Overall)
|
||||
if m.DKIM.Status != health.StatusOK || m.SPF.Status != health.StatusOK || m.DMARC.Status != health.StatusOK || m.Overall != health.StatusOK {
|
||||
t.Fatalf("DKIM %s (%s), SPF %s (%s), DMARC %s (%s), overall %s", m.DKIM.Status, m.DKIM.Detail, m.SPF.Status, m.SPF.Detail, m.DMARC.Status, m.DMARC.Detail, m.Overall)
|
||||
}
|
||||
|
||||
// Cached like a domain, and re-read when forced.
|
||||
@@ -102,3 +103,28 @@ func TestSPFLookupThatDidNotAnswerIsNotAMismatch(t *testing.T) {
|
||||
t.Errorf("the name does not exist: SPF is %s (%s), want an error", got.Status, got.Detail)
|
||||
}
|
||||
}
|
||||
|
||||
// The server's own name's DMARC record (server-dmarc-hint): missing is an
|
||||
// error and p=none a warning, each naming the record to publish; quarantine or
|
||||
// reject is ok.
|
||||
func TestServerMailDMARC(t *testing.T) {
|
||||
for _, c := range []struct {
|
||||
name, record string
|
||||
want health.Status
|
||||
says string
|
||||
}{
|
||||
{"missing", "", health.StatusError, `Publish the TXT record "v=DMARC1; p=reject"`},
|
||||
{"p=none", "v=DMARC1; p=none; rua=mailto:x@example.org", health.StatusWarn, "refuses nothing"},
|
||||
{"p=quarantine", "v=DMARC1; p=quarantine", health.StatusOK, "p=quarantine"},
|
||||
{"p=reject", ServerMailDMARC, health.StatusOK, "p=reject"},
|
||||
} {
|
||||
f := &fakeResolver{txt: map[string][]string{}}
|
||||
if c.record != "" {
|
||||
f.txt["_dmarc.mail.example.org"] = []string{c.record}
|
||||
}
|
||||
m := newTestChecker(f).ServerMail(serverMailQuery(), false)
|
||||
if m.DMARC.Status != c.want || !strings.Contains(m.DMARC.Detail, c.says) {
|
||||
t.Errorf("%s: %s (%s), want %s saying %q", c.name, m.DMARC.Status, m.DMARC.Detail, c.want, c.says)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user