summary refs log tree commit diff
path: root/doc/dnsfunneld.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/dnsfunneld.html')
-rw-r--r--doc/dnsfunneld.html107
1 files changed, 76 insertions, 31 deletions
diff --git a/doc/dnsfunneld.html b/doc/dnsfunneld.html
index 006a6d6..5181db1 100644
--- a/doc/dnsfunneld.html
+++ b/doc/dnsfunneld.html
@@ -3,9 +3,9 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <meta http-equiv="Content-Language" content="en" />
-    <title>dnsfunnel: the dnsfunnel-daemon program</title>
-    <meta name="Description" content="dnsfunnel: the dnsfunnel-daemon program" />
-    <meta name="Keywords" content="dnsfunnel daemon /etc/resolv.conf local cache resolver 127.0.0.1" />
+    <title>dnsfunnel: the dnsfunneld program</title>
+    <meta name="Description" content="dnsfunnel: the dnsfunneld program" />
+    <meta name="Keywords" content="dnsfunnel daemon dnsfunneld /etc/resolv.conf local cache resolver 127.0.0.1" />
     <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
   </head>
 <body>
@@ -29,19 +29,25 @@ queries, the responses, or both.
 <h2> Interface </h2>
 
 <pre>
-     dnsfunneld [ -v verbosity ] [ -d notif ] [ -o ops ] cachelist
+     dnsfunneld [ -v <em>verbosity</em> ] [ -1 ] [ -U | -u <em>uid</em> -g <em>gid</em> ] [ -i <em>ip</em>:<em>port</em> ] [ -R <em>root</em> ] [ -b <em>bufsize</em> ] [ -T | -t ] [ -N | -n ]
 </pre>
 
 <ul>
- <li> dnsfunneld reads the <em>cachelist</em> file, expecting to find
+ <li> dnsfunneld creates a UDP inet domain socket and binds it
+to IPv4 address <em>ip</em> (normally 127.0.0.1) and port <em>port</em>
+(normally 53). </li>
+ <li> Depending on the options it has been given, it may chroot and lose
+privileges on its gid and uid. </li>
+ <li> It reads the <tt>caches</tt> file (relative to its current
+directory, which is either the directory it has been run from or, if
+requested, the one it has chrooted into), expecting to find
 a list of IP (v4 or v6) addresses, one per line. These addresses are the
 DNS caches it will forward the queries to. </li>
- <li> dnsfunneld expects to have a bound UDP inet domain socket as
-its standard input. It expects to receive packets no more than 512
+ <li> dnsfunneld expects to receive packets no more than 512
 bytes long, only containing DNS normal queries (QUERY) for the IN
-class. </li>
- <li> Depending on <em>ops</em>, dnsfunneld may send additional queries
-to the caches listed in <em>cachelist</em>. It handles the answers
+class, on its socket. </li>
+ <li> Depending on options, dnsfunneld may send additional queries
+to the caches listed in <tt>caches</tt>. It handles the answers
 internally: the additional queries are invisible to clients. </li>
  <li> dnsfunneld is a long-lived process. </li>
 </ul>
@@ -49,7 +55,7 @@ internally: the additional queries are invisible to clients. </li>
 <h2> Signals </h2>
 
 <ul>
- <li> SIGHUP: read the <em>cachelist</em> file again, updating its
+ <li> SIGHUP: read the <tt>caches</tt> file again, updating its
 in-memory cache list. In-flight queries are still handled by the old
 list; the new list will only apply for queries arriving after the SIGHUP. </li>
  <li> SIGTERM: enter lame-duck mode, do not accept any more queries. When
@@ -70,20 +76,51 @@ all in-flight queries have been answered, exit 0.
  <li> <tt>-v&nbsp;<em>verbosity</em></tt>&nbsp;: verbosity.
 Default is 1. 0 suppresses warning messages. Higher values may give more
 informational messages in the future. </li>
