dnstt-server.1 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. .\" https://man.openbsd.org/mdoc.7
  2. .Dd 2020-08-30
  3. .Dt DNSTT-SERVER 1
  4. .Os
  5. .Sh NAME
  6. .Nm dnstt-server
  7. .Nd DNS tunnel server
  8. .Sh SYNOPSIS
  9. .Nm
  10. .Fl gen-key
  11. .Op Fl privkey-file Ar FILENAME
  12. .Op Fl pubkey-file Ar FILENAME
  13. .Nm
  14. .Fl udp Ar ADDR : Ns Ar PORT
  15. .Op Fl privkey Ar HEX | Fl privkey-file Ar FILENAME
  16. .Op Fl mtu Ar MTU
  17. .Ar DOMAIN
  18. .Ar UPSTREAMADDR : Ns Ar UPSTREAMPORT
  19. .Sh DESCRIPTION
  20. .Nm
  21. is the server portion of a DNS tunnel.
  22. It receives DNS over UDP messages at
  23. .Ar ADDR : Ns Ar PORT ,
  24. decodes the streams they contain,
  25. and forwards the streams as TCP connections to
  26. .Ar UPSTREAMADDR : Ns Ar UPSTREAMPORT .
  27. .Nm acts as the authoritative name server for
  28. .Ar DOMAIN
  29. and communicates with an instance of
  30. .Xr dnstt-client 1
  31. via a recursive resolver.
  32. .Ss GENERATING A SERVER KEYPAIR
  33. The tunnel client
  34. encrypts and authenticates the tunneled connection
  35. using the server's public key.
  36. To generate a server keypair, use the
  37. .Fl gen-key
  38. option.
  39. Use the
  40. .Fl privkey-file
  41. and
  42. .Fl pubkey-file
  43. options to save the generated private key,
  44. public key, or both,
  45. to a file.
  46. .Bl -tag
  47. .It Fl gen-key
  48. Generate a server keypair.
  49. .It Fl privkey-file Ar FILENAME
  50. With
  51. .Fl gen-key ,
  52. save the generated private key to
  53. .Ar FILENAME .
  54. .It Fl pubkey-file Ar FILENAME
  55. With
  56. .Fl gen-key ,
  57. save the generated public key to
  58. .Ar FILENAME .
  59. .El
  60. .Pp
  61. On the server, you only need to store the private key, because
  62. .Nm
  63. can derive the public key from the private key.
  64. The client only needs to have the server's public key
  65. and should not know the servers private key.
  66. .Ss RUNNING THE SERVER
  67. The required
  68. .Fl udp
  69. option specifies the UDP address on which
  70. .Nm
  71. listens for incoming DNS messages.
  72. .Bl -tag
  73. .It Fl udp Ar ADDR : Ns Ar PORT
  74. Accept DNS messages at the given address.
  75. .Ar PORT
  76. must typically be 53
  77. when operating with a recursive intermediate resolver,
  78. unless you have made some other provision for forwarding
  79. port 53 to
  80. .Ar PORT .
  81. .El
  82. .Pp
  83. Specify the server's persistent keypair using the
  84. .Fl privkey
  85. or
  86. .Fl privkey-file
  87. options.
  88. If you do not use one of these options,
  89. .Nm
  90. generates a temporary keypair
  91. and logs the public key to standard error.
  92. .Bl -tag
  93. .It Fl privkey Ar HEX
  94. .Ar HEX
  95. is a string of 64 hexadecimal digits.
  96. .It Fl privkey-file Ar FILENAME
  97. .Ar FILENAME
  98. is the name of a file containing
  99. 64 hexadecimal digits and an
  100. optional training newline character.
  101. .El
  102. .Pp
  103. In some situations, you may have to use the
  104. .Fl mtu
  105. option to control the maximum UDP payload size.
  106. .Bl -tag
  107. .It Fl mtu Ar MTU
  108. Never send UDP payloads larger than
  109. .Ar MTU
  110. bytes.
  111. The default
  112. .Ar MTU
  113. is 1232, but some recursive resolver only support a maximum of 512.
  114. You will know you need to use the
  115. .Fl mtu
  116. option when you see messages like this on standard error:
  117. .Dl FORMERR: requester payload size 512 is too small (minimum 1232)
  118. .El
  119. .Sh EXAMPLES
  120. Generate a keypair.
  121. Save the private key to the file
  122. .Cm server.key
  123. and the public key to
  124. .Cm server.pub .
  125. Next, you would typically copy
  126. .Pa server.pub
  127. to the client.
  128. .Bd -literal -offset indent
  129. dnstt-server -gen-key -privkey-file server.key -pubkey-file server.pub
  130. .Ed
  131. .Pp
  132. Accept DNS messages at the UDP address
  133. .Cm 0.0.0.0:53 ,
  134. decode the streams contained therein,
  135. and forward the streams as TCP connections to
  136. .Cm 127.0.0.1:8000 .
  137. Read the private key from the file
  138. .Cm server.key
  139. and derive the public key from it.
  140. The server should be configured to be
  141. the authoritative name server for the domain
  142. .Cm t.example.com .
  143. .Bd -literal -offset indent
  144. dnstt-server -udp 127.0.0.1:53 -privkey-file server.key t.example.com 127.0.0.1:8000
  145. .Ed
  146. .Sh DIAGNOSTICS
  147. .Nm
  148. writes running logs to standard error.
  149. At startup,
  150. .Nm
  151. logs its public key.
  152. This string can be used with the
  153. .Fl -pubkey
  154. option in
  155. .Xr dnstt-client 1 .
  156. .Dl pubkey 14ca15f53660e248d289d9302f992c4bee518f2361d6343dafa7b417b5a3d752
  157. .Pp
  158. At startup,
  159. .Nm
  160. logs the amount of useful payload capacity that can be stored
  161. in each DNS response, after accounting for the overhead of encoding.
  162. This number will vary depending on the length of
  163. .Ar DOMAIN
  164. and the value of
  165. .Ar MTU .
  166. .Dl effective MTU 932
  167. .Pp
  168. If the recursive resolver's stated maximum UDP payload size
  169. is smaller than
  170. .Ar MTU ,
  171. .Nm
  172. will log a message like this,
  173. which tells you that you need to use the
  174. .Fl mtu
  175. option.
  176. .Dl FORMERR: requester payload size 512 is too small (minimum 1232)
  177. .Sh SEE ALSO
  178. .Xr dnstt-client 1
  179. .Lk https://www.bamsoftware.com/software/dnstt/
  180. .Sh AUTHORS
  181. .An David Fifield Aq Mt [email protected]