I've done more digging based on a few things and found the cause, but don't have a solution as the change by exim is fairly major, so they'd need to offer a fix (assuming my findings are accurate)
If an spf TXT record has "ip4:1.1.2.3.4" the check works correctly, and the value can "pass", since no A/MX lookups are done if the IP is explicitly set.
However, if the TXT record does not have an explicit IP, and relies on something like
for example, the new lookup code they've added seems to completely fail. As previously guessed, the suspect "support for IPv6 SPF lookups" change theory is supported by the changes I'm seeing in exim-4.93/src/lookups/spf.c, from the 4.92.3 version of the same file (might be elsewhere, but that's a ballpark guess). There are several reference to HAVE_IPV6, which makes sense.. and we do include HAVE_IPV6=yes by default.... so the new changes that were added are included in this build.
I did add "-DSPF" to the CFLAGS, just in case it applies here, as I found some other guide making reference to it ... but I couldn't find any reference to, but worth a shot anyway.
So as far as I can tell, this is new exim bug, introduced in 4.93, with the addition of the IPv6 SPF check support.. but the result is that the "a mx" type lookups simply don't do anything. Any TXT spf records that include the ip4:1.2.3.4 style checks should work fine.
I realized there are plenty of debug points in that code, so ran exim in debug mode:
Code:
exim -d -bd -oP /var/run/exim.pid
and the SPF debug code showed itself failing the A/MX lookups, when they definitely should not have been bee failing (I've swapped the domain in question and sending IP out here, for privacy reasons, but the A and MX records definitely resolve just fine). Key items have #commants on the right:
Code:
...
7234 check spf = fail #this is the condition check which triggers the failure, below
7234 spf_process
spf_dns.c:54 Debug: DNS[cache] lookup: testdomain.ca SPF (99)
spf_dns.c:54 Debug: DNS[exim] lookup: testdomain.ca SPF (99)
7234 SPF_dns_exim_lookup
7234 DNS lookup of testdomain.ca (SPF) gave NO_DATA
7234 returning DNS_NODATA
7234 faking res_search(SPF) response length as 65535
7234 writing neg-cache entry for testdomain.ca-SPF-880041, ttl 86400
spf_dns.c:66 Debug: DNS[exim] found record
spf_dns.c:69 Debug: DOMAIN: (null) TYPE: ANY (255)
spf_dns.c:76 Debug: TTL: 86400 RR found: 0 herrno: 1 source: exim
spf_dns.c:66 Debug: DNS[cache] found record
spf_dns.c:69 Debug: DOMAIN: (null) TYPE: ANY (255)
spf_dns.c:76 Debug: TTL: 86400 RR found: 0 herrno: 1 source: exim
spf_server.c:356 Debug: get_record(testdomain.ca): HOST_NOT_FOUND
spf_dns.c:54 Debug: DNS[cache] lookup: testdomain.ca TXT (16)
spf_dns.c:54 Debug: DNS[exim] lookup: testdomain.ca TXT (16)
7234 SPF_dns_exim_lookup
7234 DNS lookup of testdomain.ca (TXT) succeeded
spf_dns.c:66 Debug: DNS[exim] found record
spf_dns.c:69 Debug: DOMAIN: testdomain.ca TYPE: TXT (16)
spf_dns.c:76 Debug: TTL: 100 RR found: 1 herrno: 0 source: exim
spf_dns.c:94 Debug: - TXT: v=spf1 a mx -all #this is correct, as set for testing
spf_dns.c:66 Debug: DNS[cache] found record
spf_dns.c:69 Debug: DOMAIN: testdomain.ca TYPE: TXT (16)
spf_dns.c:76 Debug: TTL: 100 RR found: 1 herrno: 0 source: exim
spf_dns.c:94 Debug: - TXT: v=spf1 a mx -all
spf_server.c:400 Debug: get_record(testdomain.ca): NETDB_SUCCESS
spf_server.c:441 Debug: found SPF record: v=spf1 a mx -all
spf_compile.c:1210 Debug: Compiling record v=spf1 a mx -all
spf_compile.c:1314 Debug: Name starts at a mx -all
spf_compile.c:1408 Debug: Adding mechanism type 1
spf_compile.c:847 Debug: SPF_c_mech_add: type=1, value= mx -all
spf_compile.c:1314 Debug: Name starts at mx -all
spf_compile.c:1408 Debug: Adding mechanism type 2
spf_compile.c:847 Debug: SPF_c_mech_add: type=2, value= -all
spf_compile.c:1314 Debug: Name starts at all
spf_compile.c:1408 Debug: Adding mechanism type 8
spf_compile.c:847 Debug: SPF_c_mech_add: type=8, value=
spf_dns.c:54 Debug: DNS[cache] lookup: testdomain.ca A (1)
spf_dns.c:54 Debug: DNS[exim] lookup: testdomain.ca A (1)
7234 SPF_dns_exim_lookup
7234 DNS lookup of testdomain.ca (A) succeeded #this is a good thing, I assume.
spf_dns.c:66 Debug: DNS[exim] found record
spf_dns.c:69 Debug: DOMAIN: (null) TYPE: ANY (255) #DOMAIN==NULL? Might be correct.. might be wrong.
spf_dns.c:76 Debug: TTL: 86400 RR found: 0 herrno: 1 source: exim
spf_dns.c:66 Debug: DNS[cache] found record
spf_dns.c:69 Debug: DOMAIN: (null) TYPE: ANY (255)
spf_dns.c:76 Debug: TTL: 86400 RR found: 0 herrno: 1 source: exim
spf_interpret.c:783 Debug: found 0 A records for testdomain.ca (herrno: 1) #FALSE: there are definitely A records
spf_dns.c:54 Debug: DNS[cache] lookup: testdomain.ca MX (15)
spf_dns.c:54 Debug: DNS[exim] lookup: testdomain.ca MX (15)
7234 SPF_dns_exim_lookup
7234 DNS lookup of testdomain.ca (MX) succeeded
spf_dns.c:66 Debug: DNS[exim] found record
spf_dns.c:69 Debug: DOMAIN: (null) TYPE: ANY (255)
spf_dns.c:76 Debug: TTL: 86400 RR found: 0 herrno: 1 source: exim
spf_dns.c:66 Debug: DNS[cache] found record
spf_dns.c:69 Debug: DOMAIN: (null) TYPE: ANY (255)
spf_dns.c:76 Debug: TTL: 86400 RR found: 0 herrno: 1 source: exim
spf_interpret.c:824 Debug: found 0 MX records for testdomain.ca (herrno: 1)
7234 SPF result is fail (3)
7234 message: SPF: $sender_host_address is not allowed to send mail from $sender_address_domain: $spf_smtp_comment
7234 check logwrite = SPFCheck: $sender_host_address is not allowed to send mail from $sender_address_domain: $spf_smtp_comment
7234 = SPFCheck: 1.2.3.4 is not allowed to send mail from testdomain.ca: Please see http://www.open-spf.org/Why?id=john%40testdomain.ca&ip=1.2.3.4&receiver=server.testdomain.ca : Reason: mechanism
Anyway, this isn't a solution, just tracking down the cause of the SPF failure to be somewhere in there.
Hopefully this debug output will help the exim devs track it down.
For the time being, please stick with 4.92.3, as is set in the versions.txt.
@ditto: To clarify, in you need SpamAssassin in order for ESF to work.
The ESF has it's own SPF checks if you want to fully block based on an spf=fail, regardless of a summed score that SpamAssassin provides.
SPF checks can still be done by SpamAssassin, without ESF turned on, but gets scored instead of a hard block.