|
![]() |
![]() |
|||
|
Split Views with Bind 9 HowtoMost of what follows comes from trying to help a friend configure Bind to be a bit more secure. So this isn't anywhere near a comprehensive guide. The most important glaring omission is that I'm not covering how to chroot Bind 9 because there are already plenty of good guides. And yes, you should absolutely chroot your Bind service. I'm also not covering the zone files. This is strictly about how to increase the security of your Bind 9 installation using views.OverviewThis is applicable when you're running a caching nameserver for your internal network, but also wish to publically serve (publish) your domain(s) from the same nameserver.
Primer on DNSDNS stands for Domain Name Service, and exists to resolve hostnames to IP addresses (and vice versa, but mostly the former). In the days before the current distributed DNS scheme, one resolved hostnames to IP addresses using a single file - /etc/hosts (that you'd have to edit or download every time a host is added to the Internet). So due to the Internet's own success, this was obviously going to be an impractical thing to do.Instead of a central authority managing a registry of hostname to IP address mappings, the (distributed) DNS system was created to allow for anyone to manage the name records of their own domains using their own nameservers. And since the Internet was designed for robustness in case of partial or intermitten network or host failures, it was decided that every domain should be served by at least two nameservers, typically called "primary" and "secondary" servers (one can optionally have additional tertiary servers).
Caching nameservers as the name suggests, cache hostname lookups. The first time it attempts to resolve a hostname, it has to obtain the info from somewhere else. However, once it has done that lookup, it won't have to ask anyone for future lookups of that hostname until the cached record expires. A caching nameserver is typically configured to automatically expire cached lookups within 48 hours. This is the reason why "there may be a 24-48 hour delay until the DNS record propagates." The important thing to note that this is configurable. A local evil admin may configure the expiration timeframe to be much longer. The result is that the caching nameserver could have stale or incorrect information for longer than 48 hours.
Basically, a recursive query is a query where the nameserver has to ask another nameserver in order to fulfill the lookup request (i.e. any query in which the nameserver isn't authoritative). Disabling recursive queries by default prevents any host on the Internet from excuting queries on the nameserver unless the query is for a published record (e.g. lookups to google.com will fail but lookups to myfancydomain.com will succeed).
Views allow for the presentation of different data to different clients. So in named.conf, internal hosts are allowed to query the caching nameserver to recursively lookup domains for them, but external hosts are only allow to ask about domains that are published via the zone records. Although the example below shows only two views, multiple are allowed. Note that if you have clients that are matched in multiple views, they will only be able to see the info defined in the first view (by order). ConfiguringIn the (commented) example below, we define two custom access control lists (ACLs). "dns_slaves" for slave nameservers to be used in the "external" view. And "lan_hosts" to be used in the "internal" view. Note that each view has to have its own zone files declaration. While they can technically share the same files, it's a good idea to create separate zone files (if you have an internal address space where the hosts are NAT'ed, use internal IP addresses instead of the public IP addresses in the corresponding zones - this prevents packets unnecessarily traveling through your gateway/router/firewall).An important note on the "localnets" keyword. If you have a simple "flat" network, then the network addresses on the nameservers local network interfaces will describe your entire network and can be used instead of the "lan_hosts" ACL. However, if your internal network is routed, then the "lan_hosts" acl should contain the network addresses in use by your network (unless certain segments of your network have no need for name resolution). Example named.conf// This is the primary configuration file for the BIND DNS server named. acl "dns_slaves" {
acl "lan_hosts" {
options { # this section sets the default options
key "rndc-key" {
controls {
view "internal" {
view "external" { |
||||
| Shane Tzen © 2010 | |||||
|
![]() |
||||
| brought to you by the number 1 and the letter X | |||||