tinc.texi 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996
  1. \input texinfo @c -*-texinfo-*-
  2. @c $Id: tinc.texi,v 1.8.4.39 2003/07/21 19:58:58 guus Exp $
  3. @c %**start of header
  4. @setfilename tinc.info
  5. @settitle tinc Manual
  6. @setchapternewpage odd
  7. @c %**end of header
  8. @ifinfo
  9. @dircategory Networking tools
  10. @direntry
  11. * tinc: (tinc). The tinc Manual.
  12. @end direntry
  13. This is the info manual for tinc, a Virtual Private Network daemon.
  14. Copyright @copyright{} 1998-2003 Ivo Timmermans
  15. <ivo@@o2w.nl>, Guus Sliepen <guus@@sliepen.eu.org> and
  16. Wessel Dankers <wsl@@nl.linux.org>.
  17. $Id: tinc.texi,v 1.8.4.39 2003/07/21 19:58:58 guus Exp $
  18. Permission is granted to make and distribute verbatim copies of this
  19. manual provided the copyright notice and this permission notice are
  20. preserved on all copies.
  21. Permission is granted to copy and distribute modified versions of this
  22. manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25. @end ifinfo
  26. @titlepage
  27. @title tinc Manual
  28. @subtitle Setting up a Virtual Private Network with tinc
  29. @author Ivo Timmermans and Guus Sliepen
  30. @page
  31. @vskip 0pt plus 1filll
  32. @cindex copyright
  33. Copyright @copyright{} 1998-2003 Ivo Timmermans
  34. <ivo@@o2w.nl>, Guus Sliepen <guus@@sliepen.eu.org> and
  35. Wessel Dankers <wsl@@nl.linux.org>.
  36. $Id: tinc.texi,v 1.8.4.39 2003/07/21 19:58:58 guus Exp $
  37. Permission is granted to make and distribute verbatim copies of this
  38. manual provided the copyright notice and this permission notice are
  39. preserved on all copies.
  40. Permission is granted to copy and distribute modified versions of this
  41. manual under the conditions for verbatim copying, provided that the
  42. entire resulting derived work is distributed under the terms of a
  43. permission notice identical to this one.
  44. @end titlepage
  45. @c ==================================================================
  46. @node Top, Introduction, (dir), (dir)
  47. @menu
  48. * Introduction:: Introduction
  49. * Preparations::
  50. * Installation::
  51. * Configuration::
  52. * Running tinc::
  53. * Technical information::
  54. * About us::
  55. * Concept Index:: All used terms explained
  56. @end menu
  57. @contents
  58. @c ==================================================================
  59. @node Introduction, Preparations, Top, Top
  60. @chapter Introduction
  61. @cindex tinc
  62. tinc is a Virtual Private Network (VPN) daemon that uses tunneling and
  63. encryption to create a secure private network between hosts on the
  64. Internet.
  65. Because the tunnel appears to the IP level network code as a normal
  66. network device, there is no need to adapt any existing software.
  67. The encrypted tunnels allows VPN sites to share information with each other
  68. over the Internet without exposing any information to others.
  69. This document is the manual for tinc. Included are chapters on how to
  70. configure your computer to use tinc, as well as the configuration
  71. process of tinc itself.
  72. @menu
  73. * VPNs:: Virtual Private Networks in general
  74. * tinc:: about tinc
  75. * Supported platforms::
  76. @end menu
  77. @c ==================================================================
  78. @node VPNs, tinc, Introduction, Introduction
  79. @section Virtual Private Networks
  80. @cindex VPN
  81. A Virtual Private Network or VPN is a network that can only be accessed
  82. by a few elected computers that participate. This goal is achievable in
  83. more than just one way.
  84. @cindex private
  85. Private networks can consist of a single stand-alone Ethernet LAN. Or
  86. even two computers hooked up using a null-modem cable. In these cases,
  87. it is
  88. obvious that the network is @emph{private}, no one can access it from the
  89. outside. But if your computers are linked to the Internet, the network
  90. is not private anymore, unless one uses firewalls to block all private
  91. traffic. But then, there is no way to send private data to trusted
  92. computers on the other end of the Internet.
  93. @cindex virtual
  94. This problem can be solved by using @emph{virtual} networks. Virtual
  95. networks can live on top of other networks, but they use encapsulation to
  96. keep using their private address space so they do not interfere with
  97. the Internet. Mostly, virtual networks appear like a singe LAN, even though
  98. they can span the entire world. But virtual networks can't be secured
  99. by using firewalls, because the traffic that flows through it has to go
  100. through the Internet, where other people can look at it.
  101. As is the case with either type of VPN, anybody could eavesdrop. Or
  102. worse, alter data. Hence it's probably advisable to encrypt the data
  103. that flows over the network.
  104. When one introduces encryption, we can form a true VPN. Other people may
  105. see encrypted traffic, but if they don't know how to decipher it (they
  106. need to know the key for that), they cannot read the information that flows
  107. through the VPN. This is what tinc was made for.
  108. @c ==================================================================
  109. @node tinc, Supported platforms, VPNs, Introduction
  110. @section tinc
  111. @cindex vpnd
  112. I really don't quite remember what got us started, but it must have been
  113. Guus' idea. He wrote a simple implementation (about 50 lines of C) that
  114. used the ethertap device that Linux knows of since somewhere
  115. about kernel 2.1.60. It didn't work immediately and he improved it a
  116. bit. At this stage, the project was still simply called @samp{vpnd}.
  117. Since then, a lot has changed---to say the least.
  118. @cindex tincd
  119. tinc now supports encryption, it consists of a single daemon (tincd) for
  120. both the receiving and sending end, it has become largely
  121. runtime-configurable---in short, it has become a full-fledged
  122. professional package.
  123. @cindex Traditional VPNs
  124. @cindex scalability
  125. tinc also allows more than two sites to connect to eachother and form a single VPN.
  126. Traditionally VPNs are created by making tunnels, which only have two endpoints.
  127. Larger VPNs with more sites are created by adding more tunnels.
  128. tinc takes another approach: only endpoints are specified,
  129. the software itself will take care of creating the tunnels.
  130. This allows for easier configuration and improved scalability.
  131. A lot can---and will be---changed. We have a number of things that we would like to
  132. see in the future releases of tinc. Not everything will be available in
  133. the near future. Our first objective is to make tinc work perfectly as
  134. it stands, and then add more advanced features.
  135. Meanwhile, we're always open-minded towards new ideas. And we're
  136. available too.
  137. @c ==================================================================
  138. @node Supported platforms, , tinc, Introduction
  139. @section Supported platforms
  140. @cindex platforms
  141. tinc has been verified to work under Linux, FreeBSD, OpenBSD, NetBSD, MacOS/X (Darwin), Solaris, and Windows (in a Cygwin environment),
  142. with various hardware architectures. These are some of the platforms
  143. that are supported by the universal tun/tap device driver or other virtual network device drivers.
  144. Without such a driver, tinc will most
  145. likely compile and run, but it will not be able to send or receive data
  146. packets.
  147. @cindex release
  148. For an up to date list of supported platforms, please check the list on
  149. our website:
  150. @uref{http://tinc.nl.linux.org/platforms}.
  151. @c ==================================================================
  152. @subsection Linux
  153. @cindex Linux
  154. tinc was first written for Linux running on an intel x86 processor, so
  155. this is the best supported platform. The protocol however, and actually
  156. anything about tinc, has been rewritten to support random byte ordering
  157. and arbitrary word length. So in theory it should run on other
  158. processors that Linux runs on. It has already been verified to run on
  159. alpha and sparc processors as well.
  160. tinc uses the ethertap device or the universal tun/tap driver. The former is provided in the standard kernel
  161. from version 2.1.60 up to 2.3.x, but has been replaced in favour of the tun/tap driver in kernel versions 2.4.0 and later.
  162. @c ==================================================================
  163. @subsection FreeBSD
  164. @cindex FreeBSD
  165. tinc on FreeBSD relies on the universal tun/tap driver for its data
  166. acquisition from the kernel. Therefore, tinc will work on the same platforms
  167. as this driver. These are: FreeBSD 3.x, 4.x, 5.x.
  168. @c ==================================================================
  169. @subsection OpenBSD
  170. @cindex OpenBSD
  171. tinc on OpenBSD relies on the tun driver for its data
  172. acquisition from the kernel. It has been verified to work under at least OpenBSD 2.9.
  173. Tunneling IPv6 packets may not work on OpenBSD.
  174. @c ==================================================================
  175. @subsection Solaris
  176. @c ==================================================================
  177. @subsection NetBSD
  178. @cindex NetBSD
  179. tinc on NetBSD relies on the tun driver for its data
  180. acquisition from the kernel. It has been verified to work under at least NetBSD 1.5.2.
  181. Tunneling IPv6 does not work on OpenBSD.
  182. @c ==================================================================
  183. @subsection Solaris
  184. @cindex Solaris
  185. tinc on Solaris relies on the universal tun/tap driver for its data
  186. acquisition from the kernel. Therefore, tinc will work on the same platforms
  187. as this driver. These are: Solaris 8 (SunOS 5.8).
  188. IPv6 packets cannot be tunneled on Solaris.
  189. @c ==================================================================
  190. @subsection Darwin (MacOS/X)
  191. @cindex Darwin
  192. @cindex MacOS/X
  193. tinc on Darwin relies on the tunnel driver for its data
  194. acquisition from the kernel. This driver is not part of Darwin but can be
  195. downloaded from @uref{http://chrisp.de/en/projects/tunnel.html}.
  196. IPv6 packets cannot be tunneled on Darwin.
  197. @c ==================================================================
  198. @subsection Cygwin (Windows)
  199. @cindex Cygwin
  200. @cindex Windows
  201. tinc on Windows, in a Cygwin environment, relies on the CIPE driver for its data
  202. acquisition from the kernel. This driver is not part of Windows but can be
  203. downloaded from @uref{http://cipe-win32.sourceforge.net/}.
  204. @c
  205. @c
  206. @c
  207. @c
  208. @c
  209. @c
  210. @c Preparing your system
  211. @c
  212. @c
  213. @c
  214. @c
  215. @c
  216. @c ==================================================================
  217. @node Preparations, Installation, Introduction, Top
  218. @chapter Preparations
  219. This chapter contains information on how to prepare your system to
  220. support tinc.
  221. @menu
  222. * Configuring the kernel::
  223. * Libraries::
  224. @end menu
  225. @c ==================================================================
  226. @node Configuring the kernel, Libraries, Preparations, Preparations
  227. @section Configuring the kernel
  228. @cindex RedHat
  229. @cindex Debian
  230. @cindex netlink_dev
  231. @cindex tun
  232. @cindex ethertap
  233. If you are running Linux, chances are good that your kernel already supports
  234. all the devices that tinc needs for proper operation. For example, the
  235. standard kernel from Redhat Linux already has support for ethertap and netlink
  236. compiled in. Debian users can use the modconf utility to select the modules.
  237. If your Linux distribution supports this method of selecting devices, look out
  238. for something called `ethertap', and `netlink_dev' if it is using a kernel
  239. version prior to 2.4.0. In that case you will need both these devices. If you
  240. are using kernel 2.4.0 or later, you need to select `tun'.
  241. @cindex Kernel-HOWTO
  242. If you can install these devices in a similar manner, you may skip this section.
  243. Otherwise, you will have to recompile the kernel in order to turn on the required features.
  244. If you are unfamiliar with the process of configuring and compiling a new kernel,
  245. you should read the @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel HOWTO} first.
  246. @menu
  247. * Configuration of Linux kernels 2.1.60 up to 2.4.0::
  248. * Configuration of Linux kernels 2.4.0 and higher::
  249. * Configuration of FreeBSD kernels::
  250. * Configuration of OpenBSD kernels::
  251. * Configuration of NetBSD kernels::
  252. * Configuration of Solaris kernels::
  253. * Configuration of Darwin (MacOS/X) kernels::
  254. * Configuration of Cygwin (Windows)::
  255. @end menu
  256. @c ==================================================================
  257. @node Configuration of Linux kernels 2.1.60 up to 2.4.0, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel, Configuring the kernel
  258. @subsection Configuration of Linux kernels 2.1.60 up to 2.4.0
  259. Here are the options you have to turn on when configuring a new kernel:
  260. @example
  261. Code maturity level options
  262. [*] Prompt for development and/or incomplete code/drivers
  263. Networking options
  264. [*] Kernel/User netlink socket
  265. <M> Netlink device emulation
  266. Network device support
  267. <M> Ethertap network tap
  268. @end example
  269. If you want to run more than one instance of tinc or other programs that use
  270. the ethertap, you have to compile the ethertap driver as a module, otherwise
  271. you can also choose to compile it directly into the kernel.
  272. If you decide to build any of these as dynamic kernel modules, it's a good idea
  273. to add these lines to @file{/etc/modules.conf}:
  274. @example
  275. alias char-major-36 netlink_dev
  276. alias tap0 ethertap
  277. options tap0 -o tap0 unit=0
  278. alias tap1 ethertap
  279. options tap1 -o tap1 unit=1
  280. ...
  281. alias tap@emph{N} ethertap
  282. options tap@emph{N} -o tap@emph{N} unit=@emph{N}
  283. @end example
  284. Add as much alias/options lines as necessary.
  285. @c ==================================================================
  286. @node Configuration of Linux kernels 2.4.0 and higher, Configuration of FreeBSD kernels, Configuration of Linux kernels 2.1.60 up to 2.4.0, Configuring the kernel
  287. @subsection Configuration of Linux kernels 2.4.0 and higher
  288. Here are the options you have to turn on when configuring a new kernel:
  289. @example
  290. Code maturity level options
  291. [*] Prompt for development and/or incomplete code/drivers
  292. Network device support
  293. <M> Universal tun/tap device driver support
  294. @end example
  295. It's not necessary to compile this driver as a module, even if you are going to
  296. run more than one instance of tinc.
  297. If you have an early 2.4 kernel, you can choose both the tun/tap driver and the
  298. `Ethertap network tap' device. This latter is marked obsolete, and chances are
  299. that it won't even function correctly anymore. Make sure you select the
  300. universal tun/tap driver.
  301. If you decide to build the tun/tap driver as a kernel module, add these lines
  302. to @file{/etc/modules.conf}:
  303. @example
  304. alias char-major-10-200 tun
  305. @end example
  306. @c ==================================================================
  307. @node Configuration of FreeBSD kernels, Configuration of OpenBSD kernels, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel
  308. @subsection Configuration of FreeBSD kernels
  309. This section will contain information on how to configure your FreeBSD
  310. kernel to support the universal tun/tap device. For 4.1 and higher
  311. versions, this is included in the default kernel configuration, for earlier
  312. systems (4.0 and earlier), you need to install the universal tun/tap driver
  313. yourself.
  314. Unfortunately somebody still has to write the text.
  315. @c ==================================================================
  316. @node Configuration of OpenBSD kernels, Configuration of NetBSD kernels, Configuration of FreeBSD kernels, Configuring the kernel
  317. @subsection Configuration of OpenBSD kernels
  318. This section will contain information on how to configure your OpenBSD
  319. kernel to support the tun device. For 2.9 and 3.0 systems,
  320. this is included in the default kernel configuration.
  321. Unfortunately somebody still has to write the text.
  322. @c ==================================================================
  323. @node Configuration of NetBSD kernels, Configuration of Solaris kernels, Configuration of OpenBSD kernels, Configuring the kernel
  324. @subsection Configuration of NetBSD kernels
  325. This section will contain information on how to configure your NetBSD
  326. kernel to support the tun device. For 1.5.2 systems,
  327. this is included in the default kernel configuration.
  328. Unfortunately somebody still has to write the text.
  329. @c ==================================================================
  330. @node Configuration of Solaris kernels, Configuration of Darwin (MacOS/X) kernels, Configuration of NetBSD kernels, Configuring the kernel
  331. @subsection Configuration of Solaris kernels
  332. This section will contain information on how to configure your Solaris
  333. kernel to support the universal tun/tap device. For Solaris 8 (SunOS 5.8),
  334. this is included in the default kernel configuration.
  335. Unfortunately somebody still has to write the text.
  336. @c ==================================================================
  337. @node Configuration of Darwin (MacOS/X) kernels, Configuration of Cygwin (Windows), Configuration of Solaris kernels, Configuring the kernel
  338. @subsection Configuration of Darwin (MacOS/X) kernels
  339. Darwin does not come with a tunnel driver. You must download it at
  340. @uref{http://chrisp.de/en/projects/tunnel.html}. If compiling the source fails,
  341. try the binary module. The tunnel driver must be loaded before starting tinc
  342. with the following command:
  343. @example
  344. kmodload tunnel
  345. @end example
  346. Once loaded, the tunnel driver will automatically create @file{/dev/tun0}..@file{/dev/tun3}
  347. and the corresponding network interfaces.
  348. @c ==================================================================
  349. @node Configuration of Cygwin (Windows), , Configuration of Darwin (MacOS/X) kernels, Configuring the kernel
  350. @subsection Configuration of Cygwin (Windows)
  351. If Cygwin hasn't already been installed, install it directly from
  352. @uref{http://www.cygwin.com/}. You will also need to install the
  353. CIPE driver, you can download it from @uref{http://cipe-win32.sourceforge.net}.
  354. Configure the CIPE network device in the same way as you would do from the tinc-up script.
  355. @c ==================================================================
  356. @node Libraries, , Configuring the kernel, Preparations
  357. @section Libraries
  358. @cindex requirements
  359. @cindex libraries
  360. Before you can configure or build tinc, you need to have the OpenSSL,
  361. zlib and lzo libraries installed on your system. If you try to configure tinc without
  362. having them installed, configure will give you an error message, and stop.
  363. @menu
  364. * OpenSSL::
  365. * zlib::
  366. * lzo::
  367. @end menu
  368. @c ==================================================================
  369. @node OpenSSL, zlib, Libraries, Libraries
  370. @subsection OpenSSL
  371. @cindex OpenSSL
  372. For all cryptography-related functions, tinc uses the functions provided
  373. by the OpenSSL library.
  374. If this library is not installed, you wil get an error when configuring
  375. tinc for build. Support for running tinc without having OpenSSL
  376. installed @emph{may} be added in the future.
  377. You can use your operating system's package manager to install this if
  378. available. Make sure you install the development AND runtime versions
  379. of this package.
  380. If you have to install OpenSSL manually, you can get the source code
  381. from @url{http://www.openssl.org/}. Instructions on how to configure,
  382. build and install this package are included within the package. Please
  383. make sure you build development and runtime libraries (which is the
  384. default).
  385. If you installed the OpenSSL libraries from source, it may be necessary
  386. to let configure know where they are, by passing configure one of the
  387. --with-openssl-* parameters.
  388. @example
  389. --with-openssl=DIR OpenSSL library and headers prefix
  390. --with-openssl-include=DIR OpenSSL headers directory
  391. (Default is OPENSSL_DIR/include)
  392. --with-openssl-lib=DIR OpenSSL library directory
  393. (Default is OPENSSL_DIR/lib)
  394. @end example
  395. @subsubheading License
  396. @cindex license
  397. Since the license under which OpenSSL is distributed is not directly
  398. compatible with the terms of the GNU GPL
  399. @uref{http://www.openssl.org/support/faq.html#LEGAL2}, therefore we
  400. include an addition to the GPL (see also the file COPYING.README):
  401. @quotation
  402. This program is released under the GPL with the additional exemption
  403. that compiling, linking, and/or using OpenSSL is allowed. You may
  404. provide binary packages linked to the OpenSSL libraries, provided that
  405. all other requirements of the GPL are met.
  406. @end quotation
  407. @c ==================================================================
  408. @node zlib, lzo, OpenSSL, Libraries
  409. @subsection zlib
  410. @cindex zlib
  411. For the optional compression of UDP packets, tinc uses the functions provided
  412. by the zlib library.
  413. If this library is not installed, you wil get an error when configuring
  414. tinc for build. Support for running tinc without having zlib
  415. installed @emph{may} be added in the future.
  416. You can use your operating system's package manager to install this if
  417. available. Make sure you install the development AND runtime versions
  418. of this package.
  419. If you have to install zlib manually, you can get the source code
  420. from @url{http://www.gzip.org/zlib/}. Instructions on how to configure,
  421. build and install this package are included within the package. Please
  422. make sure you build development and runtime libraries (which is the
  423. default).
  424. @c ==================================================================
  425. @node lzo, , zlib, Libraries
  426. @subsection lzo
  427. @cindex lzo
  428. Another form of compression is offered using the lzo library.
  429. If this library is not installed, you wil get an error when configuring
  430. tinc for build. Support for running tinc without having lzo
  431. installed @emph{may} be added in the future.
  432. You can use your operating system's package manager to install this if
  433. available. Make sure you install the development AND runtime versions
  434. of this package.
  435. If you have to install lzo manually, you can get the source code
  436. from @url{http://www.oberhumer.com/opensource/lzo/}. Instructions on how to configure,
  437. build and install this package are included within the package. Please
  438. make sure you build development and runtime libraries (which is the
  439. default).
  440. @c
  441. @c
  442. @c
  443. @c Installing tinc
  444. @c
  445. @c
  446. @c
  447. @c
  448. @c ==================================================================
  449. @node Installation, Configuration, Preparations, Top
  450. @chapter Installation
  451. If you use Debian, you may want to install one of the
  452. precompiled packages for your system. These packages are equipped with
  453. system startup scripts and sample configurations.
  454. If you cannot use one of the precompiled packages, or you want to compile tinc
  455. for yourself, you can use the source. The source is distributed under
  456. the GNU General Public License (GPL). Download the source from the
  457. @uref{http://tinc.nl.linux.org/download, download page}, which has
  458. the checksums of these files listed; you may wish to check these with
  459. md5sum before continuing.
  460. tinc comes in a convenient autoconf/automake package, which you can just
  461. treat the same as any other package. Which is just untar it, type
  462. `./configure' and then `make'.
  463. More detailed instructions are in the file @file{INSTALL}, which is
  464. included in the source distribution.
  465. @menu
  466. * Building and installing tinc::
  467. * System files::
  468. @end menu
  469. @c ==================================================================
  470. @node Building and installing tinc, System files, Installation, Installation
  471. @section Building and installing tinc
  472. Detailed instructions on configuring the source, building tinc and installing tinc
  473. can be found in the file called @file{INSTALL}.
  474. @cindex binary package
  475. If you happen to have a binary package for tinc for your distribution,
  476. you can use the package management tools of that distribution to install tinc.
  477. The documentation that comes along with your distribution will tell you how to do that.
  478. @menu
  479. * Darwin (MacOS/X) build environment::
  480. @end menu
  481. @c ==================================================================
  482. @node Darwin (MacOS/X) build environment, , , Building and installing tinc
  483. @subsection Darwin (MacOS/X) build environment
  484. In order to build tinc on Darwin, you need to install the MacOS/X Developer Tools
  485. from @uref{http://developer.apple.com/tools/macosxtools.html} and
  486. a recent version of Fink from @uref{http://fink.sourceforge.net/}.
  487. After installation use fink to download and install the following packages:
  488. autoconf25, automake, dlcompat, m4, openssl, zlib and lzo.
  489. @c ==================================================================
  490. @node System files, , Building and installing tinc, Installation
  491. @section System files
  492. Before you can run tinc, you must make sure you have all the needed
  493. files on your system.
  494. @menu
  495. * Device files::
  496. * Other files::
  497. @end menu
  498. @c ==================================================================
  499. @node Device files, Other files, System files, System files
  500. @subsection Device files
  501. @cindex device files
  502. First, you'll need the special device file(s) that form the interface
  503. between the kernel and the daemon.
  504. The permissions for these files have to be such that only the super user
  505. may read/write to this file. You'd want this, because otherwise
  506. eavesdropping would become a bit too easy. This does, however, imply
  507. that you'd have to run tincd as root.
  508. If you use Linux and have a kernel version prior to 2.4.0, you have to make the
  509. ethertap devices:
  510. @example
  511. mknod -m 600 /dev/tap0 c 36 16
  512. mknod -m 600 /dev/tap1 c 36 17
  513. ...
  514. mknod -m 600 /dev/tap@emph{N} c 36 @emph{N+16}
  515. @end example
  516. There is a maximum of 16 ethertap devices.
  517. If you use the universal tun/tap driver, you have to create the
  518. following device file (unless it already exist):
  519. @example
  520. mknod -m 600 /dev/tun c 10 200
  521. @end example
  522. If you use Linux, and you run the new 2.4 kernel using the devfs filesystem,
  523. then the tun/tap device will probably be automatically generated as
  524. @file{/dev/net/tun}.
  525. Unlike the ethertap device, you do not need multiple device files if
  526. you are planning to run multiple tinc daemons.
  527. @c ==================================================================
  528. @node Other files, , Device files, System files
  529. @subsection Other files
  530. @subsubheading @file{/etc/networks}
  531. You may add a line to @file{/etc/networks} so that your VPN will get a
  532. symbolic name. For example:
  533. @example
  534. myvpn 10.0.0.0
  535. @end example
  536. @subsubheading @file{/etc/services}
  537. @cindex port numbers
  538. You may add this line to @file{/etc/services}. The effect is that you
  539. may supply a @samp{tinc} as a valid port number to some programs. The
  540. number 655 is registered with the IANA.
  541. @example
  542. tinc 655/tcp TINC
  543. tinc 655/udp TINC
  544. # Ivo Timmermans <ivo@@o2w.nl>
  545. @end example
  546. @c
  547. @c
  548. @c
  549. @c
  550. @c Configuring tinc
  551. @c
  552. @c
  553. @c
  554. @c
  555. @c ==================================================================
  556. @node Configuration, Running tinc, Installation, Top
  557. @chapter Configuration
  558. @menu
  559. * Configuration introduction::
  560. * Multiple networks::
  561. * How connections work::
  562. * Configuration files::
  563. * Generating keypairs::
  564. * Network interfaces::
  565. * Example configuration::
  566. @end menu
  567. @c ==================================================================
  568. @node Configuration introduction, Multiple networks, Configuration, Configuration
  569. @section Configuration introduction
  570. @cindex Network Administrators Guide
  571. Before actually starting to configure tinc and editing files,
  572. make sure you have read this entire section so you know what to expect.
  573. Then, make it clear to yourself how you want to organize your VPN:
  574. What are the nodes (computers running tinc)?
  575. What IP addresses/subnets do they have?
  576. What is the network mask of the entire VPN?
  577. Do you need special firewall rules?
  578. Do you have to set up masquerading or forwarding rules?
  579. These questions can only be answered by yourself,
  580. you will not find the answers in this documentation.
  581. Make sure you have an adequate understanding of networks in general.
  582. A good resource on networking is the
  583. @uref{http://www.linuxdoc.org/LDP/nag2/, Linux Network Administrators Guide}.
  584. If you have everything clearly pictured in your mind,
  585. proceed in the following order:
  586. First, generate the configuration files (@file{tinc.conf}, your host configuration file, @file{tinc-up} and perhaps @file{tinc-down}).
  587. Then generate the keypairs.
  588. Finally, distribute the host configuration files.
  589. These steps are described in the subsections below.
  590. @c ==================================================================
  591. @node Multiple networks, How connections work, Configuration introduction, Configuration
  592. @section Multiple networks
  593. @cindex multiple networks
  594. @cindex netname
  595. In order to allow you to run more than one tinc daemon on one computer,
  596. for instance if your computer is part of more than one VPN,
  597. you can assign a ``netname'' to your VPN.
  598. It is not required if you only run one tinc daemon,
  599. it doesn't even have to be the same on all the sites of your VPN,
  600. but it is recommended that you choose one anyway.
  601. We will asume you use a netname throughout this document.
  602. This means that you call tincd with the -n argument,
  603. which will assign a netname to this daemon.
  604. The effect of this is that the daemon will set its configuration
  605. ``root'' to /etc/tinc/netname/, where netname is your argument to the -n
  606. option. You'll notice that it appears in syslog as ``tinc.netname''.
  607. However, it is not strictly necessary that you call tinc with the -n
  608. option. In this case, the network name would just be empty, and it will
  609. be used as such. tinc now looks for files in /etc/tinc/, instead of
  610. /etc/tinc/netname/; the configuration file should be /etc/tinc/tinc.conf,
  611. and the host configuration files are now expected to be in /etc/tinc/hosts/.
  612. But it is highly recommended that you use this feature of tinc, because
  613. it will be so much clearer whom your daemon talks to. Hence, we will
  614. assume that you use it.
  615. @c ==================================================================
  616. @node How connections work, Configuration files, Multiple networks, Configuration
  617. @section How connections work
  618. When tinc starts up, it parses the command-line options and then
  619. reads in the configuration file tinc.conf.
  620. If it sees one or more `ConnectTo' values pointing to other tinc daemons in that file,
  621. it will try to connect to those other daemons.
  622. Whether this succeeds or not and whether `ConnectTo' is specified or not,
  623. tinc will listen for incoming connection from other deamons.
  624. If you did specify a `ConnectTo' value and the other side is not responding,
  625. tinc will keep retrying.
  626. This means that once started, tinc will stay running until you tell it to stop,
  627. and failures to connect to other tinc daemons will not stop your tinc daemon
  628. for trying again later.
  629. This means you don't have to intervene if there are temporary network problems.
  630. @cindex client
  631. @cindex server
  632. There is no real distinction between a server and a client in tinc.
  633. If you wish, you can view a tinc daemon without a `ConnectTo' value as a server,
  634. and one which does specify such a value as a client.
  635. It does not matter if two tinc daemons have a `ConnectTo' value pointing to each other however.
  636. @c ==================================================================
  637. @node Configuration files, Generating keypairs, How connections work, Configuration
  638. @section Configuration files
  639. The actual configuration of the daemon is done in the file
  640. @file{/etc/tinc/netname/tinc.conf} and at least one other file in the directory
  641. @file{/etc/tinc/netname/hosts/}.
  642. These file consists of comments (lines started with a #) or assignments
  643. in the form of
  644. @example
  645. Variable = Value.
  646. @end example
  647. The variable names are case insensitive, and any spaces, tabs, newlines
  648. and carriage returns are ignored. Note: it is not required that you put
  649. in the `=' sign, but doing so improves readability. If you leave it
  650. out, remember to replace it with at least one space character.
  651. In this section all valid variables are listed in alphabetical order.
  652. The default value is given between parentheses,
  653. other comments are between square brackets and
  654. required directives are given in @strong{bold}.
  655. @menu
  656. * Main configuration variables::
  657. * Host configuration variables::
  658. * How to configure::
  659. @end menu
  660. @c ==================================================================
  661. @node Main configuration variables, Host configuration variables, Configuration files, Configuration files
  662. @subsection Main configuration variables
  663. @table @asis
  664. @cindex AddressFamily
  665. @item AddressFamily = <ipv4|ipv6|any> (any)
  666. This option affects the address family of listening and outgoing sockets.
  667. If "any" is selected, then depending on the operating system
  668. both IPv4 and IPv6 or just IPv6 listening sockets will be created.
  669. @cindex BindToAddress
  670. @item BindToAddress = <address> [experimental]
  671. If your computer has more than one IPv4 or IPv6 address, tinc
  672. will by default listen on all of them for incoming connections.
  673. It is possible to bind only to a single address with this variable.
  674. This option may not work on all platforms.
  675. @cindex BindToInterface
  676. @item BindToInterface = <interface> [experimental]
  677. If you have more than one network interface in your computer, tinc will
  678. by default listen on all of them for incoming connections. It is
  679. possible to bind tinc to a single interface like eth0 or ppp0 with this
  680. variable.
  681. This option may not work on all platforms.
  682. @cindex ConnectTo
  683. @item @strong{ConnectTo = <name>}
  684. Specifies which other tinc daemon to connect to on startup.
  685. Multiple ConnectTo variables may be specified,
  686. in which case outgoing connections to each specified tinc daemon are made.
  687. The names should be known to this tinc daemon
  688. (i.e., there should be a host configuration file for the name on the ConnectTo line).
  689. If you don't specify a host with ConnectTo,
  690. tinc won't try to connect to other daemons at all,
  691. and will instead just listen for incoming connections.
  692. @cindex Device
  693. @item @strong{Device = <device>} (/dev/tap0 or /dev/net/tun)
  694. The virtual network device to use. Note that you can only use one device per
  695. daemon. See also @ref{Device files}.
  696. @cindex Hostnames
  697. @item Hostnames = <yes|no> (no)
  698. This option selects whether IP addresses (both real and on the VPN)
  699. should be resolved. Since DNS lookups are blocking, it might affect
  700. tinc's efficiency, even stopping the daemon for a few seconds everytime
  701. it does a lookup if your DNS server is not responding.
  702. This does not affect resolving hostnames to IP addresses from the
  703. configuration file.
  704. @cindex Interface
  705. @item Interface = <interface>
  706. Defines the name of the interface corresponding to the virtual network device.
  707. Depending on the operating system and the type of device this may or may not actually set the name.
  708. Currently this option only affects the Linux tun/tap device.
  709. @cindex Mode
  710. @item Mode = <router|switch|hub> (router)
  711. This option selects the way packets are routed to other daemons.
  712. @table @asis
  713. @cindex router
  714. @item router
  715. In this mode Subnet
  716. variables in the host configuration files will be used to form a routing table.
  717. Only unicast packets of routable protocols (IPv4 and IPv6) are supported in this mode.
  718. @cindex switch
  719. @item switch
  720. In this mode the MAC addresses of the packets on the VPN will be used to
  721. dynamically create a routing table just like an Ethernet switch does.
  722. Unicast, multicast and broadcast packets of every protocol that runs over Ethernet are supported in this mode
  723. at the cost of frequent broadcast ARP requests and routing table updates.
  724. @cindex hub
  725. @item hub
  726. This mode is almost the same as the switch mode, but instead
  727. every packet will be broadcast to the other daemons
  728. while no routing table is managed.
  729. @end table
  730. @cindex KeyExpire
  731. @item KeyExpire = <seconds> (3600)
  732. This option controls the time the encryption keys used to encrypt the data
  733. are valid. It is common practice to change keys at regular intervals to
  734. make it even harder for crackers, even though it is thought to be nearly
  735. impossible to crack a single key.
  736. @cindex MACExpire
  737. @item MACExpire = <seconds> (600)
  738. This option controls the amount of time MAC addresses are kept before they are removed.
  739. This only has effect when Mode is set to "switch".
  740. @cindex Name
  741. @item @strong{Name = <name>}
  742. This is a symbolic name for this connection. It can be anything
  743. @cindex PingTimeout
  744. @item PingTimeout = <seconds> (60)
  745. The number of seconds of inactivity that tinc will wait before sending a
  746. probe to the other end. If that other end doesn't answer within that
  747. same amount of seconds, the connection is terminated, and the others
  748. will be notified of this.
  749. @cindex PriorityInheritance
  750. @item PriorityInheritance = <yes|no> (no) [experimental]
  751. When this option is enabled the value of the TOS field of tunneled IPv4 packets
  752. will be inherited by the UDP packets that are sent out.
  753. @cindex PrivateKey
  754. @item PrivateKey = <key> [obsolete]
  755. This is the RSA private key for tinc. However, for safety reasons it is
  756. advised to store private keys of any kind in separate files. This prevents
  757. accidental eavesdropping if you are editting the configuration file.
  758. @cindex PrivateKeyFile
  759. @item @strong{PrivateKeyFile = <path>} [recommended]
  760. This is the full path name of the RSA private key file that was
  761. generated by ``tincd --generate-keys''. It must be a full path, not a
  762. relative directory.
  763. Note that there must be exactly one of PrivateKey
  764. or PrivateKeyFile
  765. specified in the configuration file.
  766. @end table
  767. @c ==================================================================
  768. @node Host configuration variables, How to configure, Main configuration variables, Configuration files
  769. @subsection Host configuration variables
  770. @table @asis
  771. @cindex Address
  772. @item @strong{Address = <IP address|hostname>} [recommended]
  773. This variable is only required if you want to connect to this host. It
  774. must resolve to the external IP address where the host can be reached,
  775. not the one that is internal to the VPN.
  776. @cindex Cipher
  777. @item Cipher = <cipher> (blowfish)
  778. The symmetric cipher algorithm used to encrypt UDP packets.
  779. Any cipher supported by OpenSSL is recognized.
  780. @cindex Compression
  781. @item Compression = <level> (0)
  782. This option sets the level of compression used for UDP packets.
  783. Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 (best zlib),
  784. 10 (fast lzo) and 11 (best lzo).
  785. @cindex Digest
  786. @item Digest = <digest> (sha1)
  787. The digest algorithm used to authenticate UDP packets.
  788. Any digest supported by OpenSSL is recognized.
  789. Furthermore, specifying "none" will turn off packet authentication.
  790. @cindex IndirectData
  791. @item IndirectData = <yes|no> (no)
  792. This option specifies whether other tinc daemons besides the one you
  793. specified with ConnectTo can make a direct connection to you. This is
  794. especially useful if you are behind a firewall and it is impossible to
  795. make a connection from the outside to your tinc daemon. Otherwise, it
  796. is best to leave this option out or set it to no.
  797. @cindex MACLength
  798. @item MACLength = <length> (4)
  799. The length of the message authentication code used to authenticate UDP packets.
  800. Can be anything from 0
  801. up to the length of the digest produced by the digest algorithm.
  802. @cindex Port
  803. @item Port = <port> (655)
  804. This is the port this tinc daemon listens on.
  805. You can use decimal portnumbers or symbolic names (as listed in /etc/services).
  806. @cindex PublicKey
  807. @item PublicKey = <key> [obsolete]
  808. This is the RSA public key for this host.
  809. @cindex PublicKeyFile
  810. @item PublicKeyFile = <path> [obsolete]
  811. This is the full path name of the RSA public key file that was generated
  812. by ``tincd --generate-keys''. It must be a full path, not a relative
  813. directory.
  814. @cindex PEM format
  815. From version 1.0pre4 on tinc will store the public key directly into the
  816. host configuration file in PEM format, the above two options then are not
  817. necessary. Either the PEM format is used, or exactly
  818. @strong{one of the above two options} must be specified
  819. in each host configuration file, if you want to be able to establish a
  820. connection with that host.
  821. @cindex Subnet
  822. @item Subnet = <address[/prefixlength]>
  823. The subnet which this tinc daemon will serve.
  824. tinc tries to look up which other daemon it should send a packet to by searching the appropiate subnet.
  825. If the packet matches a subnet,
  826. it will be sent to the daemon who has this subnet in his host configuration file.
  827. Multiple subnet lines can be specified for each daemon.
  828. Subnets can either be single MAC, IPv4 or IPv6 addresses,
  829. in which case a subnet consisting of only that single address is assumed,
  830. or they can be a IPv4 or IPv6 network address with a prefixlength.
  831. Shorthand notations are not supported.
  832. For example, IPv4 subnets must be in a form like 192.168.1.0/24,
  833. where 192.168.1.0 is the network address and 24 is the number of bits set in the netmask.
  834. Note that subnets like 192.168.1.1/24 are invalid!
  835. Read a networking HOWTO/FAQ/guide if you don't understand this.
  836. IPv6 subnets are notated like fec0:0:0:1:0:0:0:0/64.
  837. MAC addresses are notated like 0:1a:2b:3c:4d:5e.
  838. @cindex CIDR notation
  839. prefixlength is the number of bits set to 1 in the netmask part; for
  840. example: netmask 255.255.255.0 would become /24, 255.255.252.0 becomes
  841. /22. This conforms to standard CIDR notation as described in
  842. @uref{ftp://ftp.isi.edu/in-notes/rfc1519.txt, RFC1519}
  843. @cindex TCPonly
  844. @item TCPonly = <yes|no> (no) [experimental]
  845. If this variable is set to yes, then the packets are tunnelled over a
  846. TCP connection instead of a UDP connection. This is especially useful
  847. for those who want to run a tinc daemon from behind a masquerading
  848. firewall, or if UDP packet routing is disabled somehow.
  849. Setting this options also implicitly sets IndirectData.
  850. @end table
  851. @c ==================================================================
  852. @node How to configure, , Host configuration variables, Configuration files
  853. @subsection How to configure
  854. @subsubheading Step 1. Creating the main configuration file
  855. The main configuration file will be called @file{/etc/tinc/netname/tinc.conf}.
  856. Adapt the following example to create a basic configuration file:
  857. @example
  858. Name = @emph{yourname}
  859. Device = @emph{/dev/tap0}
  860. PrivateKeyFile = /etc/tinc/@emph{netname}/rsa_key.priv
  861. @end example
  862. Then, if you know to which other tinc daemon(s) yours is going to connect,
  863. add `ConnectTo' values.
  864. @subsubheading Step 2. Creating your host configuration file
  865. If you added a line containing `Name = yourname' in the main configuarion file,
  866. you will need to create a host configuration file @file{/etc/tinc/netname/hosts/yourname}.
  867. Adapt the following example to create a host configuration file:
  868. @example
  869. Address = @emph{your.real.hostname.org}
  870. Subnet = @emph{192.168.1.0/24}
  871. @end example
  872. You can also use an IP address instead of a hostname.
  873. The `Subnet' specifies the address range that is local for @emph{your part of the VPN only}.
  874. If you have multiple address ranges you can specify more than one `Subnet'.
  875. You might also need to add a `Port' if you want your tinc daemon to run on a different port number than the default (655).
  876. @c ==================================================================
  877. @node Generating keypairs, Network interfaces, Configuration files, Configuration
  878. @section Generating keypairs
  879. @cindex key generation
  880. Now that you have already created the main configuration file and your host configuration file,
  881. you can easily create a public/private keypair by entering the following command:
  882. @example
  883. tincd -n @emph{netname} -K
  884. @end example
  885. tinc will generate a public and a private key and ask you where to put them.
  886. Just press enter to accept the defaults.
  887. @c ==================================================================
  888. @node Network interfaces, Example configuration, Generating keypairs, Configuration
  889. @section Network interfaces
  890. Before tinc can start transmitting data over the tunnel, it must
  891. set up the virtual network interface.
  892. First, decide which IP addresses you want to have associated with these
  893. devices, and what network mask they must have.
  894. tinc will open a virtual network device (@file{/dev/tun}, @file{/dev/tap0} or similar),
  895. which will also create a network interface called something like `tun0', `tap0', or,
  896. if you are using the Linux tun/tap driver, the network interface will by default have the same name as the netname.
  897. @cindex tinc-up
  898. You can configure the network interface by putting ordinary ifconfig, route, and other commands
  899. to a script named @file{/etc/tinc/netname/tinc-up}. When tinc starts, this script
  900. will be executed. When tinc exits, it will execute the script named
  901. @file{/etc/tinc/netname/tinc-down}, but normally you don't need to create that script.
  902. An example @file{tinc-up} script:
  903. @example
  904. #!/bin/sh
  905. ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0
  906. @end example
  907. This script gives the interface an IP address and a netmask.
  908. The kernel will also automatically add a route to this interface, so normally you don't need
  909. to add route commands to the @file{tinc-up} script.
  910. The kernel will also bring the interface up after this command.
  911. @cindex netmask
  912. The netmask is the mask of the @emph{entire} VPN network, not just your
  913. own subnet.
  914. @c ==================================================================
  915. @node Example configuration, , Network interfaces, Configuration
  916. @section Example configuration
  917. @cindex example
  918. Imagine the following situation. Branch A of our example `company' wants to connect
  919. three branch offices in B, C and D using the Internet. All four offices
  920. have a 24/7 connection to the Internet.
  921. A is going to serve as the center of the network. B and C will connect
  922. to A, and D will connect to C. Each office will be assigned their own IP
  923. network, 10.x.0.0.
  924. @example
  925. A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
  926. B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
  927. C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
  928. D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
  929. @end example
  930. ``gateway'' is the VPN IP address of the machine that is running the
  931. tincd. ``internet IP'' is the IP address of the firewall, which does not
  932. need to run tincd, but it must do a port forwarding of TCP&UDP on port
  933. 655 (unless otherwise configured).
  934. In this example, it is assumed that eth0 is the interface that points to
  935. the inner (physical) LAN of the office, although this could also be the
  936. same as the interface that leads to the Internet. The configuration of
  937. the real interface is also shown as a comment, to give you an idea of
  938. how these example host is set up. All branches use the netname `company'
  939. for this particular VPN.
  940. @subsubheading For Branch A
  941. @emph{BranchA} would be configured like this:
  942. In @file{/etc/tinc/company/tinc-up}:
  943. @example
  944. # Real interface of internal network:
  945. # ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
  946. ifconfig $INTERFACE 10.1.54.1 netmask 255.0.0.0
  947. @end example
  948. and in @file{/etc/tinc/company/tinc.conf}:
  949. @example
  950. Name = BranchA
  951. PrivateKeyFile = /etc/tinc/company/rsa_key.priv
  952. Device = /dev/tap0
  953. @end example
  954. On all hosts, /etc/tinc/company/hosts/BranchA contains:
  955. @example
  956. Subnet = 10.1.0.0/16
  957. Address = 1.2.3.4
  958. -----BEGIN RSA PUBLIC KEY-----
  959. ...
  960. -----END RSA PUBLIC KEY-----
  961. @end example
  962. Note that the IP addresses of eth0 and tap0 are the same.
  963. This is quite possible, if you make sure that the netmasks of the interfaces are different.
  964. It is in fact recommended to give give both real internal network interfaces and tap interfaces the same IP address,
  965. since that will make things a lot easier to remember and set up.
  966. @subsubheading For Branch B
  967. In @file{/etc/tinc/company/tinc-up}:
  968. @example
  969. # Real interface of internal network:
  970. # ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
  971. ifconfig $INTERFACE 10.2.1.12 netmask 255.0.0.0
  972. @end example
  973. and in @file{/etc/tinc/company/tinc.conf}:
  974. @example
  975. Name = BranchB
  976. ConnectTo = BranchA
  977. PrivateKeyFile = /etc/tinc/company/rsa_key.priv
  978. @end example
  979. Note here that the internal address (on eth0) doesn't have to be the
  980. same as on the tap0 device. Also, ConnectTo is given so that no-one can
  981. connect to this node.
  982. On all hosts, in @file{/etc/tinc/company/hosts/BranchB}:
  983. @example
  984. Subnet = 10.2.0.0/16
  985. Address = 2.3.4.5
  986. -----BEGIN RSA PUBLIC KEY-----
  987. ...
  988. -----END RSA PUBLIC KEY-----
  989. @end example
  990. @subsubheading For Branch C
  991. In @file{/etc/tinc/company/tinc-up}:
  992. @example
  993. # Real interface of internal network:
  994. # ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
  995. ifconfig $INTERFACE 10.3.69.254 netmask 255.0.0.0
  996. @end example
  997. and in @file{/etc/tinc/company/tinc.conf}:
  998. @example
  999. Name = BranchC
  1000. ConnectTo = BranchA
  1001. Device = /dev/tap1
  1002. @end example
  1003. C already has another daemon that runs on port 655, so they have to
  1004. reserve another port for tinc. It knows the portnumber it has to listen on
  1005. from it's own host configuration file.
  1006. On all hosts, in @file{/etc/tinc/company/hosts/BranchC}:
  1007. @example
  1008. Address = 3.4.5.6
  1009. Subnet = 10.3.0.0/16
  1010. Port = 2000
  1011. -----BEGIN RSA PUBLIC KEY-----
  1012. ...
  1013. -----END RSA PUBLIC KEY-----
  1014. @end example
  1015. @subsubheading For Branch D
  1016. In @file{/etc/tinc/company/tinc-up}:
  1017. @example
  1018. # Real interface of internal network:
  1019. # ifconfig eth0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
  1020. ifconfig $INTERFACE 10.4.3.32 netmask 255.0.0.0
  1021. @end example
  1022. and in @file{/etc/tinc/company/tinc.conf}:
  1023. @example
  1024. Name = BranchD
  1025. ConnectTo = BranchC
  1026. Device = /dev/net/tun
  1027. PrivateKeyFile = /etc/tinc/company/rsa_key.priv
  1028. @end example
  1029. D will be connecting to C, which has a tincd running for this network on
  1030. port 2000. It knows the port number from the host configuration file.
  1031. Also note that since D uses the tun/tap driver, the network interface
  1032. will not be called `tun' or `tap0' or something like that, but will
  1033. have the same name as netname.
  1034. On all hosts, in @file{/etc/tinc/company/hosts/BranchD}:
  1035. @example
  1036. Subnet = 10.4.0.0/16
  1037. Address = 4.5.6.7
  1038. -----BEGIN RSA PUBLIC KEY-----
  1039. ...
  1040. -----END RSA PUBLIC KEY-----
  1041. @end example
  1042. @subsubheading Key files
  1043. A, B, C and D all have generated a public/private keypair with the following command:
  1044. @example
  1045. tincd -n company -K
  1046. @end example
  1047. The private key is stored in @file{/etc/tinc/company/rsa_key.priv},
  1048. the public key is put into the host configuration file in the @file{/etc/tinc/company/hosts/} directory.
  1049. During key generation, tinc automatically guesses the right filenames based on the -n option and
  1050. the Name directive in the @file{tinc.conf} file (if it is available).
  1051. @subsubheading Starting
  1052. After each branch has finished configuration and they have distributed
  1053. the host configuration files amongst them, they can start their tinc daemons.
  1054. They don't necessarily have to wait for the other branches to have started
  1055. their daemons, tinc will try connecting until they are available.
  1056. @c ==================================================================
  1057. @node Running tinc, Technical information, Configuration, Top
  1058. @chapter Running tinc
  1059. If everything else is done, you can start tinc by typing the following command:
  1060. @example
  1061. tincd -n @emph{netname}
  1062. @end example
  1063. @cindex daemon
  1064. tinc will detach from the terminal and continue to run in the background like a good daemon.
  1065. If there are any problems however you can try to increase the debug level
  1066. and look in the syslog to find out what the problems are.
  1067. @menu
  1068. * Runtime options::
  1069. * Error messages::
  1070. @end menu
  1071. @c ==================================================================
  1072. @node Runtime options, Error messages, , Running tinc
  1073. @section Runtime options
  1074. Besides the settings in the configuration file, tinc also accepts some
  1075. command line options.
  1076. @cindex command line
  1077. @cindex runtime options
  1078. @cindex options
  1079. @c from the manpage
  1080. @table @samp
  1081. @item --bypass-security
  1082. Disables encryption and authentication.
  1083. Only useful for debugging.
  1084. @item -c, --config=PATH
  1085. Read configuration options from the directory PATH. The default is
  1086. @file{/etc/tinc/netname/}.
  1087. @cindex debug level
  1088. @item -d, --debug=LEVEL
  1089. Set debug level to LEVEL. The higher the debug level, the more gets
  1090. logged. Everything goes via syslog.
  1091. @item -K, --generate-keys[=BITS]
  1092. Generate public/private keypair of BITS length. If BITS is not specified,
  1093. 1024 is the default. tinc will ask where you want to store the files,
  1094. but will default to the configuration directory (you can use the -c or -n option
  1095. in combination with -K). After that, tinc will quit.
  1096. @item --help
  1097. Display a short reminder of these runtime options and terminate.
  1098. @item -k, --kill[=SIGNAL]
  1099. Attempt to kill a running tincd (optionally with the specified SIGNAL instead of SIGTERM) and exit.
  1100. Use it in conjunction with the -n option to make sure you kill the right tinc daemon.
  1101. @item -n, --net=NETNAME
  1102. Connect to net NETNAME. @xref{Multiple networks}.
  1103. @item -D, --no-detach
  1104. Don't fork and detach.
  1105. This will also disable the automatic restart mechanism for fatal errors.
  1106. @item -L, --mlock
  1107. Lock tinc into main memory.
  1108. This will prevent sensitive data like shared private keys to be written to the system swap files/partitions.
  1109. @item --version
  1110. Output version information and exit.
  1111. @end table
  1112. @c ==================================================================
  1113. @node Error messages, , Runtime options, Running tinc
  1114. @section Error messages
  1115. What follows is a list of the most common error messages you can see
  1116. when configuring tinc. Most of these messages are visible in the syslog
  1117. only, so keep an eye on it!
  1118. @table @strong
  1119. @item Could not open /dev/tap0: No such device
  1120. @itemize
  1121. @item You forgot to `modprobe netlink_dev' or `modprobe ethertap'.
  1122. @item You forgot to compile `Netlink device emulation' in the kernel.
  1123. @end itemize
  1124. @item Can't write to /dev/net/tun: No such device
  1125. @itemize
  1126. @item You forgot to `modprobe tun'.
  1127. @item You forgot to compile `Universal TUN/TAP driver' in the kernel.
  1128. @end itemize
  1129. @item Packet with destination 1.2.3.4 is looping back to us!
  1130. @itemize
  1131. @item Something is not configured right. Packets are being sent out to the
  1132. virtual network device, but according to the Subnet directives in your host configuration
  1133. file, those packets should go to your own host. Most common mistake is that
  1134. you have a Subnet line in your host configuration file with a prefix length which is
  1135. just as large as the prefix of the virtual network interface. The latter should in almost all
  1136. cases be larger. Rethink your configuration.
  1137. Note that you will only see this message if you specified a debug
  1138. level of 5 or higher!
  1139. @item Chances are that a `Subnet = ...' line in the host configuration file of this tinc daemon is wrong.
  1140. Change it to a subnet that is accepted locally by another interface,
  1141. or if that is not the case, try changing the prefix length into /32.
  1142. @end itemize
  1143. @item Network doesn't work, syslog shows only packets of length 46
  1144. @item Network address and prefix length do not match!
  1145. @itemize
  1146. @item The Subnet field must contain a @emph{network} address.
  1147. @item If you only want to use one IP address, set the netmask to /32.
  1148. @end itemize
  1149. @item This is a bug: net.c:253: 24: Some error
  1150. @itemize
  1151. @item This is something that should not have happened.
  1152. Please report this, and tell us exactly what went wrong before you got
  1153. this message. In normal operation, these errors should not occur.
  1154. @end itemize
  1155. @item Error reading RSA key file `rsa_key.priv': No such file or directory
  1156. @itemize
  1157. @item You must specify the complete pathname.
  1158. Specifying a relative path does not make sense here. tinc changes its
  1159. directory to / when starting (to avoid keeping a mount point busy).
  1160. @end itemize
  1161. @end table
  1162. @c ==================================================================
  1163. @node Technical information, About us, Running tinc, Top
  1164. @chapter Technical information
  1165. @menu
  1166. * The connection::
  1167. * The meta-protocol::
  1168. * Security::
  1169. @end menu
  1170. @c ==================================================================
  1171. @node The connection, The meta-protocol, Technical information, Technical information
  1172. @section The connection
  1173. @cindex connection
  1174. tinc is a daemon that takes VPN data and transmit that to another host
  1175. computer over the existing Internet infrastructure.
  1176. @menu
  1177. * The UDP tunnel::
  1178. * The meta-connection::
  1179. @end menu
  1180. @c ==================================================================
  1181. @node The UDP tunnel, The meta-connection, The connection, The connection
  1182. @subsection The UDP tunnel
  1183. @cindex virtual network device
  1184. @cindex frame type
  1185. The data itself is read from a character device file, the so-called
  1186. @emph{virtual network device}. This device is associated with a network
  1187. interface. Any data sent to this interface can be read from the device,
  1188. and any data written to the device gets sent from the interface.
  1189. There are two possible types of virtual network devices:
  1190. `tun' style, which are point-to-point devices which can only handle IPv4 and/or IPv6 packets,
  1191. and `tap' style, which are Ethernet devices and handle complete Ethernet frames.
  1192. So when tinc reads an Ethernet frame from the device, it determines its
  1193. type. When tinc is in it's default routing mode, it can handle IPv4 and IPv6
  1194. packets. Depending on the Subnet lines, it will send the packets off to their destination IP address.
  1195. In the `switch' and `hub' mode, tinc will use broadcasts and MAC address discovery
  1196. to deduce the destination of the packets.
  1197. Since the latter modes only depend on the link layer information,
  1198. any protocol that runs over Ethernet is supported (for instance IPX and Appletalk).
  1199. However, only `tap' style devices provide this information.
  1200. After the destination has been determined,
  1201. the packet will be compressed (optionally),
  1202. a sequence number will be added to the packet,
  1203. the packet will then be encrypted
  1204. and a message authentication code will be appended.
  1205. @cindex encapsulating
  1206. @cindex UDP
  1207. When that is done, time has come to actually transport the
  1208. packet to the destination computer. We do this by sending the packet
  1209. over an UDP connection to the destination host. This is called
  1210. @emph{encapsulating}, the VPN packet (though now encrypted) is
  1211. encapsulated in another IP datagram.
  1212. When the destination receives this packet, the same thing happens, only
  1213. in reverse. So it checks the message authentication code, decrypts the contents of the UDP datagram,
  1214. checks the sequence number
  1215. and writes the decrypted information to its own virtual network device.
  1216. If the virtual network device is a `tun' device (a point-to-point tunnel),
  1217. there is no problem for the kernel to accept a packet.
  1218. However, if it is a `tap' device (this is the only available type on FreeBSD),
  1219. the destination MAC address must match that of the virtual network interface.
  1220. If tinc is in it's default routing mode, ARP does not work, so the correct destination MAC
  1221. can not be known by the sending host.
  1222. tinc solves this by letting the receiving end detect the MAC address of its own virtual network interface
  1223. and overwriting the destination MAC address of the received packet.
  1224. In switch or hub modes ARP does work so the sender already knows the correct destination MAC address.
  1225. In those modes every interface should have a unique MAC address, so make sure they are not the same.
  1226. Because switch and hub modes rely on MAC addresses to function correctly,
  1227. these modes cannot be used on the following operating systems which don't have a `tap' style virtual network device:
  1228. OpenBSD, NetBSD, Darwin and Solaris.
  1229. @c ==================================================================
  1230. @node The meta-connection, , The UDP tunnel, The connection
  1231. @subsection The meta-connection
  1232. Having only a UDP connection available is not enough. Though suitable
  1233. for transmitting data, we want to be able to reliably send other
  1234. information, such as routing and session key information to somebody.
  1235. @cindex TCP
  1236. TCP is a better alternative, because it already contains protection
  1237. against information being lost, unlike UDP.
  1238. So we establish two connections. One for the encrypted VPN data, and one
  1239. for other information, the meta-data. Hence, we call the second
  1240. connection the meta-connection. We can now be sure that the
  1241. meta-information doesn't get lost on the way to another computer.
  1242. @cindex data-protocol
  1243. @cindex meta-protocol
  1244. Like with any communication, we must have a protocol, so that everybody
  1245. knows what everything stands for, and how she should react. Because we
  1246. have two connections, we also have two protocols. The protocol used for
  1247. the UDP data is the ``data-protocol,'' the other one is the
  1248. ``meta-protocol.''
  1249. The reason we don't use TCP for both protocols is that UDP is much
  1250. better for encapsulation, even while it is less reliable. The real
  1251. problem is that when TCP would be used to encapsulate a TCP stream
  1252. that's on the private network, for every packet sent there would be
  1253. three ACKs sent instead of just one. Furthermore, if there would be
  1254. a timeout, both TCP streams would sense the timeout, and both would
  1255. start re-sending packets.
  1256. @c ==================================================================
  1257. @node The meta-protocol, Security, The connection, Technical information
  1258. @section The meta-protocol
  1259. The meta protocol is used to tie all tinc daemons together, and
  1260. exchange information about which tinc daemon serves which virtual
  1261. subnet.
  1262. The meta protocol consists of requests that can be sent to the other
  1263. side. Each request has a unique number and several parameters. All
  1264. requests are represented in the standard ASCII character set. It is
  1265. possible to use tools such as telnet or netcat to connect to a tinc
  1266. daemon started with the --bypass-security option
  1267. and to read and write requests by hand, provided that one
  1268. understands the numeric codes sent.
  1269. The authentication scheme is described in @ref{Authentication protocol}. After a
  1270. successful authentication, the server and the client will exchange all the
  1271. information about other tinc daemons and subnets they know of, so that both
  1272. sides (and all the other tinc daemons behind them) have their information
  1273. synchronised.
  1274. @cindex ADD_EDGE
  1275. @cindex ADD_SUBNET
  1276. @example
  1277. daemon message
  1278. --------------------------------------------------------------------------
  1279. origin ADD_EDGE node1 node2 21.32.43.54 655 222 0
  1280. | | | | | +-> options
  1281. | | | | +----> weight
  1282. | | | +--------> UDP port of node2
  1283. | | +----------------> real address of node2
  1284. | +-------------------------> name of destination node
  1285. +-------------------------------> name of source node
  1286. origin ADD_SUBNET node 192.168.1.0/24
  1287. | | +--> prefixlength
  1288. | +--------> network address
  1289. +------------------> owner of this subnet
  1290. --------------------------------------------------------------------------
  1291. @end example
  1292. The ADD_EDGE messages are to inform other tinc daemons that a connection between
  1293. two nodes exist. The address of the destination node is available so that
  1294. VPN packets can be sent directly to that node.
  1295. The ADD_SUBNET messages inform other tinc daemons that certain subnets belong
  1296. to certain nodes. tinc will use it to determine to which node a VPN packet has
  1297. to be sent.
  1298. @cindex DEL_EDGE
  1299. @cindex DEL_SUBNET
  1300. @example
  1301. message
  1302. ------------------------------------------------------------------
  1303. DEL_EDGE node1 node2
  1304. | +----> name of destination node
  1305. +----------> name of source node
  1306. DEL_SUBNET node 192.168.1.0/24
  1307. | | +--> prefixlength
  1308. | +--------> network address
  1309. +------------------> owner of this subnet
  1310. ------------------------------------------------------------------
  1311. @end example
  1312. In case a connection between two daemons is closed or broken, DEL_EDGE messages
  1313. are sent to inform the other daemons of that fact. Each daemon will calculate a
  1314. new route to the the daemons, or mark them unreachable if there isn't any.
  1315. @cindex REQ_KEY
  1316. @cindex ANS_KEY
  1317. @cindex KEY_CHANGED
  1318. @example
  1319. message
  1320. ------------------------------------------------------------------
  1321. REQ_KEY origin destination
  1322. | +--> name of the tinc daemon it wants the key from
  1323. +----------> name of the daemon that wants the key
  1324. ANS_KEY origin destination 4ae0b0a82d6e0078 91 64 4
  1325. | | \______________/ | | +--> MAC length
  1326. | | | | +-----> digest algorithm
  1327. | | | +--------> cipher algorithm
  1328. | | +--> 128 bits key
  1329. | +--> name of the daemon that wants the key
  1330. +----------> name of the daemon that uses this key
  1331. KEY_CHANGED origin
  1332. +--> daemon that has changed it's packet key
  1333. --------------------------------------------------------------------------
  1334. @end example
  1335. The keys used to encrypt VPN packets are not sent out directly. This is
  1336. because it would generate a lot of traffic on VPNs with many daemons, and
  1337. chances are that not every tinc daemon will ever send a packet to every
  1338. other daemon. Instead, if a daemon needs a key it sends a request for it
  1339. via the meta connection of the nearest hop in the direction of the
  1340. destination.
  1341. @cindex PING
  1342. @cindex PONG
  1343. @example
  1344. daemon message
  1345. --------------------------------------------------------------------------
  1346. origin PING
  1347. dest. PONG
  1348. --------------------------------------------------------------------------
  1349. @end example
  1350. There is also a mechanism to check if hosts are still alive. Since network
  1351. failures or a crash can cause a daemon to be killed without properly
  1352. shutting down the TCP connection, this is necessary to keep an up to date
  1353. connection list. PINGs are sent at regular intervals, except when there
  1354. is also some other traffic. A little bit of salt (random data) is added
  1355. with each PING and PONG message, to make sure that long sequences of PING/PONG
  1356. messages without any other traffic won't result in known plaintext.
  1357. This basically covers what is sent over the meta connection by
  1358. tinc.
  1359. @c ==================================================================
  1360. @node Security, , The meta-protocol, Technical information
  1361. @section About tinc's encryption and other security-related issues.
  1362. @cindex TINC
  1363. @cindex Cabal
  1364. tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
  1365. alleged Cabal was/is an organisation that was said to keep an eye on the
  1366. entire Internet. As this is exactly what you @emph{don't} want, we named
  1367. the tinc project after TINC.
  1368. @cindex SVPN
  1369. But in order to be ``immune'' to eavesdropping, you'll have to encrypt
  1370. your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
  1371. exactly that: encrypt.
  1372. tinc by default uses blowfish encryption with 128 bit keys in CBC mode, 32 bit
  1373. sequence numbers and 4 byte long message authentication codes to make sure
  1374. eavesdroppers cannot get and cannot change any information at all from the
  1375. packets they can intercept. The encryption algorithm and message authentication
  1376. algorithm can be changed in the configuration. The length of the message
  1377. authentication codes is also adjustable. The length of the key for the
  1378. encryption algorithm is always the default length used by OpenSSL.
  1379. @menu
  1380. * Authentication protocol::
  1381. * Encryption of network packets::
  1382. @end menu
  1383. @c ==================================================================
  1384. @node Authentication protocol, Encryption of network packets, Security, Security
  1385. @subsection Authentication protocol
  1386. @cindex authentication
  1387. A new scheme for authentication in tinc has been devised, which offers some
  1388. improvements over the protocol used in 1.0pre2 and 1.0pre3. Explanation is
  1389. below.
  1390. @cindex ID
  1391. @cindex META_KEY
  1392. @cindex CHALLENGE
  1393. @cindex CHAL_REPLY
  1394. @cindex ACK
  1395. @example
  1396. daemon message
  1397. --------------------------------------------------------------------------
  1398. client <attempts connection>
  1399. server <accepts connection>
  1400. client ID client 12
  1401. | +---> version
  1402. +-------> name of tinc daemon
  1403. server ID server 12
  1404. | +---> version
  1405. +-------> name of tinc daemon
  1406. client META_KEY 5f0823a93e35b69e...7086ec7866ce582b
  1407. \_________________________________/
  1408. +-> RSAKEYLEN bits totally random string S1,
  1409. encrypted with server's public RSA key
  1410. server META_KEY 6ab9c1640388f8f0...45d1a07f8a672630
  1411. \_________________________________/
  1412. +-> RSAKEYLEN bits totally random string S2,
  1413. encrypted with client's public RSA key
  1414. From now on:
  1415. - the client will symmetrically encrypt outgoing traffic using S1
  1416. - the server will symmetrically encrypt outgoing traffic using S2
  1417. client CHALLENGE da02add1817c1920989ba6ae2a49cecbda0
  1418. \_________________________________/
  1419. +-> CHALLEN bits totally random string H1
  1420. server CHALLENGE 57fb4b2ccd70d6bb35a64c142f47e61d57f
  1421. \_________________________________/
  1422. +-> CHALLEN bits totally random string H2
  1423. client CHAL_REPLY 816a86
  1424. +-> 160 bits SHA1 of H2
  1425. server CHAL_REPLY 928ffe
  1426. +-> 160 bits SHA1 of H1
  1427. After the correct challenge replies are received, both ends have proved
  1428. their identity. Further information is exchanged.
  1429. client ACK 655 123 0
  1430. | | +-> options
  1431. | +----> estimated weight
  1432. +--------> listening port of client
  1433. server ACK 655 321 0
  1434. | | +-> options
  1435. | +----> estimated weight
  1436. +--------> listening port of server
  1437. --------------------------------------------------------------------------
  1438. @end example
  1439. This new scheme has several improvements, both in efficiency and security.
  1440. First of all, the server sends exactly the same kind of messages over the wire
  1441. as the client. The previous versions of tinc first authenticated the client,
  1442. and then the server. This scheme even allows both sides to send their messages
  1443. simultaneously, there is no need to wait for the other to send something first.
  1444. This means that any calculations that need to be done upon sending or receiving
  1445. a message can also be done in parallel. This is especially important when doing
  1446. RSA encryption/decryption. Given that these calculations are the main part of
  1447. the CPU time spent for the authentication, speed is improved by a factor 2.
  1448. Second, only one RSA encrypted message is sent instead of two. This reduces the
  1449. amount of information attackers can see (and thus use for a cryptographic
  1450. attack). It also improves speed by a factor two, making the total speedup a
  1451. factor 4.
  1452. Third, and most important:
  1453. The symmetric cipher keys are exchanged first, the challenge is done
  1454. afterwards. In the previous authentication scheme, because a man-in-the-middle
  1455. could pass the challenge/chal_reply phase (by just copying the messages between
  1456. the two real tinc daemons), but no information was exchanged that was really
  1457. needed to read the rest of the messages, the challenge/chal_reply phase was of
  1458. no real use. The man-in-the-middle was only stopped by the fact that only after
  1459. the ACK messages were encrypted with the symmetric cipher. Potentially, it
  1460. could even send it's own symmetric key to the server (if it knew the server's
  1461. public key) and read some of the metadata the server would send it (it was
  1462. impossible for the mitm to read actual network packets though). The new scheme
  1463. however prevents this.
  1464. This new scheme makes sure that first of all, symmetric keys are exchanged. The
  1465. rest of the messages are then encrypted with the symmetric cipher. Then, each
  1466. side can only read received messages if they have their private key. The
  1467. challenge is there to let the other side know that the private key is really
  1468. known, because a challenge reply can only be sent back if the challenge is
  1469. decrypted correctly, and that can only be done with knowledge of the private
  1470. key.
  1471. Fourth: the first thing that is send via the symmetric cipher encrypted
  1472. connection is a totally random string, so that there is no known plaintext (for
  1473. an attacker) in the beginning of the encrypted stream.
  1474. @c ==================================================================
  1475. @node Encryption of network packets, , Authentication protocol, Security
  1476. @subsection Encryption of network packet
  1477. @cindex encryption
  1478. A data packet can only be sent if the encryption key is known to both
  1479. parties, and the connection is activated. If the encryption key is not
  1480. known, a request is sent to the destination using the meta connection
  1481. to retrieve it. The packet is stored in a queue while waiting for the
  1482. key to arrive.
  1483. @cindex UDP
  1484. The UDP packet containing the network packet from the VPN has the following layout:
  1485. @example
  1486. ... | IP header | UDP header | seqno | VPN packet | MAC | UDP trailer
  1487. \___________________/\_____/
  1488. | |
  1489. V +---> digest algorithm
  1490. Encrypted with symmetric cipher
  1491. @end example
  1492. So, the entire VPN packet is encrypted using a symmetric cipher, including a 32 bits
  1493. sequence number that is added in front of the actual VPN packet, to act as a unique
  1494. IV for each packet and to prevent replay attacks. A message authentication code
  1495. is added to the UDP packet to prevent alteration of packets. By default the
  1496. first 4 bytes of the digest are used for this, but this can be changed using
  1497. the MACLength configuration variable.
  1498. @c ==================================================================
  1499. @node About us, Concept Index, Technical information, Top
  1500. @chapter About us
  1501. @menu
  1502. * Contact Information::
  1503. * Authors::
  1504. @end menu
  1505. @c ==================================================================
  1506. @node Contact Information, Authors, About us, About us
  1507. @section Contact information
  1508. @cindex website
  1509. tinc's website is at @url{http://tinc.nl.linux.org/},
  1510. this server is located in the Netherlands.
  1511. @cindex IRC
  1512. We have an IRC channel on the FreeNode IRC network. Connect to
  1513. @uref{http://www.freenode.net/, irc.freenode.net}
  1514. and join channel #tinc.
  1515. @c ==================================================================
  1516. @node Authors, , Contact Information, About us
  1517. @section Authors
  1518. @table @asis
  1519. @item Ivo Timmermans (zarq) (@email{ivo@@o2w.nl})
  1520. @item Guus Sliepen (guus) (@email{guus@@sliepen.eu.org})
  1521. @end table
  1522. We have received a lot of valuable input from users. With their help,
  1523. tinc has become the flexible and robust tool that it is today. We have
  1524. composed a list of contributions, in the file called @file{THANKS} in
  1525. the source distribution.
  1526. @c ==================================================================
  1527. @node Concept Index, , About us, Top
  1528. @c node-name, next, previous, up
  1529. @unnumbered Concept Index
  1530. @c ==================================================================
  1531. @printindex cp
  1532. @c ==================================================================
  1533. @contents
  1534. @bye