Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMARC reports from some mail servers report failures #176

Closed
rdelaage opened this issue Jun 14, 2024 · 4 comments
Closed

DMARC reports from some mail servers report failures #176

rdelaage opened this issue Jun 14, 2024 · 4 comments

Comments

@rdelaage
Copy link

It seems to be DKIM related failures. The dkim reports are sent from postmaster@<maildomain> but there is no published DKIM public key in the DNS records generated by mox resulting in a DKIM signature validation fail.

Here is a copy of a DMARC report sent by google

{
	"ID": 7,
	"Domain": "delaage.fr",
	"FromDomain": "google.com",
	"Version": "",
	"ReportMetadata": {
		"OrgName": "google.com",
		"Email": "noreply-dmarc-support@google.com",
		"ExtraContactInfo": "https://support.google.com/a/answer/2466580",
		"ReportID": "11688145333743308772",
		"DateRange": {
			"Begin": 1718150400,
			"End": 1718236799
		},
		"Errors": null
	},
	"PolicyPublished": {
		"Domain": "delaage.fr",
		"ADKIM": "r",
		"ASPF": "r",
		"Policy": "reject",
		"SubdomainPolicy": "reject",
		"Percentage": 100,
		"ReportingOptions": ""
	},
	"Records": [
		{
			"Row": {
				"SourceIP": "2001:1600:13:101::cd7",
				"Count": 2,
				"PolicyEvaluated": {
					"Disposition": "none",
					"DKIM": "pass",
					"SPF": "pass",
					"Reasons": null
				}
			},
			"Identifiers": {
				"EnvelopeTo": "",
				"EnvelopeFrom": "",
				"HeaderFrom": "mail.delaage.fr"
			},
			"AuthResults": {
				"DKIM": [
					{
						"Domain": "mail.delaage.fr",
						"Selector": "",
						"Result": "fail",
						"HumanResult": ""
					},
					{
						"Domain": "delaage.fr",
						"Selector": "2024b",
						"Result": "pass",
						"HumanResult": ""
					}
				],
				"SPF": [
					{
						"Domain": "mail.delaage.fr",
						"Scope": "",
						"Result": "pass"
					}
				]
			}
		}
	]
}
@mjl-
Copy link
Owner

mjl- commented Jun 14, 2024 via email

@rdelaage
Copy link
Author

No, mail.delaage.fr is the domain name of my mail server (MX record) but is not in the configured domain. This domain is used in the From header of the DMARC reports sent to Google (I never sent messages to Google expect the automatic DMARC reports, so the rejected DKIM signatures are in the DMARC reports using the postmaster address in the From header)

@RobSlgm
Copy link

RobSlgm commented Jun 20, 2024

Same here.

Google

On the host domain the DMARC reports from google.com show mail.example.com in SMTP from and Header from.

A row with my server SourceIP shows DKIM domain mail.example.comwith fail and a domain example.com with pass, SFP is mail.example.com pass.
The same report show also a Row with a SourceIP from a Google IP with SPF result *fail, using the very same mail.example.com.

The result is None in all cases.

Enterprise Outlook

From "Enterprise Outlook" DMARC reports to the host domain show with Header and EnvelopeFrom mail.example.com

"AuthResults": {
				"DKIM": [
					{
						"Domain": "",
						"Selector": "",
						"Result": "fail",
						"HumanResult": ""
					},
					{
						"Domain": "example.com",
						"Selector": "2024b",
						"Result": "fail",
						"HumanResult": ""
					}
				],
				"SPF": [
					{
						"Domain": "mail.example.com",
						"Scope": "mfrom",
						"Result": "pass"
					}
				]
			}

The behavior isn't consistent, in some reports the DKIM on example.com shows pass.

Amazon SES

And AMAZON-SES is fully happy (DKIM and SPF pass), Envelope/Header From are mail.example.com and DKIM domain example.com

eMail domains

The email domains are all green (Counters for DKIM or SPF fails are zero). The HeaderFrom is example.org, and all DKIM/SPF results refer to example.org. EnvelopeFrom is empty.

Observation

In the admin UI on the page with .../dnscheck the SPF records are show as follows:

Domain TXT record: v=spf1 mx ~all
Host TXT record: v=spf1 a -all

Ensure DNS TXT records like the following exists:

	example.com. TXT "v=spf1 ip6:1111:222:333:444::1 ip4:11.22.33.44 -all"
	mail.example.com. TXT "v=spf1 a -all"

where as on the page with .../dnsrecords this appears:

mail.example.com.               TXT "v=spf1 a -all"
example.com.                    TXT "v=spf1 mx ~all"

The current setup uses the a-record reference. Is there a benefit to explicitly list the IP's? Or why are to different settings shown at all?

mjl- added a commit that referenced this issue Jun 28, 2024
…output/pages

before, the suggested records would show "v=spf1 mx ~all", while the dnscheck
page would suggest "v=spf1 ip4:... ip6:... -all".

the two places now show the same record: explicitly listing the configured ip's
(so the common case of a valid message is fast and doesn't require lookups of
mx hosts and their addresses), but still including "mx" (may prevent issues
while migrating to new ips in the future and doesn't hurt for legit messages),
and "~all" (for compatibility with some old systems that don't look at
dkim/dmarc when they evaluate spf and reach "-all")

based on #176 created by rdelaage, with record mismatch spotted by RobSlgm,
thanks!
@mjl-
Copy link
Owner

mjl- commented Jun 28, 2024

@RobSlgm thanks for reporting that spf1 mismatch. the last commit should now cause the same record to be suggested. always including the configured ip's and keeping "mx" (including the ip prevents further dns lookups for legimate messages which is good for performance, keeping the mx records adds some resilience to future ip changes), and using "~all" (as explained on the dnsrecords page).

i've also received some dmarc reports from google/gmail with a "Domain" set to the hostname. i suspect it is an artefact of them not recognizing the ed25519 algorithm. the overall dkim result is still pass, and the dmarc result is positive too.

i'll close this issue now. feel free to reopen if there's more information or more work to be done.

thanks for reporting and providing details!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants