SPF rejects mail on unsupported SPF RR type
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | postfix-policyd-spf-perl |
Medium
|
Scott Kitterman | ||
| | mail-spf-perl (Ubuntu) |
Undecided
|
Unassigned | ||
| | postfix-policyd-spf-perl (Ubuntu) |
Medium
|
Scott Kitterman | ||
Bug Description
Binary package hint: libmail-
Not all DNS servers support the new SPF RR type and reply unsupported or SERVFAIL to queries for it. libmail-
Noted here that some email servers will incorrectly reject mail if unsupported:
http://
Example rejection:
Nov 9 15:26:11 hyolee postfix/
A possible workaround is editing /usr/share/
$packet-
This produces a SPF: none result:
Nov 9 16:52:45 hyolee postfix/
Something else is happening because the email is still rejected due to a policyd timeout:
Nov 9 16:53:54 hyolee postfix/
Nov 9 16:53:54 hyolee postfix/
If I comment out the entire SPF lookup section:
# Query for SPF type RRs first:
# try {
# my $packet = $self->
# push(
# @records,
# $self->
# $packet, 'SPF', \@versions, $scope, $domain)
# );
# }
# catch Mail::SPF:
# push(@dns_errors, shift);
# };
That sending host now works:
Nov 9 17:41:36 hyolee postfix/
Nov 9 17:41:36 hyolee postfix/
Nov 9 17:41:36 hyolee postfix/
...
Related branches
| description: | updated |
| description: | updated |
| description: | updated |
| description: | updated |
| Steven McCoy (fnjordy) wrote : | #2 |
I have 2.002-0ubuntu2 on one host, and a backported 2.004-0ubuntu2~
| Changed in mail-spf-perl: | |
| assignee: | nobody → kitterman |
| status: | Incomplete → Triaged |
| assignee: | kitterman → nobody |
| Changed in postfix-policyd-spf-perl: | |
| assignee: | nobody → kitterman |
| status: | New → Triaged |
| Julian Mehnle (jmehnle) wrote : | #3 |
Hi, I am the upstream author of Mail::SPF. Two things first:
1. The policyd timeout is indeed a postfix-
2. The SERVFAIL DNS status code (RCODE 2) does NOT mean "unsupported operation". According to RFC 1035, it means "The name server was unable to process this query due to a problem with the name server". There is another status code, "Not Implemented" (RCODE 4), that means "The name server does not support the requested kind of query". Please do not conflate the two. Thus, interpreting SERVFAIL as "not found" is inappropriate because it could just as well mean "out of memory" or "out of database connections, try again later".
Now on to the Mail::SPF issue. If you look at <http://
However, concerning the handling of the SPF RR type, understand that while Mail::SPF queries for both the SPF and TXT RR types (in this order), only the SPF-type lookup failing isn't enough for TempError to be returned. If the SPF-type lookup fails but the (following) TXT-type lookup succeeds, Mail::SPF silently uses the TXT response to calculate an SPF result. Only if /both/ the SPF- and TXT-type lookups fail does it return an error (based on the result of the SPF-type lookup, which was the first performed).
| Scott Kitterman (kitterman) wrote : | #4 |
What does postconf smtpd_policy_
That defaults to 100s and according to your logs, it's returning sooner than that. A totally braindead DNS server can suck up up to 80s (20s SPF HELO lookup + 20s TXT HELO lookup + 20s Mail From SPF lookup + 20s Mail From TXT lookup).
| Changed in postfix-policyd-spf-perl: | |
| status: | Triaged → Incomplete |
| Julian Mehnle (jmehnle) wrote : | #5 |
Right. The default timeout for a DNS query via UDP effectively is 20 seconds (4*5s as per Net::DNS:
| Scott Kitterman (kitterman) wrote : | #6 |
I've discussed this with the Mail::SPF developer (and Debian maintainer) and he declines to disable type SPF queries. I don't think Ubuntu should carry a permanent diff for this, so I'm won't fixing that aspect of the issue.
| Changed in mail-spf-perl: | |
| status: | Triaged → Won't Fix |
| Scott Kitterman (kitterman) wrote : | #7 |
80 seconds is a long time to wait for a final answer. A change to cut the DNS timeouts in half (so that 40 seconds is the maximum) has been committed to the upstream SVN repository. Once that's tested, it will get released, uploaded to Debian, and then sync'ed for Hardy.
| Changed in postfix-policyd-spf-perl: | |
| importance: | Undecided → Medium |
| status: | Incomplete → Fix Committed |
| Scott Kitterman (kitterman) wrote : | #8 |
The new version is uploaded to Debian and sync has been requested. See Bug #176726 for status on the sync.
| Scott Kitterman (kitterman) wrote : | #9 |
2.005 drops the timeouts so that these kinds of problems should be less common. If you want to avoid Type SPF queries entirely you'll have to switch to the Python SPF policy server.
| Changed in postfix-policyd-spf-perl: | |
| status: | Fix Committed → Fix Released |
| Changed in postfix-policyd-spf-perl: | |
| status: | New → Fix Released |
| Scott Kitterman (kitterman) wrote : | #10 |
The option to disable type SPF queries was added in mail-spf-perl 2.006.
| Changed in mail-spf-perl (Ubuntu): | |
| status: | Won't Fix → Fix Released |
| Scott Kitterman (kitterman) wrote : | #11 |
Reopening upstream now that we can fix this more properly.
| Changed in postfix-policyd-spf-perl: | |
| importance: | Undecided → Medium |
| status: | Fix Released → Triaged |
| Scott Kitterman (kitterman) wrote : | #12 |
Fix committed to Trunk, rev 63. Will be in the next release.
| Changed in postfix-policyd-spf-perl: | |
| assignee: | nobody → Scott Kitterman (kitterman) |
| status: | Triaged → Fix Committed |
| Scott Kitterman (kitterman) wrote : | #13 |
Released with version 2.008.
| Changed in postfix-policyd-spf-perl: | |
| status: | Fix Committed → Fix Released |


Which version of postfix- policyd- spf-perl are you using? I suspect this belongs to mail-spf-perl as all the packaged versions of the Postfix policy server use that library and not mail-spf- query-perl.