sdgathman / pyspf

Other
52 stars 26 forks source link

Void lookups in ipv6 only #41

Closed pywy18 closed 4 weeks ago

pywy18 commented 1 month ago

Hi all, Found a strange behaviour recently with domain tripkygo.com, which basically has this kind of SPF : "v=spf1 a:1st_ipv4_host.com a:2nd_ipv4_host.com a:3rd_ipv4_host.com ip4:192.162.70.5 ip6:2a00:7ee0:9:1:10:4125:1:1 ~all"

If I test with an ipv4 sender IP, it works fine:

$ python3  /usr/local/lib/python3.10/site-packages/spf.py 192.162.70.5 hello@tripkygo.com whatever                              
/usr/local/lib/python3.10/site-packages/spf.py:131: DeprecationWarning: please use dns.resolver.resolve() instead
  answers = dns.resolver.query(name, qtype, lifetime=timeout)
result: ('pass', 250, 'sender SPF authorized') include:premiumsmtp.dnshostservices.com

But with an IPv6 sending address, I have a void lookup error (which is normal beacause of the 3 host lookups that are answering IPv4 addresses only.)

$ python3  /usr/local/lib/python3.10/site-packages/spf.py 2000::1 hello@tripkygo.com whatever      
/usr/local/lib/python3.10/site-packages/spf.py:131: DeprecationWarning: please use dns.resolver.resolve() instead
  answers = dns.resolver.query(name, qtype, lifetime=timeout)
result: ('permerror', 550, 'SPF Permanent Error: Void lookup limit of 2 exceeded') None

Is this the expected behaviour ? it's kind of strange having void lookups for ipv6 and not for ipv4. Or should we also resolve SPF hosts A records even if the sender is using ipv6 ?

pywy18 commented 4 weeks ago

It's the normal behaviour I guess.