1 \input texinfo @c -*-texinfo-*-
10 This is the info manual for tinc, a Virtual Private Network daemon.
12 Copyright 1998 Ivo Timmermans <itimmermans@@bigfoot.com>
14 Permission is granted to make and distribute verbatim
15 copies of this manual provided the copyright notice and
16 this permission notice are preserved on all copies.
18 Permission is granted to copy and distribute modified
19 versions of this manual under the conditions for
20 verbatim copying, provided
21 that the entire resulting derived work is distributed
22 under the terms of a permission notice identical to this
29 @subtitle Setting up a Virtual Private Network with tinc
30 @author Ivo Timmermans <itimmermans@@bigfoot.com>
33 @vskip 0pt plus 1filll
34 Copyright @copyright{} 1998 Ivo Timmermans <itimmermans@@bigfoot.com>
36 Permission is granted to make and distribute verbatim
37 copies of this manual provided the copyright notice and
38 this permission notice are preserved on all copies.
40 Permission is granted to copy and distribute modified
41 versions of this manual under the conditions for
42 verbatim copying, provided
43 that the entire resulting derived work is distributed
44 under the terms of a permission notice identical to this
49 @c ==================================================================
50 @node Top, Introduction, (dir), (dir)
53 * Introduction:: Introduction
54 * Configuring a Linux system:: Before compiling tinc
58 * Technical information::
60 * Concept Index:: All used terms explained
63 @c ==================================================================
64 @node Introduction, Configuring a Linux system, Top, Top
67 @c straight from the www page
69 tinc is a Virtual Private Network (VPN) daemon that uses tunneling and
70 encryption to create a secure private network between hosts on the
73 Because the tunnel appears to the IP level network code as a normal
74 network device, there is no need to adapt any existing software.
76 This tunneling allows VPN sites to share information with eachother
77 over the Internet without exposing any information to others.
79 This document is the manual for tinc. Included are chapters on how to
80 configure your computer to use tinc, as well as the configuration
81 process of tinc itself.
84 * VPNs:: Virtual Private Networks in general
88 @c ==================================================================
89 @node VPNs, tinc, Introduction, Introduction
90 @section Virtual Private Networks
92 A Virtual Private Network or VPN is a network that can only be accessed
93 by a few elected computers that participate. This goal is achievable in
94 more than just one way.
97 For instance, a VPN can consist of a single standalone ethernet LAN. Or
98 even two computers hooked up using a nullmodem cable@footnote{Though
99 discussable, I think it qualifies as a VPN.}. In these cases, it is
100 obvious that the network is @emph{private}. But there is another type
101 of VPN, the type tinc was made for.
104 tinc uses normal IP datagrams to encapsulate data that goes over the VPN
105 network link. In this case it's also clear that the network is
106 @emph{virtual}, because no direct network link has to exist between to
109 As is the case with either type of VPN, anybody could eavesdrop. Or
110 worse, alter data. Hence it's probably advisable to encrypt the data
111 that flows over the network.
114 @c ==================================================================
115 @node tinc, , VPNs, Introduction
118 I really don't quite remember what got us started, but it must have been
119 Guus' idea. He wrote a simple implementation (about 50 lines of C) that
120 used the @emph{ethertap} device that linux knows of since somewhere
121 about kernel 2.1.60. It didn't work immediately and he improved it a
122 bit. At this stage, the project was still simply called @samp{vpnd}.
124 Since then, a lot has changed---to say the least.
127 tinc now supports encryption, it consists of a single daemon (tincd) for
128 both the receiving and sending end, it hase becom largely
129 runtime-configurable---in short, it has become a full-fledged
130 professional package.
132 A lot can---and will be---changed. I have a few things that I'd like to
133 see in the future releases of tinc. Not everything will be available in
134 the near future. Our first objective is to make tinc work perfectly as
135 it stands, and then add more advanced features.
137 Meanwhile, we're always open-minded towards new ideas. And we're
141 @c ==================================================================
142 @node Configuring a Linux system, Installing tinc, Introduction, Top
143 @chapter Configuring a Linux system
145 This chapter contains information on how a Linux system is configured
149 * Configuring the kernel::
151 * Setting up the devices::
155 @c ==================================================================
156 @node Configuring the kernel, Files Needed, Configuring a Linux system, Configuring a Linux system
157 @section Configuring the kernel
159 Since this particular implementation only runs on 2.1 or higher Linux
160 kernels, you should grab one (2.2 is current at this time). A 2.0 port
161 is not really possible, unless someone tells me someone ported the
162 ethertap and netlink devices back to 2.0.
164 If you are unfamiliar with the process of configuring and compiling a
165 new kernel, you should read the
166 @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel
167 HOWTO} first. Do that now!
169 Here are the options you have to turn on/off when configuring a new
173 Code maturity level options
174 [*] Prompt for development and/or incomplete code/drivers
176 [*] Kernel/User netlink socket
177 <*> Netlink device emulation
178 Network device support
179 <*> Ethertap network tap
182 Any other options not mentioned here are not relevant to tinc. If you
183 decide to build any of these as dynamic kernel modules, it's a good idea
184 to add these lines to @file{/etc/modules.conf}.
188 alias char-major-36 netlink_dev
191 Finally, after having set up other options, build the kernel and boot
192 it. Unfortunately it's not possible to insert these modules in a running
196 @c ==================================================================
197 @node Files Needed, Setting up the devices, Configuring the kernel, Configuring a Linux system
198 @section Files Needed
200 @subsubheading Device files
202 First, you'll need the special device file(s) that form the interface
203 between the kernel and the daemon.
206 mknod -m 600 /dev/tap0 c 36 16
210 The permissions now will be such that only the super user may read/write
211 to this file. You'd want this, because otherwise eavesdropping would
212 become a tad too easy. This does, however, imply that you'd have to run
215 If you want to, you may also create more device files, which would be
216 numbered 0...15, with minor device numbers 16...31. They all should be
217 owned by root and have permission 600.
220 @subsubheading @file{/etc/networks}
222 You may add a line to @file{/etc/networks} so that your vpn will get a
223 symoblic name. For example:
230 @subsubheading @file{/etc/services}
232 You may add this line to @file{/etc/services}. The effect is that you
233 may supply a @samp{vpn} as a valid port number to some programs. The
234 number 655 is registered with the IANA.
239 # Ivo Timmermans <itimmermans@@bigfoot.com>
243 @c ==================================================================
244 @node Setting up the devices, , Files Needed, Configuring a Linux system
245 @section Setting up the devices
247 Before you can start transmitting data over the tinc tunnel, you must
248 set up the ethertap network devices.
250 First, decide which IP addresses you want to have associated with these
251 devices, and what network mask they must have. You also need these
252 numbers when you are going to configure tinc itself. @xref{Configuring
255 It doesn't matter much which part you do first, setting up the network
256 devices or configure tinc. But they both have to be done before you try
259 The actual setup of the ethertap device is quite simple, just repeat
263 ifconfig tap@emph{n} hw ether fe:fd:@emph{xx}:@emph{xx}:@emph{xx}:@emph{xx}
266 The @emph{n} here is the number of the ethertap device you want to
267 use. It should be the same @emph{n} as the one you use for
268 @file{/dev/tap@emph{n}}. The @emph{xx}s are four hexadecimal numbers
269 (0--ff). With previous versions of tincd, it didn't matter what they
270 were. But newer kernels require properly set up ehternet addresses.
271 In fact, the old behaviour was wrong. It is required that the @emph{xx}s
275 ifconfig tap@emph{n} @emph{IP} netmask @emph{mask}
278 This will activate the device with an IP address @emph{IP} with network
283 @c ==================================================================
284 @node Installing tinc, Configuring tinc, Configuring a Linux system, Top
285 @chapter Installing tinc
287 First download it. This is the
288 @uref{http://tinc.nl.linux.org/download.html, download
289 page}, which has the checksums of these files listed; you may wish to
290 check these with md5sum before continuing.
292 tinc comes in a handy autoconf/automake package, which you can just
293 treat the same as any other package. Which is just untar it, type
294 `configure' and then `make'.
296 More detailed instructions are in the file @file{INSTALL}, which is
297 included in the source distribution.
300 @c ==================================================================
301 @node Configuring tinc, Running tinc, Installing tinc, Top
302 @chapter Configuring tinc
305 * Multiple networks::
306 * How connections work::
307 * Configuration file::
312 @c ==================================================================
313 @node Multiple networks, How connections work, Configuring tinc, Configuring tinc
314 @section Multiple networks
318 It is perfectly ok for you to run more than one tinc daemon.
319 However, in its default form, you will soon notice that you can't use
320 two different configuration files without the -c option.
322 We have thought of another way of dealing with this: network names. This
323 means that you call tincd with the -n argument, which will assign a name
326 The effect of this is that the daemon will set its configuration
327 ``root'' to /etc/tinc/nn/, where nn is your argument to the -n
328 option. You'll notice that it appears in syslog as ``tincd.nn''.
330 However, it is not strictly necessary that you call tinc with the -n
331 option. In this case, the network name would just be empty, and it will
332 be used as such. tinc now looks for files in /etc/tinc/, instead of
333 /etc/tinc/nn/; the configuration file should be /etc/tinc/tincd.conf,
334 and the passphrases are now expected to be in /etc/tinc/passphrases/.
336 But it is highly recommended that you use this feature of tinc, because
337 it will be so much clearer whom your daemon talks to. Hence, we will
338 assume that you use it.
341 @c ==================================================================
342 @node How connections work, Configuration file, Multiple networks, Configuring tinc
343 @section How connections work
345 Before going on, first a bit on how tinc sees connections.
347 When tinc starts up, it reads in the configuration file and parses the
348 commandline options. If it sees a `ConnectTo' value in the file, it will
349 try to connect to it, on the given port. If this fails, tinc exits.
352 @c ==================================================================
353 @node Configuration file, Example, How connections work, Configuring tinc
354 @section Configuration file
356 The actual configuration of the daemon is done in the file
357 @file{/etc/tinc/nn/tincd.conf}.
359 This file consists of comments (lines started with a #) or assignments
366 The variable names are case insensitive, and any spaces, tabs, newlines
367 and carriage returns are ignored. Note: it is not required that you put
368 in the `=' sign, but doing so improves readability. If you leave it
369 out, remember to replace it with at least one space character.
375 @c ==================================================================
376 @node Variables, , Configuration file, Configuration file
377 @subsection Variables
379 Here are all valid variables, listed in alphabetical order:
381 @c straight from the manpage
383 @item AllowConnect = (yes|no)
384 If set to yes, anyone may try to connect to you. If you set this to no,
385 no incoming connections will be accepted. This does not affect the
386 outgoing connections.
388 @item ConnectPort = port
389 Connect to the upstream host (given with the ConnectTo directive) on
390 port port. port may be given in decimal (default), octal (when preceded
391 by a single zero) or hexadecimal (prefixed with 0x). port is the port
392 number for both the UDP and the TCP (meta) connections.
394 @item ConnectTo = (IP address|hostname)
395 Specifies which host to connect to on startup. If the ConnectPort
396 variable is omitted, then tinc will try to connect to port 655.
398 If you don't specify a host with ConnectTo, regardless of whether a
399 value for ConnectPort is given, tinc won't connect at all, and will
400 instead just listen for incoming connections. Only the initiator of a
401 tinc VPN should need this.
403 @item ListenPort = port
404 Listen on local port port. The computer connecting to this daemon should
405 use this number as the argument for his ConnectPort. Again, the
408 @item MyOwnVPNIP = local address[/maskbits]
409 The local address is the number that the daemon will propagate to
410 other daemons on the network when it is identifying itself. Hence this
411 will be the file name of the passphrase file that the other end expects
412 to find the passphrase in.
414 The local address is the IP address of the tap device, not the real IP
415 address of the host running tincd. Due to changes in recent kernels, it
416 is also necessary that you make the ethernet (also known as MAC) address
417 equal to the IP address (see the example).
419 maskbits is the number of bits set to 1 in the netmask part.
421 @item MyVirtualIP = local address[/maskbits]
422 This is an alias for MyOwnVPNIP.
424 @item Passphrases = directory
425 The directory where tinc will look for passphrases when someone tries to
426 cennect. Please see the manpage for genauth(8) for more information
427 about passphrases as used by tinc.
429 @item PingTimeout = number
430 The number of seconds of inactivity that tinc will wait before sending a
431 probe to the other end. If that other end doesn't answer within that
432 same amount of seconds, the connection is terminated, and the others
433 will be notified of this.
435 @item TapDevice = device
436 The ethertap device to use. Note that you can only use one device per
437 daemon. The info pages of the tinc package contain more information
438 about configuring an ethertap device for linux.
443 @c ==================================================================
444 @node Example, , Configuration file, Configuring tinc
447 Imagine the following situation. An A-based company wants to connect
448 three branch offices in B, C and D using the internet. All four offices
449 have a 24/7 connection to the internet.
451 A is going to serve as the center of the network. B and C will connect
452 to A, and D will connect to C. Each office will be assigned their own IP
456 A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
457 B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
458 C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
459 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
462 ``gateway'' is the VPN IP address of the machine that is running the
463 tincd. ``internet IP'' is the IP address of the firewall, which does not
464 need to run tincd, but it must do a port forwarding of TCP&UDP on port
465 655 (unless otherwise configured).e
467 In this example, it is assumed that eth0 is the interface that points to
468 the inner LAN of the office. This could be the same as the interface
469 that leads to the internet.
473 @emph{A} would be configured like this:
476 ifconfig tap0 hw ether fe:fd:0a:01:36:01
477 ifconfig tap0 10.1.54.1 netmask 255.0.0.0
478 ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
481 and in /etc/tinc/tincd.conf:
484 TapDevice = /dev/tap0
485 MyVirtualIP = 10.1.54.1/16
491 ifconfig tap0 hw ether fe:fd:0a:02:01:0c
492 ifconfig tap0 10.2.1.12 netmask 255.0.0.0
493 ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
496 and in /etc/tinc/tincd.conf:
499 TapDevice = /dev/tap0
500 MyVirtualIP = 10.2.1.12/16
505 Note here that the internal address (on eth0) doesn't have to be the
506 same as on the tap0 device. Also, ConnectTo is given so that no-one can
507 connect to this node.
512 ifconfig tap0 hw ether fe:fd:0a:03:45:fe
513 ifconfig tap0 10.3.69.254 netmask 255.0.0.0
514 ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
517 and in /etc/tinc/A/tincd.conf:
520 MyVirtualIP = 10.3.69.254/16
525 C already has another daemon that runs on port 655, so they have to
526 reserve another port for tinc. They also use the netname to distinguish
527 between the two. tinc is started with `tincd -n A'.
532 ifconfig tap0 hw ether fe:fd:0a:04:03:20
533 ifconfig tap0 10.4.3.32 netmask 255.0.0.0
534 ifconfig tap0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
537 and in /etc/tinc/tincd.conf:
540 MyVirtualIP = 10.4.3.32/16
546 D will be connecting to C, which has a tincd running for this network on
547 port 2000. Hence they need to put in a ConnectPort.
549 @subsubheading Authentication
551 A, B, C and D all generate a passphrase with genauth 2048, the output is
552 stored in /etc/tinc/passphrases/local, except for C, where it should be
553 /etc/tinc/A/passphrases/local.
555 A stores a copy of B's passphrase in /etc/tinc/passphrases/10.2.0.0
557 A stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.0.0
559 B stores a copy of A's passphrase in /etc/tinc/passphrases/10.1.0.0
561 C stores a copy of A's passphrase in /etc/tinc/A/passphrases/10.1.0.0
563 C stores a copy of D's passphrase in /etc/tinc/A/passphrases/10.4.0.0
565 D stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.0.0
567 @subsubheading Starting
569 A has to start their tincd first. Then come B and C, where C has to
570 provide the option `-n A', because they have more than one tinc
571 network. Finally, D's tincd is started.
575 @c ==================================================================
576 @node Running tinc, Technical information, Configuring tinc, Top
577 @chapter Running tinc
579 Running tinc isn't just as easy as typing `tincd' and hoping everything
580 will just work out the way you wanted. Instead, the use of tinc is a
581 project that involves trust relations and more than one computer.
589 @c ==================================================================
590 @node Managing keys, Runtime options, Running tinc, Running tinc
591 @section Managing keys
593 Before attempting to start tinc, you have to create passphrases. When
594 tinc tries to make a connection, it exchanges some sensitive
595 data. Before doing so, it likes to know if the other end is
598 To do this, both ends must have some knowledge about the other. In the
599 case of tinc this is the authentication passphrase.
601 This passphrase is a number, which is chosen at random. This number is
602 then sent to the other computers which want to talk to us directly. To
603 avoid breaking security, this should be done over a known secure channel
604 (such as ssh or similar).
606 All passphrases are stored in the passphrases directory, which is
607 normally /etc/tinc/nn/passphrases/, but it may be changed using the
608 `Passphrases' option in the config file.
610 To generate a passphrase, run `genauth'. genauth takes one argument,
611 which is the length of the passphrase in bits. The length of the
612 passphrase should be in the range 1024--2048 for a key length of 128
613 bits. genauth creates a random number of the specified length, and puts
616 Every computer that wants to participate in the VPN should do this, and
617 store the output in the passphrases directory, in the file @file{local}.
619 When every computer has his own local key, it should copy it to the
620 computer that it wants to talk to directly. (i.e. the one it connects to
621 during startup.) This should be done via a secure channel, because it is
622 sensitive information. If this is not done securely, someone might break
625 Those non-local passphrase files must have the name of the VPN IP
626 address that they will advertise to you. For instance, if a computer
627 tells us it likes to be 10.1.1.3 with netmask 255.255.0.0, the file
628 should still be called 10.1.1.3, and not 10.1.0.0.
631 @c ==================================================================
632 @node Runtime options, , Managing keys, Running tinc
633 @section Runtime options
635 Besides the settings in the configuration file, tinc also accepts some
636 command line options.
638 This list is a longer version of that in the manpage. The latter is
639 generated automatically, so may be more up-to-date.
643 @item -c, --config=FILE
644 Read configuration options from FILE. The default is
645 @file{/etc/tinc/nn/tincd.conf}.
648 Increase debug level. The higher it gets, the more gets
649 logged. Everything goes via syslog.
651 0 is the default, only some basic information connection attempts get
652 logged. Setting it to 1 will log a bit more, still not very
653 disturbing. With two -d's tincd will log protocol information, which can
654 get pretty noisy. Three or more -d's will output every single packet
655 that goes out or comes in, which probably generates more data than the
659 Attempt to kill a running tincd and exit. A TERM signal (15) gets sent
660 to the daemon that his its PID in /var/run/tincd.nn.pid.
662 Because it kills only one tincd, you should use -n here if you use it
665 @item -n, --net=NETNAME
666 Connect to net NETNAME. @xref{Multiple networks}.
668 @item -t, --timeout=TIMEOUT
669 Seconds to wait before giving a timeout. Should not be set too low,
670 because every time tincd senses a timeout, it disconnects and reconnects
671 again, which will cause unnecessary network traffic and log messages.
674 Display a short reminder of these runtime options and terminate.
677 Output version information and exit.
682 @c ==================================================================
683 @node Technical information, About us, Running tinc, Top
684 @chapter Technical information
687 @c ==================================================================
694 @node The Connection, Security, Technical information, Technical information
695 @section The basic philosophy of the way tinc works
698 tinc is a daemon that takes VPN data and transmit that to another host
699 computer over the existing Internet infrastructure.
703 * The Meta-connection::
707 @c ==================================================================
708 @node Protocol Preview, The Meta-connection, The Connection, The Connection
709 @subsection A preview of the way the tinc works
713 The data itself is read from a character device file, the so-called
714 @emph{ethertap} device. This device is associated with a network
715 interface. Any data sent to this interface can be read from the device,
716 and any data written to the device gets sent from the interface. Data to
717 and from the device is formatted as if it were a normal ethernet card,
718 so a frame is preceded by two MAC addresses and a @emph{frame type}
721 So when tinc reads an ethernet frame from the device, it determines its
722 type. Right now, tinc can only handle Internet Protocol version 4 (IPv4)
723 frames. Plans to support other protocols are being made. When tinc knows
724 which type of frame it has read, it can also read the source and
725 destination address from it.
727 Now it is time that the frame gets encrypted. Currently the only
728 encryption algorithm available is blowfish.
730 @cindex encapsulating
731 When the encryption is ready, time has come to actually transport the
732 packet to the destination computer. We do this by sending the packet
733 over an UDP connection to the destination host. This is called
734 @emph{encapsulating}, the VPN packet (though now encrypted) is
735 encapsulated in another IP datagram.
737 When the destination receives this packet, the same thing happens, only
738 in reverse. So it does a decrypt on the contents of the UDP datagram,
739 and it writes the decrypted information to its own ethertap device.
742 @c ==================================================================
743 @node The Meta-connection, , Protocol Preview, The Connection
744 @subsection The meta-connection
746 Having only a UDP connection available is not enough. Though suitable
747 for transmitting data, we want to be able to reliably send other
748 information, such as routing and encryption information to somebody.
750 TCP is a better alternative, because it already contains protection
751 against information being lost, unlike UDP.
753 So we establish two connections. One for the encrypted VPN data, and one
754 for other information, the meta-data. Hence, we call the second
755 connection the meta-connection. We can now be sure that the
756 meta-information doesn't get lost on the way to another computer.
758 @cindex data-protocol
759 @cindex meta-protocol
760 Like with any communication, we must have a protocol, so that everybody
761 knows what everything stands for, an how he should react. Because we
762 have two connections, we also have two protocols. The protocol used for
763 the UDP data is the ``data-protocol,'' the other one is the
767 @c ==================================================================
768 @node Security, The Protocol, The Connection, Technical information
769 @section About tinc's encryption and other security-related issues.
773 tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
774 alleged Cabal was/is an organization that was said to keep an eye on the
775 entire Internet. As this is exactly what you @emph{don't} want, we named
776 the tinc project after TINC.
779 But in order to be ``immune'' to eavesdropping, you'll have to encrypt
780 your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
781 exactly that: encrypt.
783 This chapter is a mixture of ideas, reasoning and explanation, please
784 don't take it too serious.
789 * Authentification:: How to be sure we're talking to the right person
794 @c ==================================================================
795 @node Encryption, Key Management, Security, Security
796 @subsection Encryption
798 Encryption algorithms come in lots of flavors, most of which are not
799 safe enough to use on the Internet, if at all. Algorithms that we've
800 considered using are: RSA, blowfish, twofish and IDEA.
805 @emph{RSA} is patented. A fee must be paid if you use it, so it can't
806 be used in an Open Source program.
810 @emph{blowfish} was the standard encryption method at least up to version
811 0.2.23, but as Dekan pointed out, it may not be all that secure. It is
812 also patented, but it may be used freely.
816 @emph{twofish} should be better, but i've not seen a useable
817 ready-to-use implementation somewhere out of the US. I'll remember this
818 as a future encryption method.
822 @emph{IDEA} is patented, and free for non-commercial use. It is going to
823 be the standard encryption method.
827 You may choose any of the last three encryption methods in tinc. Please
828 note, however, that ALL computers on your VPN must currenttly use the
829 same. This should (among other things) be more flexible, tinc could for
830 instance load a new encryption library the minute it is needed.
833 @c ==================================================================
834 @node Key Management, Authentification, Encryption, Security
835 @subsection Key Management
838 @cindex Diffie-Hellman
839 You can't just send a private encryption key to your peer, because
840 somebody else might already be listening to you. So you'll have to
841 negotiate over a shared but secret key. One way to do this is by using
842 the ``Diffie-Hellman key exchange'' protocol
843 (@uref{http://www.rsa.com/rsalabs/faq/html/3-6-1.html}). The idea is as
846 You have two participants A and B that want to agree over a shared
847 secret encryption key. Both parties have some large prime number p and a
848 generator g. These numbers may be known to the outside world, and hence
849 may be included in the source distribution.
852 Both parties then generate a secret key. A generates a, and computes g^a
853 mod p. This is then sent to B; while B computes g^b mod p, and transmits
854 this to A, b being generated by B. Both a and b must be smaller than
857 These private keys are generated upon startup, and they are not changed
858 while the connection exists. A possible feature in the future is to
859 dynamically change the keys, every hour for example.
861 Both parties then calculate g^ab mod p = k. k is the new, shared, but
864 To obtain a key k of a sufficient length (128 bits in our vpnd), p
865 should be 2^129-1 or more.
868 @c ==================================================================
869 @node Authentification, Protection, Key Management, Security
870 @subsection Authentification
873 @cindex man-in-the-middle attack
874 Because the Diffie-Hellman protocol is in itself vulnerable to the
875 ``man-in-the-middle attack,'' we should introduce an authentification
878 We will let A transmit a passphrase that is also known to B encrypted
879 with g^a, before A sends this to B. This way, B can check whether A is
880 really A or just someone else.
883 This passphrase should be 2304 bits for a symmetric encryption
884 system. But since an asymmetric system is more secure, we could do with
885 2048 bits. This only holds if the passphrase is very random.
887 These passphrases could be stored in a file that is non-readable by
888 anyone else but root; e.g. @file{/etc/vpn/passphrases}.
890 The only thing that needs to be taken care of is how A announces its
894 @c ==================================================================
895 @node Protection, , Authentification, Security
896 @subsection Protecting your data
898 Now we have securely hidden our data. But a malicious cracker may still
899 bother you by randomly altering the encrypted data he intercepts.
902 @c ==================================================================
903 @node The Protocol, , Security, Technical information
904 @section Detailed protocol specifications
913 @c ==================================================================
914 @node Data protocol, Meta protocol, The Protocol, The Protocol
915 @subsection The data protocol
917 The data that is sent through the UDP connection is formatted as follows:
922 ----------------------
923 0-1 | The length of this packet, including all leading fields
924 2-5 | The destination IP address
925 6-... | The encrypted data
929 The method that was used to encrypt the data should be made known via
930 the meta-protocol, during early identification stages.
933 @c ==================================================================
934 @node Meta protocol, , Data protocol, The Protocol
935 @subsection The Meta protocol
937 This protocol consists of separate packets of enformation, that are
938 generally formatted thusly:
943 ----------------------
945 1-... | (Optional: arguments)
949 What follows is a listing of possible request IDs.
953 Acknowledge. This generally means that the authentication has been
954 accepted by the remote computer. Takes no arguments.
959 ----------------------
966 Obsolete. Use @samp{BASIC_INFO}.
970 Obsolete. Use @samp{PASSPHRASE}.
974 Obsolete. Use @samp{PUBLIC_KEY}, @samp{REQ_KEY} and @samp{ANS_KEY}.
978 Obsolete. Use @samp{ACK}.
981 A request to terminate this connection, for whatever reason.
986 ----------------------
988 1-4 | The VPN IP address of the host that has exited
994 Terminate connection, but the reason must be a ping timeout.
999 ----------------------
1001 1-4 | The VPN IP address of the host that has exited
1007 Send probe to the other end, if he hasn't returned a @samp{PONG} within
1008 10 seconds, the connection is considered to be dead and will be
1009 terminated, we should try to notify the other by sending a
1010 @samp{PINGTIMEOUT} packet.
1015 ----------------------
1022 See explanation for @samp{PING}
1027 ----------------------
1034 Send an @samp{ADD_HOST} packet if you want to propagate all your current
1035 connections to a new computer on a network. If we get this request, we
1036 must forward it to everyone that hasn't got it yet.
1041 ----------------------
1043 1-4 | The real IP address of the new host
1044 5-8 | The VPN IP address of the new host
1045 9-12 | The VPN netmask
1046 13-14 | The port number that the new host listens on
1052 This packet will contain all necessary basic information about
1053 ourselves, such as the port we listen on and our desired VPN IP address.
1058 ----------------------
1060 1 | The protocol version.
1061 | This chapter describes version 4.
1062 2-3 | The port number that the new host listens on
1063 4-7 | The VPN IP address of the new host
1064 8-11 | The VPN netmask
1070 Send an encrypted passphrase. Should be encrypted with our
1071 @strong{public} key, and it must reach us before a @samp{PUBLIC_KEY}
1077 ----------------------
1079 1-2 | The length of the encrypted passphrase
1080 3-... | The encrypted passphrase
1086 This is only used during authentication of a new connection, later on we
1087 may use @samp{REQ_KEY} and @samp{ANS_KEY}.
1092 ----------------------
1094 1-2 | The length of the key
1095 3-... | The public key, given in base-36
1110 Request a public key from someone and return it to the sender of this
1111 request using a @samp{ANS_KEY} packet. If we get such request, we must
1112 forward it to the connection that leads to the destination.
1117 ----------------------
1119 1-4 | The source VPN IP address
1120 5-8 | The destination VPN IP address
1127 Answer to a @samp{REQ_KEY} request, forward it to the destination if it
1128 is not meant for us.
1133 ----------------------
1135 1-4 | The source VPN IP address
1136 5-8 | The destination VPN IP address
1137 9-12 | The expiration date/time in seconds
1138 13-14 | The key length
1139 15-... | The public key in base-36
1145 The source computer wants to tell that it has regenerated its private
1146 and public keys, so anything going there must be encrypted with a new
1152 ----------------------
1154 1-4 | The source VPN IP address
1162 @c ==================================================================
1163 @node About us, Concept Index, Technical information, Top
1168 * Contact Information::
1173 @c ==================================================================
1174 @node Contact Information, Authors, About us, About us
1175 @section Contact information
1177 tinc's main page is at @url{http://tinc.nl.linux.org/},
1178 this server is located in the Netherlands.
1180 We have an IRC channel on the Open Projects IRC network. Connect to
1181 @uref{http://openprojects.nu/services/irc.html, irc.openprojects.net},
1182 and join channel #tinc.
1185 @c ==================================================================
1186 @node Authors, , Contact Information, About us
1190 @item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com})
1191 Main coder/hacker and maintainer of the package.
1193 @item Guus Sliepen (guus)
1194 Originator of it all, co-author.
1196 @item Wessel Dankers (Ubiq)
1197 General obfuscator of the code.
1201 Thank you's to: Dekan, Emphyrio, vDong
1203 Greetings to: braque, Fluor, giggles, macro, smoke, tribbel
1206 @c ==================================================================
1207 @node Concept Index, , About us, Top
1208 @c node-name, next, previous, up
1209 @unnumbered Concept Index
1211 @c ==================================================================
1215 @c ==================================================================