Bv9ARM.ch07.html revision 975ff35d8501bd2ef5f9541c4dac1157efc1609d
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe - Copyright (C) 2000-2016 Internet Systems Consortium, Inc. ("ISC")
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe - This Source Code Form is subject to the terms of the Mozilla Public
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe - License, v. 2.0. If a copy of the MPL was not distributed with this
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe - file, You can obtain one at http://mozilla.org/MPL/2.0/.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov<title>Chapter�7.�BIND 9 Security Considerations</title>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov<link rel="home" href="Bv9ARM.html" title="BIND 9 Administrator Reference Manual">
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov<link rel="up" href="Bv9ARM.html" title="BIND 9 Administrator Reference Manual">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<link rel="prev" href="Bv9ARM.ch06.html" title="Chapter�6.�BIND 9 Configuration Reference">
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov<link rel="next" href="Bv9ARM.ch08.html" title="Chapter�8.�Troubleshooting">
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<tr><th colspan="3" align="center">Chapter�7.�<acronym class="acronym">BIND</acronym> 9 Security Considerations</th></tr>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<a accesskey="p" href="Bv9ARM.ch06.html">Prev</a>�</td>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<td width="20%" align="right">�<a accesskey="n" href="Bv9ARM.ch08.html">Next</a>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<div class="titlepage"><div><div><h1 class="title">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<a name="Bv9ARM.ch07"></a>Chapter�7.�<acronym class="acronym">BIND</acronym> 9 Security Considerations</h1></div></div></div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<dt><span class="section"><a href="Bv9ARM.ch07.html#Access_Control_Lists">Access Control Lists</a></span></dt>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<dt><span class="section"><a href="Bv9ARM.ch07.html#chroot_and_setuid"><span class="command"><strong>Chroot</strong></span> and <span class="command"><strong>Setuid</strong></span></a></span></dt>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<dt><span class="section"><a href="Bv9ARM.ch07.html#chroot">The <span class="command"><strong>chroot</strong></span> Environment</a></span></dt>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<dt><span class="section"><a href="Bv9ARM.ch07.html#setuid">Using the <span class="command"><strong>setuid</strong></span> Function</a></span></dt>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<dt><span class="section"><a href="Bv9ARM.ch07.html#dynamic_update_security">Dynamic Update Security</a></span></dt>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<div class="titlepage"><div><div><h2 class="title" style="clear: both">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<a name="Access_Control_Lists"></a>Access Control Lists</h2></div></div></div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Access Control Lists (ACLs) are address match lists that
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe you can set up and nickname for future use in
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <span class="command"><strong>allow-notify</strong></span>, <span class="command"><strong>allow-query</strong></span>,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <span class="command"><strong>allow-query-on</strong></span>, <span class="command"><strong>allow-recursion</strong></span>,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <span class="command"><strong>blackhole</strong></span>, <span class="command"><strong>allow-transfer</strong></span>,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <span class="command"><strong>match-clients</strong></span>, etc.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Using ACLs allows you to have finer control over who can access
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe your name server, without cluttering up your config files with huge
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe lists of IP addresses.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe It is a <span class="emphasis"><em>good idea</em></span> to use ACLs, and to
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe control access to your server. Limiting access to your server by
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe outside parties can help prevent spoofing and denial of service
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe (DoS) attacks against your server.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ACLs match clients on the basis of up to three characteristics:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe 1) The client's IP address; 2) the TSIG or SIG(0) key that was
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe used to sign the request, if any; and 3) an address prefix
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe encoded in an EDNS Client Subnet option, if any.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Here is an example of ACLs based on client addresses:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe// Set up an ACL named "bogusnets" that will block
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe// RFC1918 space and some reserved space, which is
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe// commonly used in spoofing attacks.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweacl bogusnets {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe// Set up an ACL called our-nets. Replace this with the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe// real IP numbers.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov allow-query { our-nets; };
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe allow-recursion { our-nets; };
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov blackhole { bogusnets; };
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov type master;
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov allow-query { any; };
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe This allows authoritative queries for "example.com" from any
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov address, but recursive queries only from the networks specified
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe in "our-nets", and no queries at all from the networks
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov specified in "bogusnets".
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe In addition to network addresses and prefixes, which are
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov matched against the source address of the DNS request, ACLs
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov may include <code class="option">key</code> elements, which specify the
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov name of a TSIG or SIG(0) key, or <code class="option">ecs</code>
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov elements, which specify a network prefix but are only matched
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if that prefix matches an EDNS client subnet option included
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe in the request.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov The EDNS Client Subnet (ECS) option is used by a recursive
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov resolver to inform an authoritative name server of the network
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov address block from which the original query was received, enabling
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov authoritative servers to give different answers to the same
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov resolver for different resolver clients. An ACL containing
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov an element of the form
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <span class="command"><strong>ecs <em class="replaceable"><code>prefix</code></em></strong></span>
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov will match if a request arrives in containing an ECS option
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe encoding an address within that prefix. If the request has no
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov ECS option, then "ecs" elements are simply ignored. Addresses
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov in ACLs that are not prefixed with "ecs" are matched only
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov against the source address.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe (Note: The authoritative ECS implementation in
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov <span class="command"><strong>named</strong></span> is based on an early version of the
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov specification, and is known to have incompatibilities with
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov other implementations. It is also inefficient, requiring
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov a separate view for each client subnet to be sent different
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe answers, and it is unable to correct for overlapping subnets in
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov the configuration. It can be used for testing purposes, but is
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe not recommended for production use.)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe When <acronym class="acronym">BIND</acronym> 9 is built with GeoIP support,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ACLs can also be used for geographic access restrictions.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe This is done by specifying an ACL element of the form:
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov <span class="command"><strong>geoip [<span class="optional">db <em class="replaceable"><code>database</code></em></span>] <em class="replaceable"><code>field</code></em> <em class="replaceable"><code>value</code></em></strong></span>
used, otherwise the full description must be used (e.g.
and searches for region (i.e., state or province) can be
<a name="chroot_and_setuid"></a><span class="command"><strong>Chroot</strong></span> and <span class="command"><strong>Setuid</strong></span>
ability to run the daemon as an unprivileged user ( <code class="option">-u</code> <em class="replaceable"><code>user</code></em> ).
We suggest running as an unprivileged user when using the <span class="command"><strong>chroot</strong></span> feature.
Here is an example command line to load <acronym class="acronym">BIND</acronym> in a <span class="command"><strong>chroot</strong></span> sandbox,
<span class="command"><strong>/var/named</strong></span>, and to run <span class="command"><strong>named</strong></span> <span class="command"><strong>setuid</strong></span> to
<a name="chroot"></a>The <span class="command"><strong>chroot</strong></span> Environment</h3></div></div></div>
<span class="emphasis"><em>not</em></span> need to compile <span class="command"><strong>named</strong></span>
<a name="setuid"></a>Using the <span class="command"><strong>setuid</strong></span> Function</h3></div></div></div>