domainaware / parsedmarc

A Python package and CLI for parsing aggregate and forensic DMARC reports
https://domainaware.github.io/parsedmarc/
Apache License 2.0
1.01k stars 219 forks source link

Add Support for DNS-over-HTTPS (DOH) #291

Open leonardo0014 opened 2 years ago

leonardo0014 commented 2 years ago

The longer I work with the script, the more small optimizations I can think of. One would be very helpful for me. My Server has no direct Internet access and I can only access the Internet via WEB Proxy. I would appreciate it if I could use DNS-over-HTTPS via proxy instead of direct DNS lookup to get the reverse DNS lookups. From what I can tell you are using Python's standard DNS libraries. According to the manual, these should already support DOH.

I'll try it myself and if my adaptation succeeds I'll send you the DIFF.

I would like to say thank you for reading

imirkin commented 1 year ago

Are you sure that it doesn't already work? I think just having

[general]
nameservers=https://cloudflare-dns.com/dns-query

should do the trick based on my read of the code. (Completely untested though.)

The resolver logic appears to check if it's an inet address or not, and uses https if it's not:

https://github.com/rthalley/dnspython/blob/e8194e185c10fa1b7cd021c3b2f46501167fd688/dns/resolver.py#L1206