Correct filenames for passphrases given in the example
[oweals/tinc.git] / doc / tinc.texi
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename tinc.info
4 @settitle tinc Manual
5 @setchapternewpage odd
6 @c %**end of header
7
8 @ifinfo
9 @direntry
10 * tinc: (tinc).              The tinc Manual.
11 @end direntry
12
13 This is the info manual for tinc, a Virtual Private Network daemon.
14
15 Copyright 1998,199,2000 Ivo Timmermans <itimmermans@@bigfoot.com>
16
17      Permission is granted to make and distribute verbatim
18      copies of this manual provided the copyright notice and
19      this permission notice are preserved on all copies.
20
21      Permission is granted to copy and distribute modified
22      versions of this manual under the conditions for
23      verbatim copying, provided
24      that the entire resulting derived work is distributed
25      under the terms of a permission notice identical to this
26      one.
27
28 @end ifinfo
29
30 @titlepage
31 @title tinc Manual
32 @subtitle Setting up a Virtual Private Network with tinc
33 @author Ivo Timmermans <itimmermans@@bigfoot.com> and Guus Sliepen <guus@sliepen.warande.net>
34
35 @page
36 @vskip 0pt plus 1filll
37 Copyright @copyright{} 1998,1999,2000 Ivo Timmermans <itimmermans@@bigfoot.com>
38
39      Permission is granted to make and distribute verbatim
40      copies of this manual provided the copyright notice and
41      this permission notice are preserved on all copies.
42
43      Permission is granted to copy and distribute modified
44      versions of this manual under the conditions for
45      verbatim copying, provided
46      that the entire resulting derived work is distributed
47      under the terms of a permission notice identical to this
48      one.
49
50 @end titlepage
51
52 @c ==================================================================
53 @node Top, Introduction, (dir), (dir)
54
55 @menu
56 * Introduction::                Introduction
57 * Configuring a Linux system::  Before compiling tinc
58 * Installing tinc::             
59 * Configuring tinc::            
60 * Running tinc::                
61 * Technical information::       
62 * About us::                    
63 * Concept Index::               All used terms explained
64 @end menu
65
66 @c ==================================================================
67 @node    Introduction, Configuring a Linux system, Top, Top
68 @chapter Introduction
69
70 @c straight from the www page
71
72 tinc is a Virtual Private Network (VPN) daemon that uses tunneling and
73 encryption to create a secure private network between hosts on the
74 Internet.
75
76 Because the tunnel appears to the IP level network code as a normal
77 network device, there is no need to adapt any existing software.
78
79 This tunneling allows VPN sites to share information with each other
80 over the Internet without exposing any information to others.
81
82 This document is the manual for tinc. Included are chapters on how to
83 configure your computer to use tinc, as well as the configuration
84 process of tinc itself.
85
86 @menu
87 * VPNs::                        Virtual Private Networks in general
88 * tinc::                        about tinc
89 @end menu
90
91 @c ==================================================================
92 @node    VPNs, tinc, Introduction, Introduction
93 @section Virtual Private Networks
94
95 A Virtual Private Network or VPN is a network that can only be accessed
96 by a few elected computers that participate. This goal is achievable in
97 more than just one way.
98
99 @cindex private
100 Private networks can consist of a single stand-alone ethernet LAN. Or
101 even two computers hooked up using a null-modem cable. In these cases,
102 it is
103 obvious that the network is @emph{private}, no one can access it from the
104 outside. But if your computers are linked to the internet, the network
105 is not private anymore, unless one uses firewalls to block all private
106 traffic. But then, there is no way to send private data to trusted
107 computers on the other end of the internet.
108
109 @cindex virtual
110 This problem can be solved by using @emph{virtual} networks. Virtual
111 networks can live on top of other networks, but do not interfere with
112 each other. Mostly, virtual networks appear like a singe LAN, even though
113 they can span the entire world. But virtual networks can't be secured
114 by using firewalls, because the traffic that flows through it has to go
115 through the internet, where other people can look at it.
116
117 When one introduces encryption, we can form a true VPN. Other people may
118 see encrypted traffic, but if they don't know how to decipher it (they
119 need to know the key for that), they cannot read the information that flows
120 through the VPN. This is what tinc was made for.
121
122 @cindex virtual
123 tinc uses normal IP datagrams to encapsulate data that goes over the VPN
124 network link. In this case it's also clear that the network is
125 @emph{virtual}, because no direct network link has to exist between to
126 participants.
127
128 As is the case with either type of VPN, anybody could eavesdrop. Or
129 worse, alter data. Hence it's probably advisable to encrypt the data
130 that flows over the network.
131
132
133 @c ==================================================================
134 @node    tinc,  , VPNs, Introduction
135 @section tinc
136
137 I really don't quite remember what got us started, but it must have been
138 Guus' idea. He wrote a simple implementation (about 50 lines of C) that
139 used the @emph{ethertap} device that Linux knows of since somewhere
140 about kernel 2.1.60. It didn't work immediately and he improved it a
141 bit. At this stage, the project was still simply called @samp{vpnd}.
142
143 Since then, a lot has changed---to say the least.
144
145 @cindex tincd
146 tinc now supports encryption, it consists of a single daemon (tincd) for
147 both the receiving and sending end, it has become largely
148 runtime-configurable---in short, it has become a full-fledged
149 professional package.
150
151 A lot can---and will be---changed. I have a few things that I'd like to
152 see in the future releases of tinc. Not everything will be available in
153 the near future. Our first objective is to make tinc work perfectly as
154 it stands, and then add more advanced features.
155
156 Meanwhile, we're always open-minded towards new ideas. And we're
157 available too.
158
159
160 @c ==================================================================
161 @node    Configuring a Linux system, Installing tinc, Introduction, Top
162 @chapter Configuring a Linux system
163
164 This chapter contains information on how a Linux system is configured
165 for the use of tinc.
166
167 @menu
168 * Configuring the kernel::      
169 * Files Needed::                
170 * Setting up the devices::      
171 @end menu
172
173
174 @c ==================================================================
175 @node    Configuring the kernel, Files Needed, Configuring a Linux system, Configuring a Linux system
176 @section Configuring the kernel
177
178 Since this particular implementation only runs on 2.1 or higher Linux
179 kernels, you should grab one (2.2 is current at this time). A 2.0 port
180 is not really possible, unless someone tells me someone ported the
181 ethertap and netlink devices back to 2.0.
182
183 If you are unfamiliar with the process of configuring and compiling a
184 new kernel, you should read the
185 @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel
186 HOWTO} first. Do that now!
187
188 Here are the options you have to turn on/off when configuring a new
189 kernel.
190
191 @example
192 Code maturity level options
193 [*] Prompt for development and/or incomplete code/drivers
194 Networking options
195 [*] Kernel/User netlink socket
196 <*> Netlink device emulation
197 Network device support
198 <*> Ethertap network tap
199 @end example
200
201 Any other options not mentioned here are not relevant to tinc. If you
202 decide to build any of these as dynamic kernel modules, it's a good idea
203 to add these lines to @file{/etc/modules.conf}.
204
205 @example
206 alias tap0 ethertap
207 alias char-major-36 netlink_dev
208 @end example
209
210 Finally, after having set up other options, build the kernel and boot
211 it. Unfortunately it's not possible to insert these modules in a running
212 kernel.
213
214
215 @c ==================================================================
216 @node    Files Needed, Setting up the devices, Configuring the kernel, Configuring a Linux system
217 @section Files Needed
218
219 @subsubheading Device files
220
221 First, you'll need the special device file(s) that form the interface
222 between the kernel and the daemon. If you are running the new 2.4 kernel and
223 you are using the devfs filesystem, then the tap device will be automatically
224 generated as @file{/dev/netlink/tap0}. Otherwise, you have to make it yourself:
225
226 @example
227 mknod -m 600 /dev/tap0 c 36 16
228 chown 0.0 /dev/tap0
229 @end example
230
231 The permissions now will be such that only the super user may read/write
232 to this file. You'd want this, because otherwise eavesdropping would
233 become a bit too easy. This does, however, imply that you'd have to run
234 tincd as root.
235
236 If you want to, you may also create more device files, which would be
237 numbered 0...15, with minor device numbers 16...31. They all should be
238 owned by root and have permission 600. Under devfs, these files will
239 be automatically generated.
240
241
242 @subsubheading @file{/etc/networks}
243
244 You may add a line to @file{/etc/networks} so that your VPN will get a
245 symbolic name. For example:
246
247 @example
248 myvpn 10.0.0.0
249 @end example
250
251 This has nothing to do with the MyVPNIP configuration variable that will be
252 discussed later, it is only to make the output of the route command more
253 legible.
254
255 @subsubheading @file{/etc/services}
256
257 You may add this line to @file{/etc/services}. The effect is that you
258 may supply a @samp{tinc} as a valid port number to some programs. The
259 number 655 is registered with the IANA.
260
261 @example
262 tinc            655/tcp    TINC
263 tinc            655/udp    TINC
264 #                          Ivo Timmermans <itimmermans@@bigfoot.com>
265 @end example
266
267
268 @c ==================================================================
269 @node    Setting up the devices,  , Files Needed, Configuring a Linux system
270 @section Setting up the devices
271
272 Before you can start transmitting data over the tinc tunnel, you must
273 set up the ethertap network devices.
274
275 First, decide which IP addresses you want to have associated with these
276 devices, and what network mask they must have. You also need these
277 numbers when you are going to configure tinc itself. @xref{Configuring
278 tinc}.
279
280 It doesn't matter much which part you do first, setting up the network
281 devices or configure tinc. But they both have to be done before you try
282 to start a tincd.
283
284 The actual setup of the ethertap device is quite simple, just repeat
285 after me:
286
287 @example
288 ifconfig tap@emph{n} hw ether fe:fd:@emph{xx}:@emph{xx}:@emph{xx}:@emph{xx}
289 @end example
290
291 The @emph{n} here is the number of the ethertap device you want to
292 use. It should be the same @emph{n} as the one you use for
293 @file{/dev/tap@emph{n}}. The @emph{xx}s are four hexadecimal numbers
294 (0--ff). With previous versions of tincd, it didn't matter what they
295 were. But newer kernels require properly set up ethernet addresses.
296 In fact, the old behavior was wrong. It is required that the @emph{xx}s
297 match the numbers of the IP address you will give to the tap device
298 and to the MyOwnVPNIP configuration (which will be discussed later):
299
300 @example
301 ifconfig tap@emph{n} @emph{xx}.@emph{xx}.@emph{xx}.@emph{xx} netmask @emph{mask}
302 @end example
303
304 This will activate the device with an IP address @emph{IP} with network
305 mask @emph{mask}. The netmask is the mask of the @emph{entire} VPN network,
306 not just your own subnet. It is the same netmask you will have to specify
307 with the VpnMask configuration variable.
308
309
310 @c ==================================================================
311 @node    Installing tinc, Configuring tinc, Configuring a Linux system, Top
312 @chapter Installing tinc
313
314 First download it. This is the
315 @uref{http://tinc.nl.linux.org/download.html, download
316 page}, which has the checksums of these files listed; you may wish to
317 check these with md5sum before continuing.
318
319 tinc comes in a handy autoconf/automake package, which you can just
320 treat the same as any other package. Which is just untar it, type
321 `configure' and then `make'.
322
323 More detailed instructions are in the file @file{INSTALL}, which is
324 included in the source distribution.
325
326
327 @c ==================================================================
328 @node    Configuring tinc, Running tinc, Installing tinc, Top
329 @chapter Configuring tinc
330
331 @menu
332 * Multiple networks::           
333 * How connections work::        
334 * Configuration file::          
335 * Example::                     
336 @end menu
337
338
339 @c ==================================================================
340 @node    Multiple networks, How connections work, Configuring tinc, Configuring tinc
341 @section Multiple networks
342
343 @c from the manpage
344
345 It is perfectly OK for you to run more than one tinc daemon.
346 However, in its default form, you will soon notice that you can't use
347 two different configuration files without the -c option.
348
349 We have thought of another way of dealing with this: network names. This
350 means that you call tincd with the -n argument, which will assign a name
351 to this daemon.
352
353 The effect of this is that the daemon will set its configuration
354 ``root'' to /etc/tinc/nn/, where nn is your argument to the -n
355 option. You'll notice that it appears in syslog as ``tinc.nn''.
356
357 However, it is not strictly necessary that you call tinc with the -n
358 option. In this case, the network name would just be empty, and it will
359 be used as such. tinc now looks for files in /etc/tinc/, instead of
360 /etc/tinc/nn/; the configuration file should be /etc/tinc/tinc.conf,
361 and the passphrases are now expected to be in /etc/tinc/passphrases/.
362
363 But it is highly recommended that you use this feature of tinc, because
364 it will be so much clearer whom your daemon talks to. Hence, we will
365 assume that you use it.
366
367
368 @c ==================================================================
369 @node    How connections work, Configuration file, Multiple networks, Configuring tinc
370 @section How connections work
371
372 Before going on, first a bit on how tinc sees connections.
373
374 When tinc starts up, it reads in the configuration file and parses the
375 command-line options. If it sees a `ConnectTo' value in the file, it
376 will try to connect to it, on the given port. If this fails, tinc exits.
377
378
379 @c ==================================================================
380 @node    Configuration file, Example, How connections work, Configuring tinc
381 @section Configuration file
382
383 The actual configuration of the daemon is done in the file
384 @file{/etc/tinc/nn/tinc.conf}.
385
386 This file consists of comments (lines started with a #) or assignments
387 in the form of
388
389 @example
390 Variable = Value.
391 @end example
392
393 The variable names are case insensitive, and any spaces, tabs, newlines
394 and carriage returns are ignored. Note: it is not required that you put
395 in the `=' sign, but doing so improves readability.  If you leave it
396 out, remember to replace it with at least one space character.
397
398 @menu
399 * Variables::                   
400 @end menu
401
402 @c ==================================================================
403 @node    Variables,  , Configuration file, Configuration file
404 @subsection Variables
405
406 Here are all valid variables, listed in alphabetical order. The default
407 value, required or optional is given between parentheses.
408
409 @c straight from the manpage
410 @table @asis
411 @item ConnectPort = <port> (655)
412 Connect to the upstream host (given with the ConnectTo directive) on
413 port port. port may be given in decimal (default), octal (when preceded
414 by a single zero) or hexadecimal (prefixed with 0x).  port is the port
415 number for both the UDP and the TCP (meta) connections.
416
417 @item ConnectTo = <IP address|hostname> (optional)
418 Specifies which host to connect to on startup. Multiple ConnectTo variables
419 may be specified, if connecting to the first one fails then tinc will try
420 the next one, and so on. It is possible to specify hostnames for dynamic IP
421 addresses (like those given on dyndns.org), tinc will not cache the resolved
422 IP address.
423
424 If you don't specify a host with ConnectTo, regardless of whether a
425 value for ConnectPort is given, tinc won't connect at all, and will
426 instead just listen for incoming connections.
427
428 @item Hostnames = <yes|no> (no)
429 This option selects whether IP addresses (both real and on the VPN) should
430 be resolved. Since DNS lookups are blocking, it might affect tinc's
431 efficiency, even stopping the daemon for a few seconds everytime it does
432 a lookup if your DNS server is not responding.
433
434 This does not affect resolving hostnames to IP addresses from the configuration
435 file.
436
437 @item IndirectData = <yes|no> (no)
438 This option specifies whether other tinc daemons besides the one you
439 specified with ConnectTo can make a direct connection to you. This is
440 especially useful if you are behind a firewall and it is impossible
441 to make a connection from the outside to your tinc daemon. Otherwise,
442 it is best to leave this option out or set it to no.
443
444 @item Interface = <device> (optional)
445 If you have more than one network interface in your computer, tinc will by
446 default listen on all of them for incoming connections. It is possible to
447 bind tinc to a single interface like eth0 or ppp0 with this variable.
448
449 @item InterfaceIP = <local address> (optional)
450 If your computer has more than one IP address on a single interface (for example
451 if you are running virtual hosts), tinc will by default listen on all of them for
452 incoming connections. It is possible to bind tinc to a single IP address with
453 this variable. It is still possible to listen on several interfaces at the same
454 time though, if they share the same IP address.
455
456 @item KeyExpire = <seconds> (3600)
457 This option controls the time the encryption keys used to encrypt the data
458 are valid. It is common practice to change keys at regular intervals to
459 make it even harder for crackers, even though it is thought to be nearly
460 impossible to crack a single key.
461
462 @item ListenPort = <port> (655)
463 Listen on local port port. The computer connecting to this daemon should
464 use this number as the argument for his ConnectPort.
465
466 @item MyOwnVPNIP = <local address[/maskbits]> (required)
467 The local address is the number that the daemon will propagate to
468 other daemons on the network when it is identifying itself. Hence this
469 will be the file name of the passphrase file that the other end expects
470 to find the passphrase in.
471
472 The local address is the IP address of the tap device, not the real IP
473 address of the host running tincd. Due to changes in recent kernels, it
474 is also necessary that you make the ethernet (also known as MAC) address
475 equal to the IP address (see the example).
476
477 maskbits is the number of bits set to 1 in the netmask part.
478
479 @item MyVirtualIP = <local address[/maskbits]>
480 This is an alias for MyOwnVPNIP.
481
482 @item Passphrases = <directory> (/etc/tinc/NETNAME/passphrases)
483 The directory where tinc will look for passphrases when someone tries to
484 connect. Please see the manpage for genauth(8) for more information
485 about passphrases as used by tinc.
486
487 @item PingTimeout = <seconds> (5)
488 The number of seconds of inactivity that tinc will wait before sending a
489 probe to the other end. If that other end doesn't answer within that
490 same amount of seconds, the connection is terminated, and the others
491 will be notified of this.
492
493 @item TapDevice = <device> (/dev/tap0)
494 The ethertap device to use. Note that you can only use one device per
495 daemon. The info pages of the tinc package contain more information
496 about configuring an ethertap device for Linux.
497
498 @item TCPonly = <yes|no> (no, experimental)
499 If this variable is set to yes, then the packets are tunnelled over a TCP
500 connection instead of a UDP connection. This is especially useful for those
501 who want to run a tinc daemon from behind a masquerading firewall, or if
502 UDP packet routing is disabled somehow. This is experimental code,
503 try this at your own risk.
504
505 @item VpnMask = <mask> (optional)
506 The mask that defines the scope of the entire VPN. This option is not used
507 by the tinc daemon itself, but can be used by startup scripts to configure
508 the ethertap devices correctly.
509 @end table
510
511
512
513 @c ==================================================================
514 @node    Example,  , Configuration file, Configuring tinc
515 @section Example
516
517 Imagine the following situation. An A-based company wants to connect
518 three branch offices in B, C and D using the internet. All four offices
519 have a 24/7 connection to the internet.
520
521 A is going to serve as the center of the network. B and C will connect
522 to A, and D will connect to C. Each office will be assigned their own IP
523 network, 10.x.0.0.
524
525 @example
526 A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
527 B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
528 C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
529 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
530 @end example
531
532 ``gateway'' is the VPN IP address of the machine that is running the
533 tincd. ``internet IP'' is the IP address of the firewall, which does not
534 need to run tincd, but it must do a port forwarding of TCP&UDP on port
535 655 (unless otherwise configured).
536
537 In this example, it is assumed that eth0 is the interface that points to
538 the inner LAN of the office, although this could also be the same as the
539 interface that leads to the internet. The configuration of the real
540 interface is also shown as a comment, to give you an idea of how these
541 example host is set up.
542
543 @subsubheading For A
544
545 @emph{A} would be configured like this:
546
547 @example
548 #ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
549 ifconfig tap0 hw ether fe:fd:0a:01:36:01
550 ifconfig tap0 10.1.54.1 netmask 255.0.0.0
551 @end example
552
553 and in /etc/tinc/tinc.conf:
554
555 @example
556 TapDevice = /dev/tap0
557 MyVirtualIP = 10.1.54.1/16
558 VpnMask = 255.0.0.0
559 @end example
560
561 @subsubheading For B
562
563 @example
564 #ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
565 ifconfig tap0 hw ether fe:fd:0a:02:01:0c
566 ifconfig tap0 10.2.1.12 netmask 255.0.0.0
567 @end example
568
569 and in /etc/tinc/tinc.conf:
570
571 @example
572 TapDevice = /dev/tap0
573 MyVirtualIP = 10.2.1.12/16
574 ConnectTo = 1.2.3.4
575 VpnMask = 255.0.0.0
576 @end example
577
578 Note here that the internal address (on eth0) doesn't have to be the
579 same as on the tap0 device. Also, ConnectTo is given so that no-one can
580 connect to this node.
581
582 @subsubheading For C
583
584 @example
585 #ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
586 ifconfig tap0 hw ether fe:fd:0a:03:45:fe
587 ifconfig tap0 10.3.69.254 netmask 255.0.0.0
588 @end example
589
590 and in /etc/tinc/A/tinc.conf:
591
592 @example
593 MyVirtualIP = 10.3.69.254/16
594 TapDevice = /dev/tap1
595 ConnectTo = 1.2.3.4
596 ListenPort = 2000
597 VpnMask = 255.0.0.0
598 @end example
599
600 C already has another daemon that runs on port 655, so they have to
601 reserve another port for tinc. It can connect to other tinc daemons on
602 the regular port though, so no ConnectPort variable is needed.
603 They also use the netname to distinguish
604 between the two. tinc is started with `tincd -n A'.
605
606 @subsubheading For D
607
608 @example
609 #ifconfig tap0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
610 ifconfig tap0 hw ether fe:fd:0a:04:03:20
611 ifconfig tap0 10.4.3.32 netmask 255.0.0.0
612 @end example
613
614 and in /etc/tinc/tinc.conf:
615
616 @example
617 MyVirtualIP = 10.4.3.32/16
618 ConnectTo = 3.4.5.6
619 ConnectPort = 2000
620 VpnMask=255.0.0.0
621 @end example
622
623 D will be connecting to C, which has a tincd running for this network on
624 port 2000. Hence they need to put in a ConnectPort, but it doesn't need
625 to have a different ListenPort.
626
627 @subsubheading Authentication
628
629 A, B, C and D all generate a passphrase with genauth 2048, the output is
630 stored in /etc/tinc/passphrases/local, except for C, where it should be
631 /etc/tinc/A/passphrases/local.
632
633 A stores a copy of B's passphrase in /etc/tinc/passphrases/10.2.1.12
634
635 A stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.69.254
636
637 B stores a copy of A's passphrase in /etc/tinc/passphrases/10.1.54.1
638
639 C stores a copy of A's passphrase in /etc/tinc/A/passphrases/10.1.54.1
640
641 C stores a copy of D's passphrase in /etc/tinc/A/passphrases/10.4.3.32
642
643 D stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.69.254
644
645 @subsubheading Starting
646
647 A has to start their tincd first. Then come B and C, where C has to
648 provide the option `-n A', because they have more than one tinc
649 network. Finally, D's tincd is started.
650
651
652
653 @c ==================================================================
654 @node    Running tinc, Technical information, Configuring tinc, Top
655 @chapter Running tinc
656
657 Running tinc isn't just as easy as typing `tincd' and hoping everything
658 will just work out the way you wanted. Instead, the use of tinc is a
659 project that involves trust relations and more than one computer.
660
661 @menu
662 * Managing keys::               
663 * Runtime options::             
664 @end menu
665
666
667 @c ==================================================================
668 @node    Managing keys, Runtime options, Running tinc, Running tinc
669 @section Managing keys
670
671 Before attempting to start tinc, you have to create passphrases. When
672 tinc tries to make a connection, it exchanges some sensitive
673 data. Before doing so, it likes to know if the other end is
674 trustworthy.
675
676 To do this, both ends must have some knowledge about the other. In the
677 case of tinc this is the authentication passphrase.
678
679 This passphrase is a number, which is chosen at random. This number is
680 then sent to the other computers which want to talk to us directly. To
681 avoid breaking security, this should be done over a known secure channel
682 (such as ssh or similar).
683
684 All passphrases are stored in the passphrases directory, which is
685 normally /etc/tinc/nn/passphrases/, but it may be changed using the
686 `Passphrases' option in the config file.
687
688 To generate a passphrase, run `genauth'. genauth takes one argument,
689 which is the length of the passphrase in bits. The length of the
690 passphrase should be in the range 1024--2048 for a key length of 128
691 bits. genauth creates a random number of the specified length, and puts
692 it to stdout.
693
694 Every computer that wants to participate in the VPN should do this, and
695 store the output in the passphrases directory, in the file @file{local}.
696
697 When every computer has his own local key, it should copy it to the
698 computer that it wants to talk to directly. (i.e. the one it connects to
699 during startup.) This should be done via a secure channel, because it is
700 sensitive information. If this is not done securely, someone might break
701 in on you later on.
702
703 Those non-local passphrase files must have the name of the VPN IP
704 address that they will advertise to you. For instance, if a computer
705 tells us it likes to be 10.1.1.3 with netmask 255.255.0.0, the file
706 should still be called 10.1.1.3, and not 10.1.0.0.
707
708
709 @c ==================================================================
710 @node    Runtime options,  , Managing keys, Running tinc
711 @section Runtime options
712
713 Besides the settings in the configuration file, tinc also accepts some
714 command line options.
715
716 This list is a longer version of that in the manpage. The latter is
717 generated automatically, so may be more up-to-date.
718
719 @c from the manpage
720 @table @asis
721 @item -c, --config=FILE
722 Read configuration options from FILE. The default is
723 @file{/etc/tinc/nn/tinc.conf}.
724
725 @item -d
726 Increase debug level. The higher it gets, the more gets
727 logged. Everything goes via syslog.
728
729 0 is the default, only some basic information connection attempts get
730 logged. Setting it to 1 will log a bit more, still not very
731 disturbing. With two -d's tincd will log protocol information, which can
732 get pretty noisy. Three or more -d's will output every single packet
733 that goes out or comes in, which probably generates more data than the
734 packets themselves.
735
736 @item -k, --kill
737 Attempt to kill a running tincd and exit. A TERM signal (15) gets sent
738 to the daemon that his its PID in /var/run/tinc.nn.pid.
739
740 Because it kills only one tincd, you should use -n here if you use it
741 normally.
742
743 @item -n, --net=NETNAME
744 Connect to net NETNAME. @xref{Multiple networks}.
745
746 @item -t, --timeout=TIMEOUT
747 Seconds to wait before giving a timeout. Should not be set too low,
748 because every time tincd senses a timeout, it disconnects and reconnects
749 again, which will cause unnecessary network traffic and log messages.
750
751 @item --help
752 Display a short reminder of these runtime options and terminate.
753
754 @item --version
755 Output version information and exit.
756
757 @end table
758
759
760 @c ==================================================================
761 @node    Technical information, About us, Running tinc, Top
762 @chapter Technical information
763
764
765 @c ==================================================================
766 @menu
767 * The Connection::              
768 * Security::                    
769 @end menu
770
771 @node    The Connection, Security, Technical information, Technical information
772 @section The basic philosophy of the way tinc works
773 @cindex Connection
774
775 tinc is a daemon that takes VPN data and transmit that to another host
776 computer over the existing Internet infrastructure.
777
778 @menu
779 * Protocol Preview::            
780 * The Meta-connection::         
781 @end menu
782
783
784 @c ==================================================================
785 @node    Protocol Preview, The Meta-connection, The Connection, The Connection
786 @subsection A preview of the way the tinc works
787
788 @cindex ethertap
789 @cindex frame type
790 The data itself is read from a character device file, the so-called
791 @emph{ethertap} device. This device is associated with a network
792 interface. Any data sent to this interface can be read from the device,
793 and any data written to the device gets sent from the interface. Data to
794 and from the device is formatted as if it were a normal ethernet card,
795 so a frame is preceded by two MAC addresses and a @emph{frame type}
796 field.
797
798 So when tinc reads an ethernet frame from the device, it determines its
799 type. Right now, tinc can only handle Internet Protocol version 4 (IPv4)
800 frames. Plans to support other protocols are being made. When tinc knows
801 which type of frame it has read, it can also read the source and
802 destination address from it.
803
804 Now it is time that the frame gets encrypted. Currently the only
805 encryption algorithm available is blowfish.
806
807 @cindex encapsulating
808 When the encryption is ready, time has come to actually transport the
809 packet to the destination computer. We do this by sending the packet
810 over an UDP connection to the destination host. This is called
811 @emph{encapsulating}, the VPN packet (though now encrypted) is
812 encapsulated in another IP datagram.
813
814 When the destination receives this packet, the same thing happens, only
815 in reverse. So it does a decrypt on the contents of the UDP datagram,
816 and it writes the decrypted information to its own ethertap device.
817
818
819 @c ==================================================================
820 @node    The Meta-connection,  , Protocol Preview, The Connection
821 @subsection The meta-connection
822
823 Having only an UDP connection available is not enough. Though suitable
824 for transmitting data, we want to be able to reliably send other
825 information, such as routing and encryption information to somebody.
826
827 TCP is a better alternative, because it already contains protection
828 against information being lost, unlike UDP.
829
830 So we establish two connections. One for the encrypted VPN data, and one
831 for other information, the meta-data. Hence, we call the second
832 connection the meta-connection. We can now be sure that the
833 meta-information doesn't get lost on the way to another computer.
834
835 @cindex data-protocol
836 @cindex meta-protocol
837 Like with any communication, we must have a protocol, so that everybody
838 knows what everything stands for, an how he should react. Because we
839 have two connections, we also have two protocols. The protocol used for
840 the UDP data is the ``data-protocol,'' the other one is the
841 ``meta-protocol.''
842
843 The reason we don't use TCP for both protocols is that UDP is much
844 better for encapsulation, even while it is less reliable. The real
845 problem is that when TCP would be used to encapsulate a TCP stream
846 that's on the private network, for every packet sent there would be
847 three ACK's sent instead of just one. Furthermore, if there would be
848 a timeout, both TCP streams would sense the timeout, and both would
849 start resending packets.
850
851 @c ==================================================================
852 @node    Security,  , The Connection, Technical information
853 @section About tinc's encryption and other security-related issues.
854
855 @cindex tinc
856 @cindex Cabal
857 tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
858 alleged Cabal was/is an organization that was said to keep an eye on the
859 entire Internet. As this is exactly what you @emph{don't} want, we named
860 the tinc project after TINC.
861
862 @cindex SVPN
863 But in order to be ``immune'' to eavesdropping, you'll have to encrypt
864 your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
865 exactly that: encrypt.
866
867 This chapter is a mixture of ideas, reasoning and explanation, please
868 don't take it too serious.
869
870 @menu
871 * Key Types::
872 * Key Management::              
873 * Authentication::              
874 * Protection::                  
875 @end menu
876
877 @c ==================================================================
878 @node    Key Types, Key Management, Security, Security
879 @subsection Key Types
880 @c FIXME: check if I'm not talking nonsense
881
882 There are several types of encryption keys. Tinc uses two of them,
883 symmetric private keypairs and public/private keypairs.
884
885 Public/private keypairs are used in public key cryptography. It enables
886 someone to send out a public key with which other people can encrypt their
887 data. The encrypted data now can only be decrypted by the person who has
888 the private key that matches the public key. So, a public key only allows
889 @emph{other} people to send encrypted messages to you. This is very useful
890 in setting up private communications channels. Just send out your public key
891 and other people can talk to you in a secure way. But how can you know
892 the other person is who he says he is?
893
894 For authentication itself tinc uses symmetric private keypairs, referred
895 to as a passphrase. The identity of each tinc daemon is defined by it's
896 passphrase (like you can be identified by your social security number).
897 Every tinc daemon that is allowed to connect to you has a copy of your
898 passphrase (hence symmetrical).
899
900 It would also be possible to use public/private keypairs for authentication,
901 so that you could shout out your public key and don't need to keep it
902 secret (like the passphrase you would have to send to someone else). Also,
903 no one else has to know a private key from you.
904 Both forms have their pros and cons, and at the moment tinc just uses passphrases
905 (which are computationaly more efficient and perhaps in some way more
906 secure).
907
908 @c ==================================================================
909 @node    Key Management, Authentication, Key Types, Security
910 @subsection Key Management
911 @c FIXME: recheck
912 @c I did, it sounds sane :) [guus]
913
914 @cindex Diffie-Hellman
915 You can't just send a private encryption key to your peer, because
916 somebody else might already be listening to you. So you'll have to
917 negotiate over a shared but secret key. One way to do this is by using
918 the ``Diffie-Hellman key exchange'' protocol
919 (@uref{http://www.rsa.com/rsalabs/faq/html/3-6-1.html}). The idea is as
920 follows.
921
922 You have two participants A and B that want to agree over a shared
923 secret encryption key. Both parties have some large prime number p and a
924 generator g. These numbers may be known to the outside world, and hence
925 may be included in the source distribution.
926
927 @cindex secret key
928 Both parties then generate a secret key. A generates a, and computes g^a
929 mod p. This is then sent to B; while B computes g^b mod p, and transmits
930 this to A, b being generated by B. Both a and b must be smaller than
931 p-1.
932
933 Both parties then calculate g^ab mod p = k. k is the new, shared, but
934 still secret key.
935
936 To obtain a key k of a sufficient length (128 bits in our vpnd), p
937 should be 2^129-1 or more.
938
939
940 @c ==================================================================
941 @node    Authentication, Protection, Key Management, Security
942 @subsection Authentication
943 @c FIXME: recheck
944
945 @cindex man-in-the-middle attack
946 Because the Diffie-Hellman protocol is in itself vulnerable to the
947 ``man-in-the-middle attack,'' we should introduce an authentication
948 system.
949
950 We will let A transmit a passphrase that is also known to B encrypted
951 with g^a, before A sends this to B. This way, B can check whether A is
952 really A or just someone else.
953 B will never receive the real passphrase though, because it was
954 encrypted using public/private keypairs. This way there is no way an
955 imposter could steal A's passphrase.
956
957 @cindex passphrase
958 @c ehrmz... but we only use 1024 bits passphrases ourselves? [guus]
959 This passphrase should be 2304 bits for a symmetric encryption
960 system. But since an asymmetric system is more secure, we could do with
961 2048 bits. This only holds if the passphrase is very random. 
962
963 These passphrases could be stored in a file that is non-readable by
964 anyone else but root; e.g. @file{/etc/tinc/passphrases} with UID 0
965 and permissions mode 700.
966
967 The only thing that needs to be taken care of is how A can securely send
968 a copy of it's passphrase to B if B doesn't have it yet. This could be
969 done via mail with PGP, but you should be really convinced of the
970 identity of the person who owns the email address you are sending this to.
971 Swapping floppy disks in real life might be the best way to do this!
972
973
974 @c ==================================================================
975 @node    Protection,  , Authentication, Security
976 @subsection Protecting your data
977
978 Now we have securely hidden our data. But a malicious cracker may still
979 bother you by randomly altering the encrypted data he intercepts.
980
981
982 @c ==================================================================
983 @node    About us, Concept Index, Technical information, Top
984 @chapter About us
985
986
987 @menu
988 * Contact Information::         
989 * Authors::                     
990 @end menu
991
992
993 @c ==================================================================
994 @node    Contact Information, Authors, About us, About us
995 @section Contact information
996
997 tinc's main page is at @url{http://tinc.nl.linux.org/},
998 this server is located in the Netherlands.
999
1000 We have an IRC channel on the Open Projects IRC network. Connect to
1001 @uref{http://openprojects.nu/services/irc.html, irc.openprojects.net},
1002 and join channel #tinc.
1003
1004
1005 @c ==================================================================
1006 @node    Authors,  , Contact Information, About us
1007 @section Authors
1008
1009 @table @asis
1010 @item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com})
1011 Main coder/hacker and maintainer of the package.
1012
1013 @item Guus Sliepen (guus)
1014 Originator of it all, co-author.
1015
1016 @item Wessel Dankers (Ubiq)
1017 General obfuscater of the code.
1018
1019 @end table
1020
1021 Thank you's to: Dekan, Emphyrio, vDong
1022
1023 Greetings to: braque, Fluor, giggles, macro, smoke, tribbel
1024
1025
1026 @c ==================================================================
1027 @node    Concept Index,  , About us, Top
1028 @c        node-name,    next, previous,        up
1029 @unnumbered Concept Index
1030
1031 @c ==================================================================
1032 @printindex cp
1033
1034
1035 @c ==================================================================
1036 @contents
1037 @bye
1038