I have set up a BIND 9 server and configured cryptographic keys in order to allow updates from a client. Now in my named.conf
, I have set the following:
allow-update { key dns1.example.org.; };
This works and I can perform updates (add, delete zone records) from my client (nsupdate
command).
I am wondering if I can combine it with an ACL. Basically I want that the client needs the correct key, but also must come from a certain subnet or IP address. Can I do this somehow? I failed to find anything about that scenario in the docs.
Alcs are first match. If you exclude the addresses you want, you can reject all non matching addresses using any; then check that the key matches.
Ugly answer #1
You can do this only if you are willing to be creative, ugly and brute altogether.
To allow updates only from 1.2.3.0/24 having key dns1.example.com.
How to do that bitwise math:
I did not actually try, but should work.
If you have multiple allowed subnets, I wish you a good luck.
For the purpose of this answer, I'm glad IPv6 isn't widely deployed yet. :)
Ugly answer #2
Setup separate stealth (i.e. not listed as NS) primary master nameserver, in it's firewall rules allow packets only from "allowed" subnet and from it's slave nameservers. On this stealth, allow updates with the key alone. Configure slaves to get zone data via AXFR/IXFR and NOTIFY. And don't forget to disable update forwarding on the slaves.
Once you did it either ugly way, keep in mind that anybody from anywhere can spoof source address in that UDP DNS update packet, which makes all those efforts completely pointless. (Though you can disable UDP to make the efforts slightly less pointless).
I know you can define a match_list but I am not sure if you can combine the key and match list.
for example:
I have not tried this but according to my understanding the definitions are:
and therefore you can do things like
and therefore zones transfers are now restricted to those that have a key (beyond the match list).