dns-caveats.html.en revision e609c337f729875bc20e01096c7e610f45356f54
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<?xml version="1.0" encoding="ISO-8859-1"?>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips This file is generated from xml source: DO NOT EDIT
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips -->
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<title>Issues Regarding DNS and Apache - Apache HTTP Server</title>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<link href="/images/favicon.ico" rel="shortcut icon" /></head>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<body id="manual-page"><div id="page-header">
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<p class="apache">Apache HTTP Server Version 2.3</p>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<img alt="" src="/images/feather.gif" /></div>
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<div id="path">
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="./">Version 2.3</a></div><div id="page-content"><div id="preamble"><h1>Issues Regarding DNS and Apache</h1>
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<div class="toplang">
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<p><span>Available Languages: </span><a href="/en/dns-caveats.html" title="English">&nbsp;en&nbsp;</a> |
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<a href="/ja/dns-caveats.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
4149f86d816fc0fef41d35de5beb09bfe81e0d6aBrandon Philips<a href="/ko/dns-caveats.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<a href="/tr/dns-caveats.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek</div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>This page could be summarized with the statement: don't
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek configure Apache in such a way that it relies on DNS resolution
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek for parsing of the configuration files. If Apache requires DNS
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek resolution to parse the configuration files then your server
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek may be subject to reliability problems (ie. it might not boot),
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek or denial and theft of service attacks (including users able
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek to steal hits from other users).</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#example">A Simple Example</a></li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/down.gif" /> <a href="#denial">Denial of Service</a></li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/down.gif" /> <a href="#main">The "main server" Address</a></li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/down.gif" /> <a href="#tips">Tips to Avoid These Problems</a></li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/down.gif" /> <a href="#appendix">Appendix: Future Directions</a></li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek</ul></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="section">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<h2><a name="example" id="example">A Simple Example</a></h2>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <div class="example"><p><code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;VirtualHost www.abc.dom&gt; <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ServerAdmin webgirl@abc.dom <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek DocumentRoot /www/abc <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;/VirtualHost&gt;
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </code></p></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>In order for Apache to function properly, it absolutely needs
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek to have two pieces of information about each virtual host: the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> and at least one
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek IP address that the server will bind and respond to. The above
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek example does not include the IP address, so Apache must use DNS
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek to find the address of <code>www.abc.dom</code>. If for some
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek reason DNS is not available at the time your server is parsing
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek its config file, then this virtual host <strong>will not be
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek configured</strong>. It won't be able to respond to any hits
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek to this virtual host (prior to Apache version 1.2 the server
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek would not even boot).</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>Suppose that <code>www.abc.dom</code> has address 192.0.2.1.
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek Then consider this configuration snippet:</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <div class="example"><p><code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;VirtualHost 192.0.2.1&gt; <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ServerAdmin webgirl@abc.dom <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek DocumentRoot /www/abc <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;/VirtualHost&gt;
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </code></p></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>This time Apache needs to use reverse DNS to find the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>ServerName</code> for this virtualhost. If that reverse
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek lookup fails then it will partially disable the virtualhost
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek (prior to Apache version 1.2 the server would not even boot).
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek If the virtual host is name-based then it will effectively be
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek totally disabled, but if it is IP-based then it will mostly
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek work. However, if Apache should ever have to generate a full
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek URL for the server which includes the server name, then it will
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek fail to generate a valid URL.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>Here is a snippet that avoids both of these problems:</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <div class="example"><p><code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;VirtualHost 192.0.2.1&gt; <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ServerName www.abc.dom <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ServerAdmin webgirl@abc.dom <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek DocumentRoot /www/abc <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;/VirtualHost&gt;
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </code></p></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="section">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<h2><a name="denial" id="denial">Denial of Service</a></h2>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>There are (at least) two forms that denial of service
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek can come in. If you are running a version of Apache prior to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek version 1.2 then your server will not even boot if one of the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek two DNS lookups mentioned above fails for any of your virtual
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek hosts. In some cases this DNS lookup may not even be under your
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek control; for example, if <code>abc.dom</code> is one of your
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek customers and they control their own DNS, they can force your
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek (pre-1.2) server to fail while booting simply by deleting the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>www.abc.dom</code> record.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>Another form is far more insidious. Consider this
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek configuration snippet:</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <div class="example"><p><code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;VirtualHost www.abc.dom&gt;<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <span class="indent">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ServerAdmin webgirl@abc.dom<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek DocumentRoot /www/abc<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </span>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;/VirtualHost&gt;<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;VirtualHost www.def.dom&gt;<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <span class="indent">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ServerAdmin webguy@def.dom<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek DocumentRoot /www/def<br />
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </span>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek &lt;/VirtualHost&gt;
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </code></p></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>Suppose that you've assigned 192.0.2.1 to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>www.abc.dom</code> and 192.0.2.2 to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>www.def.dom</code>. Furthermore, suppose that
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>def.dom</code> has control of their own DNS. With this
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek config you have put <code>def.dom</code> into a position where
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek they can steal all traffic destined to <code>abc.dom</code>. To
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek do so, all they have to do is set <code>www.def.dom</code> to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek 192.0.2.1. Since they control their own DNS you can't stop them
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek from pointing the <code>www.def.dom</code> record wherever they
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek wish.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>Requests coming in to 192.0.2.1 (including all those where
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek users typed in URLs of the form
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>http://www.abc.dom/whatever</code>) will all be served by
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek the <code>def.dom</code> virtual host. To better understand why
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek this happens requires a more in-depth discussion of how Apache
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek matches up incoming requests with the virtual host that will
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek serve it. A rough document describing this <a href="vhosts/details.html">is available</a>.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="section">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<h2><a name="main" id="main">The "main server" Address</a></h2>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>The addition of <a href="vhosts/name-based.html">name-based
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek virtual host support</a> in Apache 1.1 requires Apache to know
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek the IP address(es) of the host that <code class="program"><a href="/programs/httpd.html">httpd</a></code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek is running on. To get this address it uses either the global
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek (if present) or calls the C function <code>gethostname</code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek (which should return the same as typing "hostname" at the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek command prompt). Then it performs a DNS lookup on this address.
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek At present there is no way to avoid this lookup.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>If you fear that this lookup might fail because your DNS
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek server is down then you can insert the hostname in
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code>/etc/hosts</code> (where you probably already have it so
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek that the machine can boot properly). Then ensure that your
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek machine is configured to use <code>/etc/hosts</code> in the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek event that DNS fails. Depending on what OS you are using this
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek might be accomplished by editing <code>/etc/resolv.conf</code>,
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek or maybe <code>/etc/nsswitch.conf</code>.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>If your server doesn't have to perform DNS for any other
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek reason then you might be able to get away with running Apache
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek with the <code>HOSTRESORDER</code> environment variable set to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek "local". This all depends on what OS and resolver libraries you
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek are using. It also affects CGIs unless you use
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code class="module"><a href="/mod/mod_env.html">mod_env</a></code> to control the environment. It's best
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek to consult the man pages or FAQs for your OS.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="section">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<h2><a name="tips" id="tips">Tips to Avoid These Problems</a></h2>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <ul>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek use IP addresses in
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code class="directive"><a href="/mod/core.html#virtualhost">VirtualHost</a></code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek use IP addresses in
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek ensure all virtual hosts have an explicit
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <li>create a <code>&lt;VirtualHost _default_:*&gt;</code>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek server that has no pages to serve</li>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </ul>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="section">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<h2><a name="appendix" id="appendix">Appendix: Future Directions</a></h2>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>The situation regarding DNS is highly undesirable. For
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek Apache 1.2 we've attempted to make the server at least continue
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek booting in the event of failed DNS, but it might not be the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek best we can do. In any event, requiring the use of explicit IP
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek addresses in configuration files is highly undesirable in
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek today's Internet where renumbering is a necessity.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>A possible work around to the theft of service attack
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek described above would be to perform a reverse DNS lookup on the
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek IP address returned by the forward lookup and compare the two
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek names -- in the event of a mismatch, the virtualhost would be
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek disabled. This would require reverse DNS to be configured
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek properly (which is something that most admins are familiar with
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek because of the common use of "double-reverse" DNS lookups by
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek FTP servers and TCP wrappers).</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>In any event, it doesn't seem possible to reliably boot a
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek virtual-hosted web server when DNS has failed unless IP
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek addresses are used. Partial solutions such as disabling
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek portions of the configuration might be worse than not booting
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek at all depending on what the webserver is supposed to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek accomplish.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek <p>As HTTP/1.1 is deployed and browsers and proxies start
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek issuing the <code>Host</code> header it will become possible to
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek avoid the use of IP-based virtual hosts entirely. In this case,
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek a webserver has no requirement to do DNS lookups during
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek configuration. But as of March 1997 these features have not
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek been deployed widely enough to be put into use on critical
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek webservers.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek </div></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<div class="bottomlang">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<p><span>Available Languages: </span><a href="/en/dns-caveats.html" title="English">&nbsp;en&nbsp;</a> |
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<a href="/ja/dns-caveats.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<a href="/ko/dns-caveats.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<a href="/tr/dns-caveats.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek</div><div id="footer">
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<p class="apache">Copyright 2008 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
302fbdf29eb0ad4ca1fe8ee18755edad7db11b37Zbigniew Jędrzejewski-Szmek</body></html>