Bv9ARM.ch07.html revision 71c66a876ecca77923638d3f94cc0783152b2f03
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - Copyright (C) 2000-2003 Internet Software Consortium.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - Permission to use, copy, modify, and distribute this software for any
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - purpose with or without fee is hereby granted, provided that the above
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - copyright notice and this permission notice appear in all copies.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync - PERFORMANCE OF THIS SOFTWARE.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<!-- $Id: Bv9ARM.ch07.html,v 1.127 2006/06/29 13:03:32 marka Exp $ -->
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<title>Chapter�7.�BIND 9 Security Considerations</title>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<meta name="generator" content="DocBook XSL Stylesheets V1.70.1">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<link rel="start" href="Bv9ARM.html" title="BIND 9 Administrator Reference Manual">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<link rel="up" href="Bv9ARM.html" title="BIND 9 Administrator Reference Manual">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<link rel="prev" href="Bv9ARM.ch06.html" title="Chapter�6.�BIND 9 Configuration Reference">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<link rel="next" href="Bv9ARM.ch08.html" title="Chapter�8.�Troubleshooting">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<tr><th colspan="3" align="center">Chapter�7.�<acronym class="acronym">BIND</acronym> 9 Security Considerations</th></tr>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a accesskey="p" href="Bv9ARM.ch06.html">Prev</a>�</td>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<td width="20%" align="right">�<a accesskey="n" href="Bv9ARM.ch08.html">Next</a>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a name="Bv9ARM.ch07"></a>Chapter�7.�<acronym class="acronym">BIND</acronym> 9 Security Considerations</h2></div></div></div>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<dt><span class="sect1"><a href="Bv9ARM.ch07.html#Access_Control_Lists">Access Control Lists</a></span></dt>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<dt><span class="sect1"><a href="Bv9ARM.ch07.html#id2597956"><span><strong class="command">chroot</strong></span> and <span><strong class="command">setuid</strong></span></a></span></dt>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<dt><span class="sect2"><a href="Bv9ARM.ch07.html#id2598033">The <span><strong class="command">chroot</strong></span> Environment</a></span></dt>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<dt><span class="sect2"><a href="Bv9ARM.ch07.html#id2598092">Using the <span><strong class="command">setuid</strong></span> Function</a></span></dt>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<dt><span class="sect1"><a href="Bv9ARM.ch07.html#dynamic_update_security">Dynamic Update Security</a></span></dt>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<div class="titlepage"><div><div><h2 class="title" style="clear: both">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a name="Access_Control_Lists"></a>Access Control Lists</h2></div></div></div>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Access Control Lists (ACLs), are address match lists that
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync you can set up and nickname for future use in <span><strong class="command">allow-notify</strong></span>,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <span><strong class="command">allow-query</strong></span>, <span><strong class="command">allow-recursion</strong></span>,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <span><strong class="command">blackhole</strong></span>, <span><strong class="command">allow-transfer</strong></span>,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Using ACLs allows you to have finer control over who can access
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync your name server, without cluttering up your config files with huge
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync lists of IP addresses.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync It is a <span class="emphasis"><em>good idea</em></span> to use ACLs, and to
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync control access to your server. Limiting access to your server by
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync outside parties can help prevent spoofing and denial of service (DoS) attacks against
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync your server.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Here is an example of how to properly apply ACLs:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync// Set up an ACL named "bogusnets" that will block RFC1918 space
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync// and some reserved space, which is commonly used in spoofing attacks.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncacl bogusnets {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync 0.0.0.0/8; 1.0.0.0/8; 2.0.0.0/8; 192.0.2.0/24; 224.0.0.0/3;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync// Set up an ACL called our-nets. Replace this with the real IP numbers.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync allow-query { our-nets; };
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync allow-recursion { our-nets; };
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync blackhole { bogusnets; };
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync type master;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync allow-query { any; };
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync This allows recursive queries of the server from the outside
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync unless recursion has been previously disabled.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync For more information on how to use ACLs to protect your server,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync see the <span class="emphasis"><em>AUSCERT</em></span> advisory at:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <a href="ftp://ftp.auscert.org.au/pub/auscert/advisory/AL-1999.004.dns_dos" target="_top">ftp://ftp.auscert.org.au/pub/auscert/advisory/AL-1999.004.dns_dos</a>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<div class="titlepage"><div><div><h2 class="title" style="clear: both">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a name="id2597956"></a><span><strong class="command">chroot</strong></span> and <span><strong class="command">setuid</strong></span></h2></div></div></div>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync On UNIX servers, it is possible to run <acronym class="acronym">BIND</acronym> in a <span class="emphasis"><em>chrooted</em></span> environment
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (using the <span><strong class="command">chroot()</strong></span> function) by specifying the "<code class="option">-t</code>"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync option. This can help improve system security by placing <acronym class="acronym">BIND</acronym> in
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync a "sandbox", which will limit the damage done if a server is
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync compromised.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Another useful feature in the UNIX version of <acronym class="acronym">BIND</acronym> is the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ability to run the daemon as an unprivileged user ( <code class="option">-u</code> <em class="replaceable"><code>user</code></em> ).
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync We suggest running as an unprivileged user when using the <span><strong class="command">chroot</strong></span> feature.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Here is an example command line to load <acronym class="acronym">BIND</acronym> in a <span><strong class="command">chroot</strong></span> sandbox,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <span><strong class="command">/var/named</strong></span>, and to run <span><strong class="command">named</strong></span> <span><strong class="command">setuid</strong></span> to
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <strong class="userinput"><code>/usr/local/bin/named -u 202 -t /var/named</code></strong>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a name="id2598033"></a>The <span><strong class="command">chroot</strong></span> Environment</h3></div></div></div>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync In order for a <span><strong class="command">chroot</strong></span> environment
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync work properly in a particular directory
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (for example, <code class="filename">/var/named</code>),
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync you will need to set up an environment that includes everything
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <acronym class="acronym">BIND</acronym> needs to run.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync From <acronym class="acronym">BIND</acronym>'s point of view, <code class="filename">/var/named</code> is
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync the root of the filesystem. You will need to adjust the values of
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync options like
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync like <span><strong class="command">directory</strong></span> and <span><strong class="command">pid-file</strong></span> to account
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Unlike with earlier versions of BIND, you will typically
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <span class="emphasis"><em>not</em></span> need to compile <span><strong class="command">named</strong></span>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync statically nor install shared libraries under the new root.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync However, depending on your operating system, you may need
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync to set up things like
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a name="id2598092"></a>Using the <span><strong class="command">setuid</strong></span> Function</h3></div></div></div>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Prior to running the <span><strong class="command">named</strong></span> daemon,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync the <span><strong class="command">touch</strong></span> utility (to change file
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync modification times) or the <span><strong class="command">chown</strong></span>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync utility (to
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync to which you want <acronym class="acronym">BIND</acronym>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Note that if the <span><strong class="command">named</strong></span> daemon is running as an
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync unprivileged user, it will not be able to bind to new restricted
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ports if the server is reloaded.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<div class="titlepage"><div><div><h2 class="title" style="clear: both">
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a name="dynamic_update_security"></a>Dynamic Update Security</h2></div></div></div>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Access to the dynamic
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync update facility should be strictly limited. In earlier versions of
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync <acronym class="acronym">BIND</acronym>, the only way to do this was
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync based on the IP
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync address of the host requesting the update, by listing an IP address
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync network prefix in the <span><strong class="command">allow-update</strong></span>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync zone option.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync This method is insecure since the source address of the update UDP
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync is easily forged. Also note that if the IP addresses allowed by the
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync <span><strong class="command">allow-update</strong></span> option include the
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync address of a slave
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync server which performs forwarding of dynamic updates, the master can
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync trivially attacked by sending the update to the slave, which will
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync forward it to the master with its own source IP address causing the
f6a7a5ea5c6903d1a5632f2febac4e489bd8beddvboxsync master to approve it without question.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync For these reasons, we strongly recommend that updates be
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync cryptographically authenticated by means of transaction signatures
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (TSIG). That is, the <span><strong class="command">allow-update</strong></span>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync option should
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync list only TSIG key names, not IP addresses or network
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync prefixes. Alternatively, the new <span><strong class="command">update-policy</strong></span>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync option can be used.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Some sites choose to keep all dynamically-updated DNS data
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync in a subdomain and delegate that subdomain to a separate zone. This
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync way, the top-level zone containing critical data such as the IP
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync of public web and mail servers need not allow dynamic update at
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<a accesskey="p" href="Bv9ARM.ch06.html">Prev</a>�</td>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<td width="40%" align="right">�<a accesskey="n" href="Bv9ARM.ch08.html">Next</a>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<td width="40%" align="left" valign="top">Chapter�6.�<acronym class="acronym">BIND</acronym> 9 Configuration Reference�</td>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<td width="20%" align="center"><a accesskey="h" href="Bv9ARM.html">Home</a></td>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync<td width="40%" align="right" valign="top">�Chapter�8.�Troubleshooting</td>