Securing Zone Transfers

7.11.1 Problem

You want to secure zone transfers from a name server.

7.11.2 Solution

Use the allow-transfer substatement to specify the addresses of slave name servers allowed to transfer zones. Or, even better, define a TSIG key on the master and slave name servers (see Section 7.10), and specify the TSIG key in the allow-transfer substatement.

allow-transfer can be used as either an options substatement or as a zone substatement. As a zone substatement, allow-transfer applies only to transfers of that zone, and overrides any allow-transfer options substatement for transfers of that zone.

For example, to restrict transfers of the zone foo.example to the slave name server at, you might use this zone statement:

zone "foo.example" {
 type master;
 file "";
 allow-transfer {; };

To restrict transfers of all authoritative zones to slave name servers signing their requests with the TSIG key, you might use the following options statement:

options {
 directory "/var/named";
 allow-transfer { key; };

The keyword key is necessary to distinguish the name of the TSIG key from a named ACL.

Obviously, the slave doesn't need any special configuration to initiate its zone transfers from its own address, but it does require configuration to tell it to sign requests with a particular TSIG key. To tell a slave to sign all zone transfer requests to the name server at with the key, you could add the following server statement to named.conf:

server {

7.11.3 Discussion

For readability's sake, consider defining ACLs with descriptive names even when you're only using IP addresses in your allow-transfer substatements. For example, you could rewrite the zone statement above like so:

acl {; };

zone "foo.example" {
 type master;
 file "";
 allow-transfer {; };

Isn't that better?

You can mix IP addresses and TSIG keys in an allow-transfer substatement, too, in which case the individual elements or logically OR'd together.

Restricting zone transfers to a slave name server by both a TSIG key and the slave's address is more difficult than you might imagine. First, define an ACL that matches all IP addresses except the address of the slave:

acl { !; any; };

Use the negation of this ACL as the first term of the argument to allow-transfer, and the TSIG key as the second:

options {
 directory "/var/named";
 allow-transfer { !; key; };

The negation operator in the first term tells the name server to deny zone transfers from addresses that match the negated ACL,, and the negated ACL matches every address but that of the slave. In other words, the first term denies all addresses but the address of the slave. The next term guarantees that only requests from the slave that are signed with the specified TSIG key are permitted; any other requests from the address of the slave are implicitly denied.

Finally, remember that a BIND name server's default is to allow transfers of any zone, so you'll need to deny all transfers on slave name servers that don't serve any other slaves with:

allow-transfer { none; };

7.11.4 See Also

Section 7.10 for instructions on defining TSIG keys and "Preventing Unauthorized Zone Transfers" in Chapter 11 of DNS and BIND.

Getting Started

Zone Data

BIND Name Server Configuration

Electronic Mail

BIND Name Server Operations

Delegation and Registration


Interoperability and Upgrading

Resolvers and Programming

Logging and Troubleshooting


DNS & BIND Cookbook
DNS & BIND Cookbook
ISBN: 0596004109
EAN: 2147483647
Year: 2005
Pages: 220
Authors: Cricket Liu

Similar book on Amazon © 2008-2020.
If you may any questions please contact us: