1<!-- 2 - Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") 3 - Copyright (C) 2000-2003 Internet Software Consortium. 4 - 5 - Permission to use, copy, modify, and/or distribute this software for any 6 - purpose with or without fee is hereby granted, provided that the above 7 - copyright notice and this permission notice appear in all copies. 8 - 9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 - PERFORMANCE OF THIS SOFTWARE. 16--> 17<!-- Id --> 18<html> 19<head> 20<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 21<title>Appendix�D.�BIND 9 DNS Library Support</title> 22<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> 23<link rel="start" href="Bv9ARM.html" title="BIND 9 Administrator Reference Manual"> 24<link rel="up" href="Bv9ARM.html" title="BIND 9 Administrator Reference Manual"> 25<link rel="prev" href="Bv9ARM.ch11.html" title="Appendix�C.�General DNS Reference Information"> 26<link rel="next" href="Bv9ARM.ch13.html" title="Manual pages"> 27</head> 28<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 29<div class="navheader"> 30<table width="100%" summary="Navigation header"> 31<tr><th colspan="3" align="center">Appendix�D.�BIND 9 DNS Library Support</th></tr> 32<tr> 33<td width="20%" align="left"> 34<a accesskey="p" href="Bv9ARM.ch11.html">Prev</a>�</td> 35<th width="60%" align="center">�</th> 36<td width="20%" align="right">�<a accesskey="n" href="Bv9ARM.ch13.html">Next</a> 37</td> 38</tr> 39</table> 40<hr> 41</div> 42<div class="appendix" lang="en"> 43<div class="titlepage"><div><div><h2 class="title"> 44<a name="Bv9ARM.ch12"></a>Appendix�D.�BIND 9 DNS Library Support</h2></div></div></div> 45<div class="toc"> 46<p><b>Table of Contents</b></p> 47<dl> 48<dt><span class="sect1"><a href="Bv9ARM.ch12.html#bind9.library">BIND 9 DNS Library Support</a></span></dt> 49<dd><dl> 50<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2612253">Prerequisite</a></span></dt> 51<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2612263">Compilation</a></span></dt> 52<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2612288">Installation</a></span></dt> 53<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2612455">Known Defects/Restrictions</a></span></dt> 54<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2612532">The dns.conf File</a></span></dt> 55<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2612558">Sample Applications</a></span></dt> 56<dt><span class="sect2"><a href="Bv9ARM.ch12.html#id2613600">Library References</a></span></dt> 57</dl></dd> 58</dl> 59</div> 60<div class="sect1" lang="en"> 61<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 62<a name="bind9.library"></a>BIND 9 DNS Library Support</h2></div></div></div> 63<p>This version of BIND 9 "exports" its internal libraries so 64 that they can be used by third-party applications more easily (we 65 call them "export" libraries in this document). In addition to 66 all major DNS-related APIs BIND 9 is currently using, the export 67 libraries provide the following features:</p> 68<div class="itemizedlist"><ul type="disc"> 69<li><p>The newly created "DNS client" module. This is a higher 70 level API that provides an interface to name resolution, 71 single DNS transaction with a particular server, and dynamic 72 update. Regarding name resolution, it supports advanced 73 features such as DNSSEC validation and caching. This module 74 supports both synchronous and asynchronous mode.</p></li> 75<li><p>The new "IRS" (Information Retrieval System) library. 76 It provides an interface to parse the traditional resolv.conf 77 file and more advanced, DNS-specific configuration file for 78 the rest of this package (see the description for the 79 dns.conf file below).</p></li> 80<li><p>As part of the IRS library, newly implemented standard 81 address-name mapping functions, getaddrinfo() and 82 getnameinfo(), are provided. They use the DNSSEC-aware 83 validating resolver backend, and could use other advanced 84 features of the BIND 9 libraries such as caching. The 85 getaddrinfo() function resolves both A and AAAA RRs 86 concurrently (when the address family is unspecified).</p></li> 87<li><p>An experimental framework to support other event 88 libraries than BIND 9's internal event task system.</p></li> 89</ul></div> 90<div class="sect2" lang="en"> 91<div class="titlepage"><div><div><h3 class="title"> 92<a name="id2612253"></a>Prerequisite</h3></div></div></div> 93<p>GNU make is required to build the export libraries (other 94 part of BIND 9 can still be built with other types of make). In 95 the reminder of this document, "make" means GNU make. Note that 96 in some platforms you may need to invoke a different command name 97 than "make" (e.g. "gmake") to indicate it's GNU make.</p> 98</div> 99<div class="sect2" lang="en"> 100<div class="titlepage"><div><div><h3 class="title"> 101<a name="id2612263"></a>Compilation</h3></div></div></div> 102<pre class="screen"> 103$ <strong class="userinput"><code>./configure --enable-exportlib <em class="replaceable"><code>[other flags]</code></em></code></strong> 104$ <strong class="userinput"><code>make</code></strong> 105</pre> 106<p> 107 This will create (in addition to usual BIND 9 programs) and a 108 separate set of libraries under the lib/export directory. For 109 example, <code class="filename">lib/export/dns/libdns.a</code> is the archive file of the 110 export version of the BIND 9 DNS library. Sample application 111 programs using the libraries will also be built under the 112 lib/export/samples directory (see below).</p> 113</div> 114<div class="sect2" lang="en"> 115<div class="titlepage"><div><div><h3 class="title"> 116<a name="id2612288"></a>Installation</h3></div></div></div> 117<pre class="screen"> 118$ <strong class="userinput"><code>cd lib/export</code></strong> 119$ <strong class="userinput"><code>make install</code></strong> 120</pre> 121<p> 122 This will install library object files under the directory 123 specified by the --with-export-libdir configure option (default: 124 EPREFIX/lib/bind9), and header files under the directory 125 specified by the --with-export-includedir configure option 126 (default: PREFIX/include/bind9). 127 Root privilege is normally required. 128 "<span><strong class="command">make install</strong></span>" at the top directory will do the 129 same. 130 </p> 131<p> 132 To see how to build your own 133 application after the installation, see 134 <code class="filename">lib/export/samples/Makefile-postinstall.in</code>.</p> 135</div> 136<div class="sect2" lang="en"> 137<div class="titlepage"><div><div><h3 class="title"> 138<a name="id2612455"></a>Known Defects/Restrictions</h3></div></div></div> 139<div class="itemizedlist"><ul type="disc"> 140<li><p>Currently, win32 is not supported for the export 141 library. (Normal BIND 9 application can be built as 142 before).</p></li> 143<li> 144<p>The "fixed" RRset order is not (currently) supported in 145 the export library. If you want to use "fixed" RRset order 146 for, e.g. <span><strong class="command">named</strong></span> while still building the 147 export library even without the fixed order support, build 148 them separately: 149 </p> 150<pre class="screen"> 151$ <strong class="userinput"><code>./configure --enable-fixed-rrset <em class="replaceable"><code>[other flags, but not --enable-exportlib]</code></em></code></strong> 152$ <strong class="userinput"><code>make</code></strong> 153$ <strong class="userinput"><code>./configure --enable-exportlib <em class="replaceable"><code>[other flags, but not --enable-fixed-rrset]</code></em></code></strong> 154$ <strong class="userinput"><code>cd lib/export</code></strong> 155$ <strong class="userinput"><code>make</code></strong> 156</pre> 157<p> 158 </p> 159</li> 160<li><p>The client module and the IRS library currently do not 161 support DNSSEC validation using DLV (the underlying modules 162 can handle it, but there is no tunable interface to enable 163 the feature).</p></li> 164<li><p>RFC 5011 is not supported in the validating stub 165 resolver of the export library. In fact, it is not clear 166 whether it should: trust anchors would be a system-wide 167 configuration which would be managed by an administrator, 168 while the stub resolver will be used by ordinary applications 169 run by a normal user.</p></li> 170<li><p>Not all common <code class="filename">/etc/resolv.conf</code> 171 options are supported 172 in the IRS library. The only available options in this 173 version are "debug" and "ndots".</p></li> 174</ul></div> 175</div> 176<div class="sect2" lang="en"> 177<div class="titlepage"><div><div><h3 class="title"> 178<a name="id2612532"></a>The dns.conf File</h3></div></div></div> 179<p>The IRS library supports an "advanced" configuration file 180 related to the DNS library for configuration parameters that 181 would be beyond the capability of the 182 <code class="filename">resolv.conf</code> file. 183 Specifically, it is intended to provide DNSSEC related 184 configuration parameters. By default the path to this 185 configuration file is <code class="filename">/etc/dns.conf</code>. 186 This module is very 187 experimental and the configuration syntax or library interfaces 188 may change in future versions. Currently, only the 189 <span><strong class="command">trusted-keys</strong></span> 190 statement is supported, whose syntax is the same as the same name 191 of statement for <code class="filename">named.conf</code>. (See 192 <a href="Bv9ARM.ch06.html#trusted-keys" title="trusted-keys Statement Grammar">the section called “<span><strong class="command">trusted-keys</strong></span> Statement Grammar”</a> for details.)</p> 193</div> 194<div class="sect2" lang="en"> 195<div class="titlepage"><div><div><h3 class="title"> 196<a name="id2612558"></a>Sample Applications</h3></div></div></div> 197<p>Some sample application programs using this API are 198 provided for reference. The following is a brief description of 199 these applications. 200 </p> 201<div class="sect3" lang="en"> 202<div class="titlepage"><div><div><h4 class="title"> 203<a name="id2612567"></a>sample: a simple stub resolver utility</h4></div></div></div> 204<p> 205 It sends a query of a given name (of a given optional RR type) to a 206 specified recursive server, and prints the result as a list of 207 RRs. It can also act as a validating stub resolver if a trust 208 anchor is given via a set of command line options.</p> 209<p> 210 Usage: sample [options] server_address hostname 211 </p> 212<p> 213 Options and Arguments: 214 </p> 215<div class="variablelist"><dl> 216<dt><span class="term"> 217 -t RRtype 218 </span></dt> 219<dd><p> 220 specify the RR type of the query. The default is the A RR. 221 </p></dd> 222<dt><span class="term"> 223 [-a algorithm] [-e] -k keyname -K keystring 224 </span></dt> 225<dd> 226<p> 227 specify a command-line DNS key to validate the answer. For 228 example, to specify the following DNSKEY of example.com: 229</p> 230<div class="literallayout"><p><br> 231����������������example.com.�3600�IN�DNSKEY�257�3�5�xxx<br> 232</p></div> 233<p> 234 specify the options as follows: 235</p> 236<pre class="screen"> 237<strong class="userinput"><code> 238 -e -k example.com -K "xxx" 239</code></strong> 240</pre> 241<p> 242 -e means that this key is a zone's "key signing key" (as known 243 as "secure Entry point"). 244 When -a is omitted rsasha1 will be used by default. 245 </p> 246</dd> 247<dt><span class="term"> 248 -s domain:alt_server_address 249 </span></dt> 250<dd><p> 251 specify a separate recursive server address for the specific 252 "domain". Example: -s example.com:2001:db8::1234 253 </p></dd> 254<dt><span class="term">server_address</span></dt> 255<dd><p> 256 an IP(v4/v6) address of the recursive server to which queries 257 are sent. 258 </p></dd> 259<dt><span class="term">hostname</span></dt> 260<dd><p> 261 the domain name for the query 262 </p></dd> 263</dl></div> 264</div> 265<div class="sect3" lang="en"> 266<div class="titlepage"><div><div><h4 class="title"> 267<a name="id2612658"></a>sample-async: a simple stub resolver, working asynchronously</h4></div></div></div> 268<p> 269 Similar to "sample", but accepts a list 270 of (query) domain names as a separate file and resolves the names 271 asynchronously.</p> 272<p> 273 Usage: sample-async [-s server_address] [-t RR_type] input_file</p> 274<p> 275 Options and Arguments: 276 </p> 277<div class="variablelist"><dl> 278<dt><span class="term"> 279 -s server_address 280 </span></dt> 281<dd> 282 an IPv4 address of the recursive server to which queries are sent. 283 (IPv6 addresses are not supported in this implementation) 284 </dd> 285<dt><span class="term"> 286 -t RR_type 287 </span></dt> 288<dd> 289 specify the RR type of the queries. The default is the A 290 RR. 291 </dd> 292<dt><span class="term"> 293 input_file 294 </span></dt> 295<dd> 296 a list of domain names to be resolved. each line 297 consists of a single domain name. Example: 298 <div class="literallayout"><p><br> 299��www.example.com<br> 300��mx.example.net<br> 301��ns.xxx.example<br> 302</p></div> 303</dd> 304</dl></div> 305</div> 306<div class="sect3" lang="en"> 307<div class="titlepage"><div><div><h4 class="title"> 308<a name="id2612711"></a>sample-request: a simple DNS transaction client</h4></div></div></div> 309<p> 310 It sends a query to a specified server, and 311 prints the response with minimal processing. It doesn't act as a 312 "stub resolver": it stops the processing once it gets any 313 response from the server, whether it's a referral or an alias 314 (CNAME or DNAME) that would require further queries to get the 315 ultimate answer. In other words, this utility acts as a very 316 simplified <span><strong class="command">dig</strong></span>. 317 </p> 318<p> 319 Usage: sample-request [-t RRtype] server_address hostname 320 </p> 321<p> 322 Options and Arguments: 323 </p> 324<div class="variablelist"><dl> 325<dt><span class="term"> 326 -t RRtype 327 </span></dt> 328<dd><p> 329 specify the RR type of 330 the queries. The default is the A RR. 331 </p></dd> 332<dt><span class="term"> 333 server_address 334 </span></dt> 335<dd><p> 336 an IP(v4/v6) 337 address of the recursive server to which the query is sent. 338 </p></dd> 339<dt><span class="term"> 340 hostname 341 </span></dt> 342<dd><p> 343 the domain name for the query 344 </p></dd> 345</dl></div> 346</div> 347<div class="sect3" lang="en"> 348<div class="titlepage"><div><div><h4 class="title"> 349<a name="id2612775"></a>sample-gai: getaddrinfo() and getnameinfo() test code</h4></div></div></div> 350<p> 351 This is a test program 352 to check getaddrinfo() and getnameinfo() behavior. It takes a 353 host name as an argument, calls getaddrinfo() with the given host 354 name, and calls getnameinfo() with the resulting IP addresses 355 returned by getaddrinfo(). If the dns.conf file exists and 356 defines a trust anchor, the underlying resolver will act as a 357 validating resolver, and getaddrinfo()/getnameinfo() will fail 358 with an EAI_INSECUREDATA error when DNSSEC validation fails. 359 </p> 360<p> 361 Usage: sample-gai hostname 362 </p> 363</div> 364<div class="sect3" lang="en"> 365<div class="titlepage"><div><div><h4 class="title"> 366<a name="id2612790"></a>sample-update: a simple dynamic update client program</h4></div></div></div> 367<p> 368 It accepts a single update command as a 369 command-line argument, sends an update request message to the 370 authoritative server, and shows the response from the server. In 371 other words, this is a simplified <span><strong class="command">nsupdate</strong></span>. 372 </p> 373<p> 374 Usage: sample-update [options] (add|delete) "update data" 375 </p> 376<p> 377 Options and Arguments: 378 </p> 379<div class="variablelist"><dl> 380<dt><span class="term"> 381 -a auth_server 382 </span></dt> 383<dd><p> 384 An IP address of the authoritative server that has authority 385 for the zone containing the update name. This should normally 386 be the primary authoritative server that accepts dynamic 387 updates. It can also be a secondary server that is configured 388 to forward update requests to the primary server. 389 </p></dd> 390<dt><span class="term"> 391 -k keyfile 392 </span></dt> 393<dd><p> 394 A TSIG key file to secure the update transaction. The keyfile 395 format is the same as that for the nsupdate utility. 396 </p></dd> 397<dt><span class="term"> 398 -p prerequisite 399 </span></dt> 400<dd><p> 401 A prerequisite for the update (only one prerequisite can be 402 specified). The prerequisite format is the same as that is 403 accepted by the nsupdate utility. 404 </p></dd> 405<dt><span class="term"> 406 -r recursive_server 407 </span></dt> 408<dd><p> 409 An IP address of a recursive server that this utility will 410 use. A recursive server may be necessary to identify the 411 authoritative server address to which the update request is 412 sent. 413 </p></dd> 414<dt><span class="term"> 415 -z zonename 416 </span></dt> 417<dd><p> 418 The domain name of the zone that contains 419 </p></dd> 420<dt><span class="term"> 421 (add|delete) 422 </span></dt> 423<dd><p> 424 Specify the type of update operation. Either "add" or "delete" 425 must be specified. 426 </p></dd> 427<dt><span class="term"> 428 "update data" 429 </span></dt> 430<dd><p> 431 Specify the data to be updated. A typical example of the data 432 would look like "name TTL RRtype RDATA". 433 </p></dd> 434</dl></div> 435<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 436<h3 class="title">Note</h3>In practice, either -a or -r must be specified. Others can 437 be optional; the underlying library routine tries to identify the 438 appropriate server and the zone name for the update.</div> 439<p> 440 Examples: assuming the primary authoritative server of the 441 dynamic.example.com zone has an IPv6 address 2001:db8::1234, 442 </p> 443<pre class="screen"> 444$ <strong class="userinput"><code>sample-update -a sample-update -k Kxxx.+nnn+mmmm.key add "foo.dynamic.example.com 30 IN A 192.168.2.1"</code></strong></pre> 445<p> 446 adds an A RR for foo.dynamic.example.com using the given key. 447 </p> 448<pre class="screen"> 449$ <strong class="userinput"><code>sample-update -a sample-update -k Kxxx.+nnn+mmmm.key delete "foo.dynamic.example.com 30 IN A"</code></strong></pre> 450<p> 451 removes all A RRs for foo.dynamic.example.com using the given key. 452 </p> 453<pre class="screen"> 454$ <strong class="userinput"><code>sample-update -a sample-update -k Kxxx.+nnn+mmmm.key delete "foo.dynamic.example.com"</code></strong></pre> 455<p> 456 removes all RRs for foo.dynamic.example.com using the given key. 457 </p> 458</div> 459<div class="sect3" lang="en"> 460<div class="titlepage"><div><div><h4 class="title"> 461<a name="id2613536"></a>nsprobe: domain/name server checker in terms of RFC 4074</h4></div></div></div> 462<p> 463 It checks a set 464 of domains to see the name servers of the domains behave 465 correctly in terms of RFC 4074. This is included in the set of 466 sample programs to show how the export library can be used in a 467 DNS-related application. 468 </p> 469<p> 470 Usage: nsprobe [-d] [-v [-v...]] [-c cache_address] [input_file] 471 </p> 472<p> 473 Options 474 </p> 475<div class="variablelist"><dl> 476<dt><span class="term"> 477 -d 478 </span></dt> 479<dd><p> 480 run in the "debug" mode. with this option nsprobe will dump 481 every RRs it receives. 482 </p></dd> 483<dt><span class="term"> 484 -v 485 </span></dt> 486<dd><p> 487 increase verbosity of other normal log messages. This can be 488 specified multiple times 489 </p></dd> 490<dt><span class="term"> 491 -c cache_address 492 </span></dt> 493<dd><p> 494 specify an IP address of a recursive (caching) name server. 495 nsprobe uses this server to get the NS RRset of each domain and 496 the A and/or AAAA RRsets for the name servers. The default 497 value is 127.0.0.1. 498 </p></dd> 499<dt><span class="term"> 500 input_file 501 </span></dt> 502<dd><p> 503 a file name containing a list of domain (zone) names to be 504 probed. when omitted the standard input will be used. Each 505 line of the input file specifies a single domain name such as 506 "example.com". In general this domain name must be the apex 507 name of some DNS zone (unlike normal "host names" such as 508 "www.example.com"). nsprobe first identifies the NS RRsets for 509 the given domain name, and sends A and AAAA queries to these 510 servers for some "widely used" names under the zone; 511 specifically, adding "www" and "ftp" to the zone name. 512 </p></dd> 513</dl></div> 514</div> 515</div> 516<div class="sect2" lang="en"> 517<div class="titlepage"><div><div><h3 class="title"> 518<a name="id2613600"></a>Library References</h3></div></div></div> 519<p>As of this writing, there is no formal "manual" of the 520 libraries, except this document, header files (some of them 521 provide pretty detailed explanations), and sample application 522 programs.</p> 523</div> 524</div> 525</div> 526<div class="navfooter"> 527<hr> 528<table width="100%" summary="Navigation footer"> 529<tr> 530<td width="40%" align="left"> 531<a accesskey="p" href="Bv9ARM.ch11.html">Prev</a>�</td> 532<td width="20%" align="center">�</td> 533<td width="40%" align="right">�<a accesskey="n" href="Bv9ARM.ch13.html">Next</a> 534</td> 535</tr> 536<tr> 537<td width="40%" align="left" valign="top">Appendix�C.�General <acronym class="acronym">DNS</acronym> Reference Information�</td> 538<td width="20%" align="center"><a accesskey="h" href="Bv9ARM.html">Home</a></td> 539<td width="40%" align="right" valign="top">�Manual pages</td> 540</tr> 541</table> 542</div> 543<p style="text-align: center;">BIND 9.10.2-P4</p> 544</body> 545</html> 546