<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style xmlns="" type="text/css"> div.added { background-color: #ffff99; } div.deleted { text-decoration: line-through; background-color: #FF7F7F; } div.changed { background-color: #99ff99; } div.off { } span.added { background-color: #ffff99; } span.deleted { text-decoration: line-through; background-color: #FF7F7F; } span.changed { background-color: #99ff99; } span.off { } pre.literallayout { background-color: #E8E8D0; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } div[class=changed] pre.literallayout { background-color: #99ff99; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } div.literallayout { background-color: #E8E8D0; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } div[class=changed] div.literallayout { background-color: #99ff99; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } </style><title>17. The dnslookup router</title><meta name="generator" content="DocBook XSL Stylesheets V1.72.0" /><link rel="start" href="index.html" title="Specification of the Exim Mail Transfer Agent" /><link rel="up" href="index.html" title="Specification of the Exim Mail Transfer Agent" /><link rel="prev" href="ch16.html" title="16. The accept router" /><link rel="next" href="ch18.html" title="18. The ipliteral router" /></head><body><div class="navheader"> <table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="ch16.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch18.html">Next</a></td></tr></table></div> <div class="chapter" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title"><a href="index.html#toc0188" id="CHAPdnslookup">17. The dnslookup router</a></h2></div> </div> </div> <p> <a id="IIDdnsrou1" class="indexterm"></a> <a id="IIDdnsrou2" class="indexterm"></a> The <span><strong class="command">dnslookup</strong></span> router looks up the hosts that handle mail for the recipient’s domain in the DNS. A transport must always be set for this router, unless <span><strong class="option">verify_only</strong></span> is set. </p> <p> If SRV support is configured (see <span><strong class="option">check_srv</strong></span> below), Exim first searches for SRV records. If none are found, or if SRV support is not configured, MX records are looked up. If no MX records exist, address records are sought. However, <span><strong class="option">mx_domains</strong></span> can be set to disable the direct use of address records. </p> <p> MX records of equal priority are sorted by Exim into a random order. Exim then looks for address records for the host names obtained from MX or SRV records. When a host has more than one IP address, they are sorted into a random order, except that IPv6 addresses are always sorted before IPv4 addresses. If all the IP addresses found are discarded by a setting of the <span><strong class="option">ignore_target_hosts</strong></span> generic option, the router declines. </p> <p> Unless they have the highest priority (lowest MX value), MX records that point to the local host, or to any host name that matches <span><strong class="option">hosts_treat_as_local</strong></span>, are discarded, together with any other MX records of equal or lower priority. </p> <p> <a id="id567587" class="indexterm"></a> <a id="id567601" class="indexterm"></a> <a id="id567616" class="indexterm"></a> If the host pointed to by the highest priority MX record, or looked up as an address record, is the local host, or matches <span><strong class="option">hosts_treat_as_local</strong></span>, what happens is controlled by the generic <span><strong class="option">self</strong></span> option. </p> <div class="section" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0189" id="SECTprowitdnsloo">17.1 Problems with DNS lookups</a></h3></div> </div> </div> <p> There have been problems with DNS servers when SRV records are looked up. Some mis-behaving servers return a DNS error or timeout when a non-existent SRV record is sought. Similar problems have in the past been reported for MX records. The global <span><strong class="option">dns_again_means_nonexist</strong></span> option can help with this problem, but it is heavy-handed because it is a global option. </p> <p> For this reason, there are two options, <span><strong class="option">srv_fail_domains</strong></span> and <span><strong class="option">mx_fail_domains</strong></span>, that control what happens when a DNS lookup in a <span><strong class="command">dnslookup</strong></span> router results in a DNS failure or a “<span class="quote">try again</span>” response. If an attempt to look up an SRV or MX record causes one of these results, and the domain matches the relevant list, Exim behaves as if the DNS had responded “<span class="quote">no such record</span>”. In the case of an SRV lookup, this means that the router proceeds to look for MX records; in the case of an MX lookup, it proceeds to look for A or AAAA records, unless the domain matches <span><strong class="option">mx_domains</strong></span>, in which case routing fails. </p> </div> <div class="section" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0190" id="SECID118">17.2 Private options for dnslookup</a></h3></div> </div> </div> <p> <a id="id567720" class="indexterm"></a> The private options for the <span><strong class="command">dnslookup</strong></span> router are as follows: </p> <p> <a id="id567749" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">check_secondary_mx</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>boolean</em></span></td><td align="right">Default: <span class="emphasis"><em>false</em></span></td></tr></tbody></table></div> <p> <a id="id567831" class="indexterm"></a> If this option is set, the router declines unless the local host is found in (and removed from) the list of hosts obtained by MX lookup. This can be used to process domains for which the local host is a secondary mail exchanger differently to other domains. The way in which Exim decides whether a host is the local host is described in section <a href="ch13.html#SECTreclocipadd" title="13.8 Recognizing the local host">13.8</a>. </p> <p> <a id="id567861" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">check_srv</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>string</em></span>†<span class="emphasis"><em></em></span></td><td align="right">Default: <span class="emphasis"><em>unset</em></span></td></tr></tbody></table></div> <p> <a id="id567945" class="indexterm"></a> The <span><strong class="command">dnslookup</strong></span> router supports the use of SRV records (see RFC 2782) in addition to MX and address records. The support is disabled by default. To enable SRV support, set the <span><strong class="option">check_srv</strong></span> option to the name of the service required. For example, </p> <pre class="literallayout">check_srv = smtp </pre><p> looks for SRV records that refer to the normal smtp service. The option is expanded, so the service name can vary from message to message or address to address. This might be helpful if SRV records are being used for a submission service. If the expansion is forced to fail, the <span><strong class="option">check_srv</strong></span> option is ignored, and the router proceeds to look for MX records in the normal way. </p> <p> When the expansion succeeds, the router searches first for SRV records for the given service (it assumes TCP protocol). A single SRV record with a host name that consists of just a single dot indicates “<span class="quote">no such service for this domain</span>”; if this is encountered, the router declines. If other kinds of SRV record are found, they are used to construct a host list for delivery according to the rules of RFC 2782. MX records are not sought in this case. </p> <p> When no SRV records are found, MX records (and address records) are sought in the traditional way. In other words, SRV records take precedence over MX records, just as MX records take precedence over address records. Note that this behaviour is not sanctioned by RFC 2782, though a previous draft RFC defined it. It is apparently believed that MX records are sufficient for email and that SRV records should not be used for this purpose. However, SRV records have an additional “<span class="quote">weight</span>” feature which some people might find useful when trying to split an SMTP load between hosts of different power. </p> <p> See section <a href="ch17.html#SECTprowitdnsloo" title="17.1 Problems with DNS lookups">17.1</a> above for a discussion of Exim’s behaviour when there is a DNS lookup error. </p> <p> <a id="id568044" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">mx_domains</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>domain list</em></span>†<span class="emphasis"><em></em></span></td><td align="right">Default: <span class="emphasis"><em>unset</em></span></td></tr></tbody></table></div> <p> <a id="id568128" class="indexterm"></a> <a id="id568143" class="indexterm"></a> A domain that matches <span><strong class="option">mx_domains</strong></span> is required to have either an MX or an SRV record in order to be recognized. (The name of this option could be improved.) For example, if all the mail hosts in <span class="emphasis"><em>fict.example</em></span> are known to have MX records, except for those in <span class="emphasis"><em>discworld.fict.example</em></span>, you could use this setting: </p> <pre class="literallayout">mx_domains = ! *.discworld.fict.example : *.fict.example </pre><p> This specifies that messages addressed to a domain that matches the list but has no MX record should be bounced immediately instead of being routed using the address record. </p> <p> <a id="id568191" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">mx_fail_domains</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>domain list</em></span>†<span class="emphasis"><em></em></span></td><td align="right">Default: <span class="emphasis"><em>unset</em></span></td></tr></tbody></table></div> <p> If the DNS lookup for MX records for one of the domains in this list causes a DNS lookup error, Exim behaves as if no MX records were found. See section <a href="ch17.html#SECTprowitdnsloo" title="17.1 Problems with DNS lookups">17.1</a> for more discussion. </p> <p> <a id="id568287" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">qualify_single</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>boolean</em></span></td><td align="right">Default: <span class="emphasis"><em>true</em></span></td></tr></tbody></table></div> <p> <a id="id568369" class="indexterm"></a> <a id="id568383" class="indexterm"></a> When this option is true, the resolver option RES_DEFNAMES is set for DNS lookups. Typically, but not standardly, this causes the resolver to qualify single-component names with the default domain. For example, on a machine called <span class="emphasis"><em>dictionary.ref.example</em></span>, the domain <span class="emphasis"><em>thesaurus</em></span> would be changed to <span class="emphasis"><em>thesaurus.ref.example</em></span> inside the resolver. For details of what your resolver actually does, consult your man pages for <span class="emphasis"><em>resolver</em></span> and <span class="emphasis"><em>resolv.conf</em></span>. </p> <p> <a id="id568426" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">rewrite_headers</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>boolean</em></span></td><td align="right">Default: <span class="emphasis"><em>true</em></span></td></tr></tbody></table></div> <p> <a id="id568508" class="indexterm"></a> <a id="id568522" class="indexterm"></a> If the domain name in the address that is being processed is not fully qualified, it may be expanded to its full form by a DNS lookup. For example, if an address is specified as <span class="emphasis"><em>dormouse@teaparty</em></span>, the domain might be expanded to <span class="emphasis"><em>teaparty.wonderland.fict.example</em></span>. Domain expansion can also occur as a result of setting the <span><strong class="option">widen_domains</strong></span> option. If <span><strong class="option">rewrite_headers</strong></span> is true, all occurrences of the abbreviated domain name in any <span class="emphasis"><em>Bcc:</em></span>, <span class="emphasis"><em>Cc:</em></span>, <span class="emphasis"><em>From:</em></span>, <span class="emphasis"><em>Reply-to:</em></span>, <span class="emphasis"><em>Sender:</em></span>, and <span class="emphasis"><em>To:</em></span> header lines of the message are rewritten with the full domain name. </p> <p> This option should be turned off only when it is known that no message is ever going to be sent outside an environment where the abbreviation makes sense. </p> <p> When an MX record is looked up in the DNS and matches a wildcard record, name servers normally return a record containing the name that has been looked up, making it impossible to detect whether a wildcard was present or not. However, some name servers have recently been seen to return the wildcard entry. If the name returned by a DNS lookup begins with an asterisk, it is not used for header rewriting. </p> <p> <a id="id568592" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">same_domain_copy_routing</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>boolean</em></span></td><td align="right">Default: <span class="emphasis"><em>false</em></span></td></tr></tbody></table></div> <p> <a id="id568675" class="indexterm"></a> Addresses with the same domain are normally routed by the <span><strong class="command">dnslookup</strong></span> router to the same list of hosts. However, this cannot be presumed, because the router options and preconditions may refer to the local part of the address. By default, therefore, Exim routes each address in a message independently. DNS servers run caches, so repeated DNS lookups are not normally expensive, and in any case, personal messages rarely have more than a few recipients. </p> <p> If you are running mailing lists with large numbers of subscribers at the same domain, and you are using a <span><strong class="command">dnslookup</strong></span> router which is independent of the local part, you can set <span><strong class="option">same_domain_copy_routing</strong></span> to bypass repeated DNS lookups for identical domains in one message. In this case, when <span><strong class="command">dnslookup</strong></span> routes an address to a remote transport, any other unrouted addresses in the message that have the same domain are automatically given the same routing without processing them independently, provided the following conditions are met: </p> <div class="itemizedlist"> <ul type="disc"><li><p> No router that processed the address specified <span><strong class="option">headers_add</strong></span> or <span><strong class="option">headers_remove</strong></span>. </p> </li><li><p> The router did not change the address in any way, for example, by “<span class="quote">widening</span>” the domain. </p> </li></ul></div> <p> <a id="id568762" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">search_parents</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>boolean</em></span></td><td align="right">Default: <span class="emphasis"><em>false</em></span></td></tr></tbody></table></div> <p> <a id="id568844" class="indexterm"></a> When this option is true, the resolver option RES_DNSRCH is set for DNS lookups. This is different from the <span><strong class="option">qualify_single</strong></span> option in that it applies to domains containing dots. Typically, but not standardly, it causes the resolver to search for the name in the current domain and in parent domains. For example, on a machine in the <span class="emphasis"><em>fict.example</em></span> domain, if looking up <span class="emphasis"><em>teaparty.wonderland</em></span> failed, the resolver would try <span class="emphasis"><em>teaparty.wonderland.fict.example</em></span>. For details of what your resolver actually does, consult your man pages for <span class="emphasis"><em>resolver</em></span> and <span class="emphasis"><em>resolv.conf</em></span>. </p> <p> Setting this option true can cause problems in domains that have a wildcard MX record, because any domain that does not have its own MX record matches the local wildcard. </p> <p> <a id="id568898" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">srv_fail_domains</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>domain list</em></span>†<span class="emphasis"><em></em></span></td><td align="right">Default: <span class="emphasis"><em>unset</em></span></td></tr></tbody></table></div> <p> If the DNS lookup for SRV records for one of the domains in this list causes a DNS lookup error, Exim behaves as if no SRV records were found. See section <a href="ch17.html#SECTprowitdnsloo" title="17.1 Problems with DNS lookups">17.1</a> for more discussion. </p> <p> <a id="id568995" class="indexterm"></a> </p> <div class="informaltable"> <table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /><col align="right" /></colgroup><tbody><tr><td align="left"><span><strong class="option">widen_domains</strong></span></td><td align="center">Use: <span class="emphasis"><em>dnslookup</em></span></td><td align="center">Type: <span class="emphasis"><em>string list</em></span></td><td align="right">Default: <span class="emphasis"><em>unset</em></span></td></tr></tbody></table></div> <p> <a id="id569077" class="indexterm"></a> If a DNS lookup fails and this option is set, each of its strings in turn is added onto the end of the domain, and the lookup is tried again. For example, if </p> <pre class="literallayout">widen_domains = fict.example:ref.example </pre><p> is set and a lookup of <span class="emphasis"><em>klingon.dictionary</em></span> fails, <span class="emphasis"><em>klingon.dictionary.fict.example</em></span> is looked up, and if this fails, <span class="emphasis"><em>klingon.dictionary.ref.example</em></span> is tried. Note that the <span><strong class="option">qualify_single</strong></span> and <span><strong class="option">search_parents</strong></span> options can cause some widening to be undertaken inside the DNS resolver. <span><strong class="option">widen_domains</strong></span> is not applied to sender addresses when verifying, unless <span><strong class="option">rewrite_headers</strong></span> is false (not the default). </p> </div> <div class="section" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0191" id="SECID119">17.3 Effect of qualify_single and search_parents</a></h3></div> </div> </div> <p> When a domain from an envelope recipient is changed by the resolver as a result of the <span><strong class="option">qualify_single</strong></span> or <span><strong class="option">search_parents</strong></span> options, Exim rewrites the corresponding address in the message’s header lines unless <span><strong class="option">rewrite_headers</strong></span> is set false. Exim then re-routes the address, using the full domain. </p> <p> These two options affect only the DNS lookup that takes place inside the router for the domain of the address that is being routed. They do not affect lookups such as that implied by </p> <pre class="literallayout">domains = @mx_any </pre><p> that may happen while processing a router precondition before the router is entered. No widening ever takes place for these lookups. <a id="id569186" class="indexterm"></a> <a id="id569198" class="indexterm"></a> </p> </div> </div> <div class="navfooter"> <table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch16.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch18.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div> </body></html>