Debian Codegraph @

doc/qualify.html

raw symbols SCIP
1 <html>
2 <body>
3 <a href="../djb.html">D. J. Bernstein</a>
4 <br><a href="../web.html">Internet publication</a>
5 <br><a href="../djbdns.html">djbdns</a>
6 <h1>User's guide to name qualification</h1>
7 <b>Qualification</b> means conversion
8 of a short host name that you type, such as <tt>cheetah</tt>,
9 into a complete (``fully qualified'') domain name,
10 such as <tt>cheetah.heaven.af.mil</tt>.
11 <p>
12 This page explains the djbdns qualification procedure.
13 These rules are followed by the
14 <tt>dns_ip4_qualify</tt>
15 library routine in djbdns,
16 and by programs that use the <tt>dns_ip4_qualify</tt> routine.
17 <h2>Rewriting instructions</h2>
18 Normally the djbdns qualification procedure
19 follows instructions listed in <tt>/etc/dnsrewrite</tt>,
20 a file created by your system administrator.
21 You can override <tt>/etc/dnsrewrite</tt>
22 by creating your own file
23 and setting the <tt>$DNSREWRITEFILE</tt> environment variable
24 to the name of that file.
25 <p>
26 Sample instructions:
27 <pre>
28 # anything.local -&gt; me
29 -.local:me
30 # me -&gt; 127.0.0.1
31 =me:127.0.0.1
32 # any.name.a -&gt; any.name.af.mil
33 *.a:.af.mil
34 # any-name-without-dots -&gt; any-name-without-dots.heaven.af.mil
35 ?:.heaven.af.mil
36 # remove trailing dot
37 *.:
38 </pre>
39 <p>
40 Instructions are followed in order, each at most once.
41 There are four types of instructions:
42 <ul>
43 <li><tt>=<i>post</i>:<i>new</i></tt>
44 means that the host name <tt><i>post</i></tt> is replaced by <tt><i>new</i></tt>.
45 <li><tt>*<i>post</i>:<i>new</i></tt>
46 means that any name of the form <tt><i>prepost</i></tt>
47 is replaced by <tt><i>prenew</i></tt>.
48 <li><tt>?<i>post</i>:<i>new</i></tt>
49 means that any name of the form <tt><i>prepost</i></tt>,
50 where <tt><i>pre</i></tt> does not contain dots or brackets,
51 is replaced by <tt><i>prenew</i></tt>.
52 <li><tt>-<i>post</i>:<i>new</i></tt>
53 means that any name of the form <tt><i>prepost</i></tt>
54 is replaced by <tt><i>new</i></tt>.
55 </ul>
56 <h2>Searching</h2>
57 The djbdns qualification procedure
58 can search through DNS for several possible qualifications of a name.
59 For example, the name
60 <pre>
61 cheetah+.heaven.af.mil+.af.mil
62 </pre>
63 is qualified as <tt>cheetah.heaven.af.mil</tt>
64 if that name has IP addresses listed in DNS,
65 or <tt>cheetah.af.mil</tt> otherwise.
66 <p>
67 In general,
68 <tt><i>x</i>+<i>y1</i>+<i>y2</i>+<i>y3</i></tt>
69 is qualified as <tt><i>xy1</i></tt>
70 if <tt><i>xy1</i></tt> has IP addresses listed in DNS;
71 otherwise, as <tt><i>xy2</i></tt>
72 if <tt><i>xy2</i></tt> has IP addresses listed in DNS;
73 otherwise, as <tt><i>xy3</i></tt>.
74 You can list any number of +'s.
75 <p>
76 Searching is applied after rewriting,
77 so you can use a rewriting instruction such as
78 <pre>
79 ?:+.heaven.af.mil+.af.mil
80 </pre>
81 to have
82 <tt>lion</tt> qualified as <tt>lion.heaven.af.mil</tt> or <tt>lion.af.mil</tt>,
83 and
84 <tt>tiger</tt> qualified as <tt>tiger.heaven.af.mil</tt> or <tt>tiger.af.mil</tt>,
85 and so on.
86 <p>
87 Searching is generally not a recommended feature.
88 If you rely on <tt>gw</tt> being qualified as <tt>gw.af.mil</tt>,
89 and someone suddenly adds a new <tt>gw.heaven.af.mil</tt>,
90 you'll end up talking to the wrong host.
91 It's better to rely on syntactic rules that you control.
92 <h2>Compatibility mechanisms</h2>
93 If the rewriting-instructions file does not exist,
94 the djbdns qualification procedure looks for a local domain name in three places:
95 <ol>
96 <li>the <tt>$LOCALDOMAIN</tt> environment variable, if it is set; or
97 <li>the first <tt>domain</tt> or <tt>search</tt> line
98 in <tt>/etc/resolv.conf</tt>,
99 if <tt>/etc/resolv.conf</tt> exists and has such a line; or
100 <li>everything after the first dot in the system's hostname.
101 </ol>
102 It then creates rewriting instructions of the form
103 <pre>
104 ?:.<i>domain</i>
105 *.:
106 </pre>
107 so that <tt>.<i>domain</i></tt> is added to any name without dots or brackets.
108 <p>
109 You can specify searching in <tt>$LOCALDOMAIN</tt>
110 by using several domain names separated by spaces.
111 Your system administrator can specify searching in <tt>/etc/resolv.conf</tt>
112 by putting several domains on a <tt>search</tt> line.
113 <h2>Compatibility notes</h2>
114 Different DNS client programs use different qualification procedures.
115 Two major differences between the djbdns qualification procedure
116 and other qualification procedures:
117 <ul>
118 <li>Most programs use only <tt>/etc/resolv.conf</tt>.
119 They don't know anything about
120 <tt>/etc/dnsrewrite</tt> and <tt>$DNSREWRITEFILE</tt>.
121 <li>Most long-running programs
122 don't notice changes in <tt>/etc/resolv.conf</tt>;
123 they read <tt>/etc/resolv.conf</tt> when they start,
124 and they don't reread it until they are restarted.
125 In contrast, the djbdns qualification procedure
126 checks for changes every 10 minutes or 10000 uses.
127 </ul>
128 Two minor differences:
129 <ul>
130 <li>Some programs interpret
131 a <tt>domain</tt> line in <tt>/etc/resolv.conf</tt>
132 as specifying a search list consisting of various suffixes of the domain.
133 <li>Many programs will search the local domain
134 for names <i>with</i> dots.
135 </ul>
136 If you want the local domain searched for names with dots,
137 you can set it up with rewriting:
138 <pre>
139 # aol.com -&gt; aol.com or aol.com.heaven.af.mil
140 *:++.heaven.af.mil
141 # but skip directly to heaven.af.mil if no dots
142 ?++.heaven.af.mil:.heaven.af.mil
143 </pre>
144 </ul>
145 </body>
146 </html>