- <li> <tt>-d&nbsp;<em>notif</em></tt>&nbsp;: readiness notification. When
-dnsfunneld is ready to process queries, write a newline to file descriptor
-<em>notif</em>. <em>notif</em> must be 3 or greater. Default is no notification
-at all. </li>
- <li> <tt>-o&nbsp;<em>ops</em></tt>&nbsp;: perform various operations on
-queries. <em>ops</em> is a decimal integer that is treated as a bitfield.
-Default is 0. Operations are listed below. </li>
+ <li> <tt>-1</tt>&nbsp;: readiness notification. When
+dnsfunneld is ready to process queries, write a newline to stdout, then
+close it. Default is no notification at all. </li>
+ <li> <tt>-U</tt>&nbsp;: read an uid in the UID environment variable and a gid
+in the GID environment variable, and drop privileges to that uid/gid. </li>
+ <li> <tt>-u&nbsp;<em>uid</em></tt>&nbsp;: drop privileges to numerical uid
+<em>uid</em>. </li>
+ <li> <tt>-g&nbsp;<em>gid</em></tt>&nbsp;: drop privileges to numerical gid
+<em>gid</em>. </li>
+ <li> <tt>-i&nbsp;<em>ip</em>:<em>port</em></tt>&nbsp;: bind the socket to
+IPv4 <em>ip</em> and port <em>port</em>. Default for <em>ip</em> is
+<tt>127.0.0.1</tt>; default for <em>port</em> is 53. </li>
+ <li> <tt>-R&nbsp;<em>root</em></tt>&nbsp;: chroot to <em>root</em>. Default
+is <tt>/run/dnsfunnel/root</tt>. Note that chrooting only increases security
+if privileges are also dropped via the <tt>-U</tt> or <tt>-u</tt> and <tt>-g</tt>
+options. Chrooting is only supported on platforms that have the <tt>chroot()</tt>
+primitive. You can also disable it by passing an empty string as the argument
+to <tt>-R</tt>. </li>
+ <li> <tt>-b&nbsp;<em>bufsize</em></tt>&nbsp;: try and reserve a kernel buffer
+size of <em>bufsize</em> bytes for the socket. The default is whatever the
+default is for your kernel. </li>
+</ul>
+
+<p>
+ The other options control the activation or deactivation of various
+features. See below for the detail of operations.
+</p>
+
+<ul>
+ <li> <tt>-T</tt>&nbsp;: Do not activate truncation of responses. This is
+the default. </li>
+ <li> <tt>-t</tt>&nbsp;: If a DNS response is bigger than 510 bytes,
+truncate its last resource records until it fits into 510 bytes and can
+be sent in a UDP packet. </li>
+ <li> <tt>-N</tt>&nbsp;: Do not activate NXDOMAIN workaround. This is the
+default. </li>
+ <li> <tt>-n</tt>&nbsp;: Activate NXDOMAIN workaround. </li>
+ <li> Other options may be added in the future. </li>
 </ul>
 
 <h2> DNS forwarding behaviour </h2>
 
 <ul>
  <li> When it receives a query, dnsfunneld forwards it to the first DNS cache
-in the list it has read from the <em>cachelist</em> file. </li>
+in the list it has read from the <tt>caches</tt> file. </li>
  <li> If it receives a response with the TC bit, it resends the query over TCP. </li>
  <li> If it receives a suitable response within a given time frame, it forwards
 it to the client. </li>
@@ -112,29 +149,37 @@ time to resolve; </li>
 <h2> dnsfunneld operations </h2>
 
 <p>
- <em>ops</em> is an integer used as a bitfield. Depending on which bits are set,
-various operations are performed on queries or answers, slightly modifying the
-behaviour described above.
+ Depending on the options it has been given, dnsfunneld may perform the
+following operations on the queries or responses it receives:
 </p>
 
-<ul>
- <li> bit 0: activate truncation. If a DNS response is more than 510 bytes
+<h3> Truncation </h3>
+
+<p>
+ If a DNS response is more than 510 bytes
 long, dnsfunneld will truncate the <em>last</em> resource records in the response,
 until it fits into 510 bytes and can be given to the client in a UDP packet.
 The structure of a DNS packet makes it so the RRs are listed in order of
 decreasing importance, so keeping as many RRs as will fit in 510 bytes
-without reordering them is the natural way of truncating a response. </li>
- <li> bit 1: activate workaround for some servers that incorrectly report
-NXDOMAIN when they're asked for an AAAA record, and no such record exists
-for the domain but an A record exists. When that bit is set in <em>ops</em>,
-for every A or AAAA query dnsfunneld receives and forwards, it also sends
+without reordering them is the natural way of truncating a response.
+</p>
+
+<h3> NXDOMAIN workaround </h3>
+
+<p>
+ Some DNS servers incorrectly answer NXDOMAIN when
+they should just answer NODATA, and querying for another, existing, record
+type for the same domain allows dnsfunneld to tell the difference between a
+real NXDOMAIN.
+ When that operation is requested, for every A or AAAA query dnsfunneld
+receives and forwards, it also sends
 an additional AAAA or A query for the same domain. If the main query returns
 NXDOMAIN, dnsfunneld waits for the response to the auxiliary query: if this
 response is not NXDOMAIN, then dnsfunneld answers NODATA to the client instead
 of NXDOMAIN. Be aware that activating this workaround can practically double
 the number of queries sent to the DNS caches, and may cause additional delays
-before the clients get their answers. </li>
-</ul>
+before the clients get their answers.
+</p>
 
 <h2> Notes </h2>