Score:0

BIND and RD flag, why does it bypass RPZ?

gd flag

Im running BIND for testing, and here is a part my RPZ:

example.com         IN CNAME .          ; local block against example.com
*.example.com           IN CNAME .          ; local block against example.com

When I query example.com it is blocked successfully:

dig @127.0.0.1 example.com

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 28108
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;example.com.           IN  A

;; ADDITIONAL SECTION:
rpz.local.      1   IN  SOA localhost. need.to.know.only. 201702121 60 60 432000 60

but with no recursion, it goes through:

dig @127.0.0.1 example.com +norecurse

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59121
;; flags: qr ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;example.com.           IN  A

;; ANSWER SECTION:
example.com.        17130   IN  A   93.184.216.34

I understand no recursion serves what is in the cache, but why does not it apply the RPZ to block the domain?

Also, why does the request even resolve? should it not block the DNS query at the beginning since the domain match the RPZ and returns as fast as possible?

I can see that PowerDNS optimized the thing to avoid resolution of the query if needed:

Doing so would require delaying evaluation of RPZ policies until the whole resolution process has been completed, which would mean that queries might have been sent to a malicious nameserver already, in addition to performance issues.

Im really curious to know the reason and if there is a way to block the query before the resolution.

Patrick Mevzek avatar
cn flag
For filtering needs you may want to look at `dnsdist` that you can put in front of `bind` and it will allow you finer control on queries. Just a thought.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.