blocky
blocky copied to clipboard
Control the reverse lookup responses (PTR records) for statically defined domain name mappings in the blocky config
I currently have a bunch of domain name records defined statically under the customDNS.mapping
section of the blocky config file. I have multiple name records mapping to the same IP, which is quite typical when you run some sort of a reverse proxy (eg. nginx in my case) which hosts all these domain/subdomains, and will redirect the traffic to the corresponding backends for the service.
customDNS:
customTTL: 1h
filterUnmappedTypes: true
mapping:
foo1.mydomain.local: 10.1.1.8
foo2.mydomain.local: 10.1.1.8
foo3.mydomain.local: 10.1.1.8
foo4.mydomain.local: 10.1.1.8
When I query for the PTR records (i.e. reverse lookup) on the host's IP (10.1.1.8
in the above example), I get all of these name records in the result.
$ dig -x 10.1.1.8
...
...
;; ANSWER SECTION:
8.1.1.10.in-addr.arpa. 3600 IN PTR foo3.mydomain.local.
8.1.1.10.in-addr.arpa. 3600 IN PTR foo1.mydomain.local.
8.1.1.10.in-addr.arpa. 3600 IN PTR foo4.mydomain.local.
8.1.1.10.in-addr.arpa. 3600 IN PTR foo2.mydomain.local.
...
...
The order of these records in the response are also non-deterministic. In cases where I have services performing such reverse lookups, it leads to odd domain names being printed irrelevant to that service.
It would be great if the blocky config provides better control of the PTR query responses, even if it means to define custom mappings controlling which results are returned.
Something along the lines of the following which only returns foo1 and foo4 in the response.
customDNS:
customTTL: 1h
filterUnmappedTypes: true
mapping:
foo1.mydomain.local: 10.1.1.8
foo2.mydomain.local: 10.1.1.8
foo3.mydomain.local: 10.1.1.8
foo4.mydomain.local: 10.1.1.8
reverseMapping:
10.1.1.8: foo1.mydomain.local
10.1.1.8: foo4.mydomain.local