faq.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>The pdnsd FAQ</title>
  5. <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1">
  6. <style type="text/css">
  7. <!--
  8. .small { font-family:helvetica; font-size:small; text-align:center; }
  9. // -->
  10. </style>
  11. </head>
  12. <body bgcolor="#EEEEEE">
  13. <!--notext(-->
  14. <table width="100%">
  15. <tr>
  16. <td> <span class="small">
  17. <a href="index.html">pdnsd Homepage</a>
  18. </span></td>
  19. <td> <span class="small">
  20. <a href="faq.html">pdnsd FAQ</a>
  21. </span></td>
  22. <td> <span class="small">
  23. <a href="doc.html">Documentation</a>
  24. </span></td>
  25. <td> <span class="small">
  26. <a href="../../COPYING">GNU GPL (pdnsd's License)</a>
  27. </span> </td>
  28. <td><span class="small">
  29. <a href="dl.html">Download Section</a>
  30. </span></td>
  31. </tr>
  32. </table>
  33. <!--)notext-->
  34. <h1>The pdnsd FAQ</h1>
  35. <a name="q001"></a>
  36. <table width="100%" cellspacing=1 cellpadding=7>
  37. <tr>
  38. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  39. <td bgcolor="#CCFFFF">
  40. There are complete and well-tested name servers around, such as the BIND.
  41. These do also perform caching. Why should I use pdnsd?
  42. </td>
  43. </tr>
  44. <tr>
  45. <td bgcolor="#FFCCFF"><b>A:</b></td>
  46. <td bgcolor="#DDFFEE">
  47. pdnsd does not aim to be a complete name server implementation, such as the
  48. BIND. It is optimized for caching, and you can only specify a small subset of all
  49. dns record types pdnsd knows in your local &quot;zone&quot; definitions.
  50. This of course reduces the code size drastically, and such the memory footprint.
  51. There are some features especially interesting for dialin networks, ordinary
  52. (non-server) internet hosts and computers that are often not connected to
  53. to their network, e.g. notebooks (I originally wrote this program for use
  54. with my notebook).
  55. These features are:
  56. <ul>
  57. <li> permanent disk cache (useful for frequent power-offs/reboots)
  58. <li> usually smaller memory footprint (depends on cache size) (see next question)
  59. <li> offline-detection prevents hangs (e.g. the typical hang on startup of some
  60. Netscape Navigator versions if not dialled in)
  61. <li> better control about timeouts (also to prevent hangs)
  62. <li> better control over the cache
  63. <li> better run-time control
  64. </ul>
  65. </td>
  66. </tr>
  67. </table>
  68. <hr>
  69. <a name="q002"></a>
  70. <table width="100%" cellspacing=1 cellpadding=7>
  71. <tr>
  72. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  73. <td bgcolor="#CCFFFF">
  74. When I look at the process size with ps, top, gtop, or a similar tool, I see
  75. some processes with a total size well above 3.5 MB. This is much more than
  76. e.g. BIND named (about 1.4 MB). Why?
  77. </td>
  78. </tr>
  79. <tr>
  80. <td bgcolor="#FFCCFF"><b>A:</b></td>
  81. <td bgcolor="#DDFFEE">
  82. Really, it is not.
  83. pdnsd uses multithreading, not multiprocessing. That means that the processes
  84. share most of their process space. In the LinuxThreads library
  85. or NPTL (Native Posix Thread Libary),
  86. which are used by pdnsd on Linux, in fact the total process address space is shared
  87. (although the processes have different stacks, these are in one process
  88. address space). You may check this by looking at the at the process sizes of
  89. the pdnsd threads: all should be the same. The effective size that pdnsd
  90. occupies is thus the size of any of the processes, not the sum of those.
  91. So, pdnsd with empty cache occupies about 800 kB, and the maximum size
  92. should be about the cache size plus this size (in fact, ca 5-10% more).
  93. </td>
  94. </tr>
  95. </table>
  96. <hr>
  97. <a name="q003"></a>
  98. <table width="100%" cellspacing=1 cellpadding=7>
  99. <tr>
  100. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  101. <td bgcolor="#CCFFFF">
  102. What do I need the status control (option -s) for?
  103. </td>
  104. </tr>
  105. <tr>
  106. <td bgcolor="#FFCCFF"><b>A:</b></td>
  107. <td bgcolor="#DDFFEE">
  108. It enables you to do some things you might or might not need. With it, you can:
  109. <ul>
  110. <li> query pdnsd's settings at runtime to debug configuration files and
  111. see which servers are regarded to be available
  112. <li> mark servers as available or unavailable, or force a status retest - very
  113. handy if you want to control which servers pdnsd queries, e.g for muliple
  114. dial-up accounts
  115. <li> delete, invalidate or add DNS records - useful e.g. when you want to build
  116. records for dynamically assigned IP addresses or domain names
  117. <li> reload pdnsd's configuration file without restarting pdnsd
  118. <li> print information about the contents of pdnsd's cache.
  119. </ul>
  120. </td>
  121. </tr>
  122. </table>
  123. <hr>
  124. <a name="q004"></a>
  125. <table width="100%" cellspacing=1 cellpadding=7>
  126. <tr>
  127. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  128. <td bgcolor="#CCFFFF">
  129. What do I need local records (rr- and source-sections in the config file) for?
  130. </td>
  131. </tr>
  132. <tr>
  133. <td bgcolor="#FFCCFF"><b>A:</b></td>
  134. <td bgcolor="#DDFFEE">
  135. Some resolver programs, e.g. nslookup, want to look up the name of the
  136. server they are using before doing anything else. This option is for defining
  137. a PTR record for your IP such that those programs get an answer even if the
  138. name server you are caching is not available or does not offer these records.
  139. By extension, you may also define A and SOA records. This allows you to build
  140. very small zones without having to use a &quot;big&quot; name server. It is NOT
  141. intended to replace such a complete server in anything but VERY small
  142. networks. Alternatively, you may start a named on another host or on the
  143. same host on another port and cache it with pdnsd in addition to other (more
  144. distant) name servers.
  145. <br>
  146. The <code>source</code> section allows you to let pdnsd read in your
  147. <code>/etc/hosts</code> file on startup and serve its contents. This file is used by your local
  148. resolver before it even tries the name servers and usually contains
  149. fully-qualified domain names (FQDNs) for all of the internet addresses your host has.
  150. If you source this file, you usually won't need any additional <code>rr</code> sections. Sourcing it also allows
  151. other hosts (eg. in your local network) to access the names defined in your
  152. hosts file. You can of course just add other hosts in your local network to the
  153. servers <code>hosts</code> file, thus making them known to your server's resolver
  154. and pdnsd (if you sourced that file).
  155. <br>
  156. If you don't know what this answer was all about, you should just take the
  157. source section in the sample config file that comes with pdnsd, copy it
  158. into your config file and forget about it.
  159. </td>
  160. </tr>
  161. </table>
  162. <hr>
  163. <a name="q005"></a>
  164. <table width="100%" cellspacing=1 cellpadding=7>
  165. <tr>
  166. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  167. <td bgcolor="#CCFFFF">
  168. When compiling, I get an error message like <br><i>Please define __BYTE_ORDER to
  169. be __LITTLE_ENDIAN or __BIG_ENDIAN</i><br> What's up?
  170. </td>
  171. </tr>
  172. <tr>
  173. <td bgcolor="#FFCCFF"><b>A:</b></td>
  174. <td bgcolor="#DDFFEE">
  175. Normally, this macros should be defined in your C library's header files.
  176. There are two different methods, most C libraries support both (and pdnsd
  177. honors both): either <code>__BYTE_ORDER</code> is set to <code>__LITTLE_ENDIAN</code>
  178. or <code>__BIG_ENDIAN</code>, or <code>__LITTLE_ENDIAN</code> or <code>__BIG_ENDIAN</code>
  179. are directly defined as macros.
  180. <br>
  181. Linux glibc, for example, does set those macros correctly. Never mind. You just have to know
  182. whether your machine is little-endian or big-endian, this means wheter your
  183. machine saves the least significant byte of a word or double-word first in memory (little-endian) or
  184. the most significant first (big-endian).
  185. All intel x86 and Alpha machines are little-endian, for example, while SPARC
  186. and PowerPC architectures are big-endian.
  187. If your machine is little-endian, add the following line to your config.h:
  188. <br><code>
  189. #define __BYTE_ORDER __LITTLE_ENDIAN
  190. </code><br>
  191. Likewise, if your machines byte order is big-endian:
  192. <br><code>
  193. #define __BYTE_ORDER __BIG_ENDIAN
  194. </code><br>
  195. Pathological byte orders like pdp-endian are not yet supported really;
  196. However, for the place the endianess is needed, <code>__LITTLE_ENDIAN</code> should do
  197. (it deals only with 16 bits; for all other occurances, ntoh[sl]/hton[sl] is used).
  198. </td>
  199. </tr>
  200. </table>
  201. <hr>
  202. <a name="q007"></a>
  203. <table width="100%" cellspacing=1 cellpadding=7>
  204. <tr>
  205. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  206. <td bgcolor="#CCFFFF">
  207. At startup, I get a warning saying:<br>
  208. <i>
  209. Uptest command [...] will implicitly be executed as root
  210. </i> <br>
  211. What does that mean?
  212. </td>
  213. </tr>
  214. <tr>
  215. <td bgcolor="#FFCCFF"><b>A:</b></td>
  216. <td bgcolor="#DDFFEE">
  217. This warning only occurs if you use the <code>uptest=exec</code> option in your
  218. configuration. It means that the uptest command is run as root
  219. because pdnsd is running as root, and this was not explicitely specified.
  220. The idea is that it may introduce security holes (in the programs being run)
  221. when they run as root, and so they shouldn't do that if possible.
  222. You can specify the user that shall run the command by appending its name
  223. comma-separated as string to the <code>uptest_cmd</code> line: <br>
  224. <code>
  225. uptest_cmd=&quot;&lt;your command&gt;&quot;,&quot;&lt;user&gt;&quot;;
  226. </code> <br>
  227. If it is correctly running as root, just append the user string <code>&quot;root&quot;</code> to
  228. the command and the warning will not occur again.
  229. </td>
  230. </tr>
  231. </table>
  232. <hr>
  233. <a name="q008"></a>
  234. <table width="100%" cellspacing=1 cellpadding=7>
  235. <tr>
  236. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  237. <td bgcolor="#CCFFFF">
  238. I cannot run my <code>uptest_cmd</code> command as root (it says <i>permission denied</i>),
  239. although the pdnsd executable is setuid root. Why?
  240. </td>
  241. </tr>
  242. <tr>
  243. <td bgcolor="#FFCCFF"><b>A:</b></td>
  244. <td bgcolor="#DDFFEE">
  245. pdnsd will drop privileges gained through setuid/setgid before executing the
  246. uptest commands (you shouldn't set the pdnsd executable setuid/setgid anyway).
  247. The reason is clear: if you install the pdnsd
  248. executable as setuid root and this wouln't be done, any user could execute
  249. shellcode with root privileges using that option!
  250. </td>
  251. </tr>
  252. </table>
  253. <hr>
  254. <a name="q009"></a>
  255. <table width="100%" cellspacing=1 cellpadding=7>
  256. <tr>
  257. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  258. <td bgcolor="#CCFFFF">
  259. At startup, I get an error saying:<br>
  260. <i>
  261. Bad config file permissions: the file must be only writeable by the user
  262. </i><br>
  263. Why is that?
  264. </td>
  265. </tr>
  266. <tr>
  267. <td bgcolor="#FFCCFF"><b>A:</b></td>
  268. <td bgcolor="#DDFFEE">
  269. pdnsd has an option (<code>uptest=exec</code>) that allows the execution of arbitrary
  270. shell code (for testing whether an interface is up). This must be
  271. of course secured against unauthorized use. One of these
  272. protection is the one that produces the error message: if you routinely run
  273. pdnsd, e.g. at system startup, and your config file is editable for others,
  274. someone could change it and insert shell code that is executed in the next
  275. pdnsd run -- with your user privileges! To prevent this, pdnsd will exit if the config file is writeable
  276. by others than the owner.
  277. To get rid of this message, just do <br>
  278. <code>
  279. chmod go-w &lt;filename&gt;
  280. </code><br>
  281. on your config
  282. file (for the default file: <code>chmod go-w /etc/pdnsd.conf</code>).
  283. You should also check that the ownership is set correct.
  284. </td>
  285. </tr>
  286. </table>
  287. <hr>
  288. <a name="q010"></a>
  289. <table width="100%" cellspacing=1 cellpadding=7>
  290. <tr>
  291. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  292. <td bgcolor="#CCFFFF">
  293. <code>serve_aliases</code> does not seem to work.
  294. </td>
  295. </tr>
  296. <tr>
  297. <td bgcolor="#FFCCFF"><b>A:</b></td>
  298. <td bgcolor="#DDFFEE">
  299. Some resolvers (e.g. of the glibc 2.1) seem sometimes not to look up unmodified names, but the names with
  300. an entry of the search path already appended. Since pdnsd will serve short names with this
  301. option anyway, you can delete the search an domain options from your /etc/resolv.conf. This is reported to
  302. work in some cases.
  303. </td>
  304. </tr>
  305. </table>
  306. <hr>
  307. <a name="q011"></a>
  308. <table width="100%" cellspacing=1 cellpadding=7>
  309. <tr>
  310. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  311. <td bgcolor="#CCFFFF">
  312. Some queries for domains that have many records (e.g. www.gmx.de) fail mysteriously.
  313. </td>
  314. </tr>
  315. <tr>
  316. <td bgcolor="#FFCCFF"><b>A:</b></td>
  317. <td bgcolor="#DDFFEE">
  318. pdnsd versions prior to 1.1.0 had the tcp server thread disabled by default. Most resolvers
  319. repeat their query using tcp when they receive a truncated answer (the answer is truncated
  320. when it exceeds a length of 512 bytes). You need to recompile pdnsd with the option
  321. <code>--enable-tcp-server</code> to fix this.
  322. </td>
  323. </tr>
  324. </table>
  325. <hr>
  326. <a name="q012"></a>
  327. <table width="100%" cellspacing=1 cellpadding=7>
  328. <tr>
  329. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  330. <td bgcolor="#CCFFFF">
  331. I am behind some kind of firewall. In the configuration file
  332. I have only listed addresses of name servers on the local (ISP's) network,
  333. but pdnsd is slow and DNS queries frequently time out.
  334. </td>
  335. </tr>
  336. <tr>
  337. <td bgcolor="#FFCCFF"><b>A:</b></td>
  338. <td bgcolor="#DDFFEE">
  339. In some cases pdnsd will not consider the answer of the local name server
  340. authoritative enough, and will try to get answers from the name servers listed in the
  341. authority section of the reply message. If pdnsd is behind a firewall that blocks the
  342. UDP reply packets from remote name servers, pdnsd will wait in vain for a reply.
  343. One solution is to set <a href="doc.html#proxyonly"><code>proxy_only=on</code></a>
  344. in the servers sections of the configuration file.
  345. This will prevent pdnsd from querying name servers that are not listed in the configuration
  346. file.
  347. Another solution that can be tried is specifying
  348. <a href="doc.html#querymethod"><code>query_method=tcp_only</code></a>
  349. in the global section of the configuration file, because a firewall that blocks
  350. UDP packets from outside might still allow outgoing TCP connections to port 53.
  351. </td>
  352. </tr>
  353. </table>
  354. <hr>
  355. <a name="q013"></a>
  356. <table width="100%" cellspacing=1 cellpadding=7>
  357. <tr>
  358. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  359. <td bgcolor="#CCFFFF">
  360. Is pdnsd vulnerable to DNS cache poisoning as described in
  361. <a href="http://www.kb.cert.org/vuls/id/800113">CERT vulnerability note VU#800113</a>?
  362. </td>
  363. </tr>
  364. <tr>
  365. <td bgcolor="#FFCCFF"><b>A:</b></td>
  366. <td bgcolor="#DDFFEE">
  367. Short answer: Yes.<br>
  368. Somewhat longer answer: The problem is not so much that pdnsd's implementation is flawed
  369. but rather that the DNS protocol currently being used is fundamentally flawed from
  370. a security viewpoint. As long as a more secure protocol is not in place,
  371. all that the developers of pdnsd can do is to try to tweak the current implementation
  372. to make it as difficult as possible for an attacker to succeed.<br>
  373. From version 1.2.7 onwards, the default for the <code>query_port_start</code> option
  374. is 1024, which means that the pdnsd resolver will randomly select source ports
  375. in the range 1024-65535. (In previous versions the default was to let the kernel select
  376. the source ports, which will often result in a more or less predictable sequence of ports.)
  377. It also helps to use a good quality source of random numbers. On platforms where this is
  378. supported, it is preferable to configure with <code>--with-random-device=/dev/urandom</code>.
  379. There is still more that can be done to make pdnsd less vulnerable, but this remains
  380. (as of this writing) a work in progress.
  381. <br>
  382. Please note that pdnsd was designed for small (private) networks, and that it is generally
  383. not recommended to let untrusted users access pdnsd.
  384. </td>
  385. </tr>
  386. </table>
  387. <!--<hr>
  388. <a name="q014"></a>
  389. <table width="100%" cellspacing=1 cellpadding=7>
  390. <tr>
  391. <td bgcolor="#FFCCFF"><b>Q:</b></td>
  392. <td bgcolor="#CCFFFF">
  393. </td>
  394. </tr>
  395. <tr>
  396. <td bgcolor="#FFCCFF"><b>A:</b></td>
  397. <td bgcolor="#DDFFEE">
  398. </td>
  399. </tr>
  400. </table>-->
  401. <hr>
  402. <address><a href="mailto:tmoestl@gmx.net">Thomas Moestl</a>
  403. and <a href="mailto:p.a.rombouts@home.nl">Paul Rombouts</a>
  404. </address>
  405. <br>
  406. <p>
  407. <i>Last revised: 18 August 2008 by Paul Rombouts</i>
  408. </p>
  409. </body>
  410. </html>