SPF.Guru

Fixing SPF PermError and the DNS lookup limit

PermError means a receiving server could not evaluate your SPF record at all. It is not a soft warning: SPF contributes nothing to DMARC while it is happening, and you will not be told.

Why PermError happens

RFC 7208 allows at most ten DNS-resolving terms per evaluation. Each include:, a, mx, ptr, exists and redirect= costs one, and the count carries down into every nested include. Cross the limit and evaluation stops and returns permerror.

Two other things cause it, and they are easy to miss:

Common causes

A record like this is already close, and looks perfectly reasonable:

v=spf1 include:spf.marketing.com include:_spf.crm.com
       include:mail.security.com include:_spf.support.com
       include:email.gateway.com -all

Fix it properly first, if you can

Before reaching for any tool, two changes solve this permanently for a lot of domains:

SPF Guru exists for the cases where neither is possible, usually because a vendor insists on sending as your root domain.

What SPF Guru does

One term goes at the front, followed by the all your record already ended with:

v=spf1 exists:i.%{ir}._d.%{d}.my.spf.guru ~all <your existing mechanisms>

It uses SPF macros: %{ir} expands to the connecting IP address reversed, and %{d} to your domain. A receiving server resolves that one name. If the sending IP is authorised, SPF Guru answers and the mechanism matches, so evaluation stops with a pass. If it is not, there is no answer, the mechanism does not match, and the next term is your own all. Either way, one lookup, and the rest of your record is never walked by the receiver.

Everything after the all stays. Those mechanisms are the input SPF Guru reads when it answers. A record stripped down to just the guru include authorises nothing at all.

What other checkers will say

Your record still contains every original mechanism, so any tool that counts terms without evaluating them will still report you as over the limit. That is expected and it is not a fault in either tool. The number that decides whether your mail authenticates is what a receiving server actually performs, and that is one.

Trade-offs worth knowing

Check where you stand

Enter your domain to see what your record costs today. If it is already within the limit, you will be told that and you can leave it alone. To test whether a specific server passes, use the SPF checker.

Support

Raise an issue at github.com/smck83/spf.guru/issues or email helpme@spf.guru. Volunteer, best-effort, no guaranteed response time.