folbricht / routedns

DNS stub resolver, proxy and router with support for DoT, DoH, DoQ, and DTLS
BSD 3-Clause "New" or "Revised" License
441 stars 62 forks source link

Make it possible to filter on authoritative and additional sections as well #360

Closed cbuijs closed 7 months ago

cbuijs commented 7 months ago

For all the filtering groups, either the question or the answer section is used.

It might be usable to include the possibility to also filter based on the authoritative and additional section as well (as an option, default should be false)

Thinking behind this is, that sometimes their are indicators that something needs to be filtered or needs to be act upon.

For example:

kdig @zero.dns0.eu +https=/ 0-07.ru
;; TLS session (TLS1.3)-(ECDHE-X25519)-(ECDSA-SECP256R1-SHA256)-(AES-128-GCM)
;; HTTP session (HTTP/2-POST)-(zero.dns0.eu/)-(status: 200)
;; ->>HEADER<<- opcode: QUERY; status: NXDOMAIN; id: 0
;; Flags: qr rd ra; QUERY: 1; ANSWER: 0; AUTHORITY: 1; ADDITIONAL: 0

;; QUESTION SECTION:
;; 0-07.ru.                 IN  A

;; AUTHORITY SECTION:
0-07.ru.                300 IN  SOA negative-caching.dns0.eu. hostmaster.0-07.ru. 0 1200 300 1209600 300

;; Received 96 B
;; Time 2023-11-17 10:24:58 CET
;; From 188.172.219.65@443(TCP) in 123.7 ms

In above example, the authority section contains negative-caching.dns0.eu which indicate that the domain is malicious, and responding with a static-responder access could be rerouted to a walled-garden or notification page.

folbricht commented 7 months ago

This kind of works already today. It does check the authority and extra sections, but only considers some type of records, SOA not being one of them. I added SOA support on the issue-360 branch if you want to try it out.

cbuijs commented 7 months ago

Works as expected. It only filters on the first field which is fine.

Merge ;-)

folbricht commented 7 months ago

Merged in https://github.com/folbricht/routedns/pull/361

cbuijs commented 7 months ago

Looking at 360, it is still "behind master". When I build master, the SOA is not taken into account?