My objective is to block certain domains in bind WITHOUT first looking up their address (this is a small caching bind dns server).
Currently my configuration will forward the request for badhost.com and get the IP address (I can see this in wireshark), and then it will overwrite that response with NXDOMAIN.
bind.log:
client 192.168.1.1#46107 (badhost.com): rpz QNAME NXDOMAIN rewrite badhost.com via badhost.com.rpz
But there is no point in fetching the IP address and it delays the query. I just want it to quickly return NXDOMAIN for the blocked domains without doing the forwarding.
configuration:
options {
response-policy { zone "rpz" policy nxdomain; };
cleaning-interval 360;
forward only;
forwarders { x.x.x.x; y.y.y.y; };
allow-recursion { any; };
allow-query { any; };
allow-query-cache { any; };
}
zone "rpz" {
type master;
file "/etc/bind/rpz.zone";
};
zone "0.0.127.in-addr.arpa" {
type master;
notify no;
file "pz/127.0.0";
};
zone "1.168.192.in-addr.arpa" {
type master;
notify no;
file "pz/192.168.1";
};
zone "lan" {
type master;
notify no;
file "pz/lan";
};
rpz.zone
$TTL 604800
@ IN SOA ns1.example.local. info.example.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
@ IN NS local.
$INCLUDE rpz.blacklist.db
rpz.blacklist.db
badhost.com CNAME .
There will be thousands of entries, so I do not want a zone pointing to the same file (0.0.0.0 or 127.0.0.1) for each one.