--- gvpe/doc/gvpe.texi 2006/01/18 13:15:07 1.1 +++ gvpe/doc/gvpe.texi 2011/02/15 13:31:22 1.5 @@ -20,7 +20,7 @@ This is the info manual for vpe, the Virtual Private Ethernet daemon. -Copyright @copyright{} 2003-2005 Marc Lehmann . +Copyright @copyright{} 2003-2008 Marc Lehmann . Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -35,13 +35,13 @@ @titlepage @title gvpe Manual -@author Marc Lehmann (template by Ivo Timmermans and Guus Sliepen) +@author Marc Lehmann @page @vskip 0pt plus 1filll @cindex copyright -Copyright @copyright{} 2003-2005 Marc Lehmann . +Copyright @copyright{} 2003-2008 Marc Lehmann . Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -100,9 +100,7 @@ @item -@b{ -@cindex Virtual -Virtual} +Virtual Virtual means that no physical network is created (of course), but a network is @emph{emulated} by creating multiple tunnels between the member nodes by encapsulating and sending data over another transport network. @refill @@ -111,9 +109,7 @@ @item -@b{ -@cindex Private -Private} +Private Private means that non-participating nodes cannot decode ("sniff)" nor inject ("spoof") packets. This means that nodes can be connected over untrusted networks such as the public Internet without fear of being eavesdropped while at the same time being able to trust data sent by other nodes. @refill @@ -122,13 +118,11 @@ @item -@b{ -@cindex Network -Network} +Network -Network means that more than two parties can participate in the network, so for instance it's possible to connect multiple branches of a company into a single network. Many so-called "vpn" solutions only create point-to-point tunnels, which in turn can be used to build larger networks. +Network means that more than two parties can participate in the network, so for instance it's possible to connect multiple branches of a company into a single network. Many so-called "VPN" solutions only create point-to-point tunnels, which in turn can be used to build larger networks. @refill -GVPE provides a true multi-point network in wich any number of nodes (at least a few dozen in practise, the theoretical limit is 4095 nodes) can participate. +GVPE provides a true multi-point network in which any number of nodes (at least a few dozen in practise, the theoretical limit is 4095 nodes) can participate. @refill @end itemize @@ -141,21 +135,21 @@ @item -@b{SIMPLE DESIGN} +SIMPLE DESIGN Cipher, HMAC algorithms and other key parameters must be selected at compile time - this makes it possible to only link in algorithms you actually need. It also makes the crypto part of the source very transparent and easy to inspect, and last not least this makes it possible to hardcode the layout of all packets into the binary. GVPE goes a step further and internally reserves blocks of the same length for all packets, which virtually removes all possibilities of buffer overflows, as there is only a single type of buffer and it's always of fixed length. @refill @item -@b{EASY TO SETUP} +EASY TO SETUP A few lines of config (the config file is shared unmodified between all hosts) and a single run of @t{gvpectrl} to generate the keys suffices to make it work. @refill @item -@b{MAC-BASED SECURITY} +MAC-BASED SECURITY Since every host has it's own private key, other hosts cannot spoof traffic from this host. That makes it possible to filter packet by MAC address, e.g. to ensure that packets from a specific IP address come, in fact, from a specific host that is associated with that IP and not from another host. @refill @@ -164,7 +158,7 @@ @section PROGRAMS -Vpe comes with two programs: one daemon (@t{gvpe}) and one control program (@t{gvpectrl}). +Gvpe comes with two programs: one daemon (@t{gvpe}) and one control program (@t{gvpectrl}). @refill @@ -172,16 +166,16 @@ @item -@b{gvpectrl} +gvpectrl -Is used to generate the keys, check and give an overview of of the configuration and contorl the daemon (restarting etc.). +This program is used to generate the keys, check and give an overview of of the configuration and to control the daemon (restarting etc.). @refill @item -@b{gvpe} +gvpe -Is the daemon used to establish and maintain connections to the other network members. It should be run on the gateway machine. +This is the daemon used to establish and maintain connections to the other network nodes. It should be run on the gateway of each VPN subnet. @refill @end itemize @@ -190,7 +184,9 @@ @section COMPILETIME CONFIGURATION Please have a look at the @t{gvpe.osdep(5)} manpage for platform-specific information. @refill -Here are a few recipes for compiling your gvpe, showing the extremes (fast, small, insecure OR slow, large, more secure), between you should choose: +Gvpe hardcodes most encryption parameters. While this reduces flexibility, it makes the program much simpler and helps making buffer overflows impossible under most circumstances. +@refill +Here are a few recipes for compiling your gvpe, showing the extremes (fast, small, insecure OR slow, large, more secure), between which you should choose: @refill @@ -201,7 +197,7 @@ ./configure --enable-hmac-length=4 --enable-rand-length=0 @end example -Minimize the header overhead of VPN packets (the above will result in only 4 bytes of overhead over the raw ethernet frame). This is a insecure configuration because a HMAC length of 4 makes collision attacks based on the birthday paradox easy, though. +Minimize the header overhead of VPN packets (the above will result in only 4 bytes of overhead over the raw ethernet frame). This is a insecure configuration because a HMAC length of 4 makes collision attacks based on the birthday paradox pretty easy. @refill @@ -212,7 +208,7 @@ ./configure --enable-cipher=bf --enable-digest=md4 @end example -Use the fastest cipher and digest algorithms currently available in gvpe. MD4 has been broken and is quite insecure, though. +Use the fastest cipher and digest algorithms currently available in gvpe. MD4 has been broken and is quite insecure, though, so using another digest algorithm is recommended. @refill @@ -223,9 +219,9 @@ ./configure --enable-hmac-length=16 --enable-rand-length=8 --enable-digest=sha1 @end example -This uses a 16 byte HMAC checksum to authenticate packets (I guess 8-12 would also be pretty secure ;) and will additionally prefix each packet with 8 bytes of random data. In the long run, people should move to SHA-224 and beyond, but support in openssl is missing as of writing this document. +This uses a 16 byte HMAC checksum to authenticate packets (I guess 8-12 would also be pretty secure ;) and will additionally prefix each packet with 8 bytes of random data. In the long run, people should move to SHA-256 and beyond). @refill -In general, remember that AES-128 seems to be more secure and faster than AES-192 or AES-256, more randomness helps against sniffing and a longer HMAC helps against spoofing. MD4 is a fast digest, SHA1 or RIPEMD160 are better, and Blowfish is a fast cipher (and also quite secure). +In general, remember that AES-128 seems to be as secure but faster than AES-192 or AES-256, more randomness helps against sniffing and a longer HMAC helps against spoofing. MD4 is a fast digest, SHA1, RIPEMD160, SHA256 are consecutively better, and Blowfish is a fast cipher (and also quite secure). @refill @@ -235,7 +231,7 @@ @subsection STEP 1: configuration -First you have to create a daemon configuation file and put it into the configuration directory. This is usually @t{/etc/gvpe}, depending on how you configured gvpe, and can be overwritten using the @t{-c} commandline switch. +First you have to create a daemon configuration file and put it into the configuration directory. This is usually @t{/etc/gvpe}, depending on how you configured gvpe, and can be overwritten using the @t{-c} command line switch. @refill Put the following lines into @t{/etc/gvpe/gvpe.conf}: @refill @@ -245,30 +241,18 @@ udp-port = 50000 # the external port to listen on (configure your firewall) mtu = 1400 # minimum MTU of all outgoing interfaces on all hosts ifname = vpn0 # the local network device name -@end example - - -@example node = first # just a nickname hostname = first.example.net # the DNS name or IP address of the host -@end example - - -@example node = second hostname = 133.55.82.9 -@end example - - -@example node = third hostname = third.example.net @end example -The only other file neccessary if the @t{if-up} script that initializes the local ethernet interface. Put the following lines into @t{/etc/gvpe/if-up} and make it execute (@t{chmod 755 /etc/gvpe/if-up}): +The only other file necessary is the @t{if-up} script that initializes the virtual ethernet interface on the local host. Put the following lines into @t{/etc/gvpe/if-up} and make it executable (@t{chmod 755 /etc/gvpe/if-up}): @refill @@ -281,14 +265,14 @@ ip route add 10.0.0.0/16 dev $IFNAME @end example -This script will give each node a different IP address in the @t{10.0/16} network. The internal network (e.g. the @t{eth0} interface) should then be set to a subset of that network, e.g. @t{10.0.1.0/24} on node @t{first}, @t{10.0.2.0/24} on node @t{second}, and so on. +This script will give each node a different IP address in the @t{10.0/16} network. The internal network (if gvpe runs on a router) should then be set to a subset of that network, e.g. @t{10.0.1.0/24} on node @t{first}, @t{10.0.2.0/24} on node @t{second}, and so on. @refill -By enabling routing on the gateway host that runs @t{gvpe} all nodes will be able to reach the other nodes. You can, of course, also use proxy arp or other means of pseudo-bridging (or even real briding), or (best) full routing - the choice is yours. +By enabling routing on the gateway host that runs @t{gvpe} all nodes will be able to reach the other nodes. You can, of course, also use proxy ARP or other means of pseudo-bridging, or (best) full routing - the choice is yours. @refill @subsection STEP 2: create the RSA key pairs for all hosts -Run the following command to generate all key pairs (that might take a while): +Run the following command to generate all key pairs for all nodes (that might take a while): @refill @@ -301,7 +285,9 @@ @subsection STEP 3: distribute the config files to all nodes -Now distribute the config files to the other nodes. This should be done in two steps, since the private keys should not be distributed. The example uses rsync-over-ssh +Now distribute the config files and private keys to the other nodes. This should be done in two steps, since only the private keys meant for a node should be distributed (so each node has only it's own private key). +@refill +The example uses rsync-over-ssh @refill First all the config files without the hostkeys should be distributed: @refill @@ -323,7 +309,7 @@ rsync -avzessh /etc/gvpe/hostkeys/third third.example.net:/etc/hostkey @end example -You should now check the configration by issuing the command @t{gvpectrl -c /etc/gvpe -s} on each node and verify it's output. +You should now check the configuration by issuing the command @t{gvpectrl -c /etc/gvpe -s} on each node and verify it's output. @refill @@ -333,14 +319,14 @@ @example - gvpe -D -linfo first # first is the nodename + gvpe -D -l info first # first is the nodename @end example -This will make the gvpe stay in foreground. You should then see "connection established" messages. If you don't see them check your firewall and routing (use tcpdump ;). +This will make the gvpe daemon stay in foreground. You should then see "connection established" messages. If you don't see them check your firewall and routing (use tcpdump ;). @refill If this works you should check your networking setup by pinging various endpoints. @refill -To make gvpe run more permanently you can either run it as a daemon (by starting it without the @t{-D} switch), or, much better, from your inittab. I use a line like this on my systems: +To make gvpe run more permanently you can either run it as a daemon (by starting it without the @t{-D} switch), or, much better, from your inittab or equivalent. I use a line like this on all my systems: @refill @@ -378,7 +364,7 @@ @section TUN vs. TAP interface -Most operating systems nowadays support something called a @emph{tunnel}-device, which makes it possible to divert IPv4 (and often other protocols, too) into a userspace daemon like @t{gvpe}. This is being referred to as a TUN-device. +Most operating systems nowadays support something called a @emph{tunnel}-device, which makes it possible to divert IPv4 (and often other protocols, too) into a user space daemon like @t{gvpe}. This is being referred to as a TUN-device. @refill This is fine for point-to-point tunnels, but for a virtual ethernet, an additional ethernet header is needed. This functionality (called a TAP device here) is only provided by a subset of the configurations. @refill @@ -550,7 +536,7 @@ @refill See @t{tincd/netbsd} for more information. @refill -Completely unstested so far. +Completely untested so far. @refill @@ -571,9 +557,9 @@ @subsection tincd/uml_socket -TAP-device; purpose unknown and untested, probably creates a unix datagram socket (path given by @t{ifname}) and reads and writes raw packets, so might be useful in other than UML contexts. +TAP-device; purpose unknown and untested, probably creates a UNIX datagram socket (path given by @t{ifname}) and reads and writes raw packets, so might be useful in other than UML contexts. @refill -No network interface is created, and the MAC and MTU must be set as approriate on the other side of the socket. GVPE will exit if the MAC address doesn't match what it expects. +No network interface is created, and the MAC and MTU must be set as appropriate on the other side of the socket. GVPE will exit if the MAC address doesn't match what it expects. @refill Completely untested so far. @refill @@ -598,29 +584,21 @@ @example + # global options for all nodes udp-port = 407 mtu = 1492 ifname = vpn0 -@end example - - -@example + # first node is named branch1 and is at 1.2.3.4 node = branch1 hostname = 1.2.3.4 -@end example - - -@example + # second node uses dns to resolve the address node = branch2 hostname = www.example.net udp-port = 500 # this host uses a different udp-port -@end example - - -@example + # third node has no fixed ip address node = branch3 connect = ondemand @end example @@ -632,22 +610,24 @@ @refill The only exception to the above is the "on" directive that can prefix any @t{name = value} setting and will only "execute" it on the named node, or (if the nodename starts with "!") on all nodes except the named one. @refill +For example, set the MTU to @t{1450} everywhere, loglevel to @t{noise} on branch1, and connect to @t{ondemand} everywhere but on branch2: +@refill @example - name = value + mtu = 1450 on branch1 loglevel = noise on !branch2 connect = ondemand @end example -All settings are executed "in order", that is, later settings of the same variable overwrite earlier ones. +All settings are applied "in order", that is, later settings of the same variable overwrite earlier ones. @refill @section ANATOMY OF A CONFIG FILE -Usually, a config file starts with global settings (like the udp port to listen on), followed by node-specific sections that begin with a @t{node = nickname} line. +Usually, a config file starts with a few global settings (like the UDP port to listen on), followed by node-specific sections that begin with a @t{node = nickname} line. @refill -Every node that is part of the network must have a section that starts with @t{node = nickname}. The number and order of the nodes is important and must be the same on all hosts. It is not uncommon for node sections to be completely empty - if the default values are right. +Every node that is part of the network must have a section that starts with @t{node = nickname}. The number and order of the nodes is important and must be the same on all nodes. It is not uncommon for node sections to be completely empty - if the default values are right. @refill Node-specific settings can be used at any time. If used before the first node section they will set the default values for all following nodes. @refill @@ -665,15 +645,15 @@ @item -@b{dns-forw-host = hostname/ip} +dns-forw-host = hostname/ip @cindex dns-forw-host -The dns server to forward dns requests to for the DNS tunnel protocol (default: @t{127.0.0.1}, changing it is highly recommended). +The DNS server to forward DNS requests to for the DNS tunnel protocol (default: @t{127.0.0.1}, changing it is highly recommended). @refill @item -@b{dns-forw-port = port-number} +dns-forw-port = port-number @cindex dns-forw-port The port where the @t{dns-forw-host} is to be contacted (default: @t{53}, which is fine in most cases). @@ -681,54 +661,54 @@ @item -@b{dns-max-outstanding = integer-number-of-requests} +dns-max-outstanding = integer-number-of-requests @cindex dns-max-outstanding The maximum number of outstanding DNS transport requests (default: @t{100}). GVPE will never issue more requests then the given limit without receiving replies. In heavily overloaded situations it might help to set this to a low number (e.g. @t{3} or even @t{1}) to limit the number of parallel requests. @refill -The default should be working ok for most links. +The default should be working OK for most links. @refill @item -@b{dns-overlap-factor = float} +dns-overlap-factor = float @cindex dns-overlap-factor The DNS transport uses the minimum request latency (@strong{min_latency}) seen during a connection as it's timing base. This factor (default: @t{0.5}, must be > 0) is multiplied by @strong{min_latency} to get the maximum sending rate (= minimum send interval), i.e. a factor of @t{1} means that a new request might be generated every @strong{min_latency} seconds, which means on average there should only ever be one outstanding request. A factor of @t{0.5} means that GVPE will send requests twice as often as the minimum latency measured. @refill -For congested or picky dns forwarders you could use a value nearer to or exceeding @t{1}. +For congested or picky DNS forwarders you could use a value nearer to or exceeding @t{1}. @refill -The default should be working ok for most links. +The default should be working OK for most links. @refill @item -@b{dns-send-interval = send-interval-in-seconds} +dns-send-interval = send-interval-in-seconds @cindex dns-send-interval The minimum send interval (= maximum rate) that the DNS transport will use to send new DNS requests. GVPE will not exceed this rate even when the latency is very low. The default is @t{0.01}, which means GVPE will not send more than 100 DNS requests per connection per second. For high-bandwidth links you could go lower, e.g. to @t{0.001} or so. For congested or rate-limited links, you might want to go higher, say @t{0.1}, @t{0.2} or even higher. @refill -The default should be working ok for most links. +The default should be working OK for most links. @refill @item -@b{dns-timeout-factor = float} +dns-timeout-factor = float @cindex dns-timeout-factor Factor to multiply the @t{min_latency} (see @t{dns-overlap-factor}) by to get request timeouts. The default of @t{8} means that the DNS transport will resend the request when no reply has been received for longer than eight times the minimum (= expected) latency, assuming the request or reply has been lost. @refill For congested links a higher value might be necessary (e.g. @t{30}). If the link is very stable lower values (e.g. @t{2}) might work nicely. Values near or below @t{1} makes no sense whatsoever. @refill -The default should be working ok for most links. +The default should be working OK for most links but will result in low throughput if packet loss is high. @refill @item -@b{if-up = relative-or-absolute-path} +if-up = relative-or-absolute-path @cindex if-up -Sets the path of a script that should be called immediately after the network interface is initialized (but not neccessarily up). The following environment variables are passed to it (the values are just examples). +Sets the path of a script that should be called immediately after the network interface is initialized (but not necessarily up). The following environment variables are passed to it (the values are just examples). @refill Variables that have the same value on all nodes: @refill @@ -738,7 +718,7 @@ @item -@b{CONFBASE=/etc/gvpe} +CONFBASE=/etc/gvpe @cindex CONFBASE The configuration base directory. @@ -746,7 +726,7 @@ @item -@b{IFNAME=vpn0} +IFNAME=vpn0 @cindex IFNAME The network interface to initialize. @@ -754,13 +734,13 @@ @item -@b{IFTYPE=native # or tincd} +IFTYPE=native # or tincd @cindex IFTYPE @item -@b{IFSUBTYPE=linux # or freebsd, darwin etc..} +IFSUBTYPE=linux # or freebsd, darwin etc.. @cindex IFSUBTYPE The interface type (@t{native} or @t{tincd}) and the subtype (usually the OS name in lowercase) that this GVPE was configured for. Can be used to select the correct syntax to use for network-related commands. @@ -768,15 +748,15 @@ @item -@b{MTU=1436} +MTU=1436 @cindex MTU -The MTU to set the interface to. You can use lower values (if done consistently on all hosts), but this is usually ineffective. +The MTU to set the interface to. You can use lower values (if done consistently on all nodes), but this is usually either inefficient or simply ineffective. @refill @item -@b{NODES=5} +NODES=5 @cindex NODES The number of nodes in this GVPE network. @@ -791,7 +771,7 @@ @item -@b{IFUPDATA=string} +IFUPDATA=string @cindex IFUPDATA The value of the configuration directive @t{if-up-data}. @@ -799,17 +779,17 @@ @item -@b{MAC=fe:fd:80:00:00:01} +MAC=fe:fd:80:00:00:01 @cindex MAC The MAC address the network interface has to use. @refill -Might be used to initialize interfaces on platforms where GVPE does not do this automatically. Please see the @t{gvpe.osdep(5)} manpage for platform-specific information. +Might be used to initialize interfaces on platforms where GVPE does not do this automatically. Please see the @t{gvpe.osdep(5)} man page for platform-specific information. @refill @item -@b{NODENAME=branch1} +NODENAME=branch1 @cindex NODENAME The nickname of the node. @@ -817,7 +797,7 @@ @item -@b{NODEID=1} +NODEID=1 @cindex NODEID The numerical node ID of the node running this instance of GVPE. The first node mentioned in the config file gets ID 1, the second ID 2 and so on. @@ -838,12 +818,12 @@ ip route add 10.0.0.0/8 dev $IFNAME @end example -More complicated examples (using routing to reduce arp traffic) can be found in the etc/ subdirectory of the distribution. +More complicated examples (using routing to reduce ARP traffic) can be found in the @file{etc/} subdirectory of the distribution. @refill @item -@b{ifname = devname} +ifname = devname @cindex ifname Sets the tun interface name to the given name. The default is OS-specific and most probably something like @t{tun0}. @@ -851,7 +831,7 @@ @item -@b{ifpersist = yes|true|on | no|false|off} +ifpersist = yes|true|on | no|false|off @cindex ifpersist Should the tun/tap device be made persistent, that is, should the device stay up even when gvpe exits? Some versions of the tunnel device have problems sending packets when gvpe is restarted in persistent mode, so if the connections can be established but you cannot send packets from the local node, try to set this to @t{off} and do an ifconfig down on the device. @@ -859,28 +839,30 @@ @item -@b{ip-proto = numerical-ip-protocol} +ip-proto = numerical-ip-protocol @cindex ip-proto -Sets the protocol number to be used for the rawip protocol. This is a global option because all hosts must use the same protocol, and since there are no port numbers, you cannot easily run more than one gvpe instance using the same protocol, nor can you share the protocol with other programs. +Sets the protocol number to be used for the rawip protocol. This is a global option because all nodes must use the same protocol, and since there are no port numbers, you cannot easily run more than one gvpe instance using the same protocol, nor can you share the protocol with other programs. +@refill +The default is 47 (GRE), which has a good chance of tunneling through firewalls (but note that gvpe's rawip protocol is not GRE compatible). Other common choices are 50 (IPSEC, ESP), 51 (IPSEC, AH), 4 (IPIP tunnels) or 98 (ENCAP, rfc1241). @refill -The default is 47 (GRE), which has a good chance of tunneling through firewalls (but note that the rawip protocol is not GRE compatible). Other common choices are 50 (IPSEC, ESP), 51 (IPSEC, AH), 4 (IPIP tunnels) or 98 (ENCAP, rfc1241) +Many versions of Linux seem to have a bug that causes them to reorder packets for some ip protocols (GRE, ESP) but not for others (AH), so choose wisely (that is, use 51, AH). @refill @item -@b{http-proxy-host = hostname/ip} +http-proxy-host = hostname/ip @cindex http-proxy-host The @t{http-proxy-*} family of options are only available if gvpe was compiled with the @t{--enable-http-proxy} option and enable tunneling of tcp connections through a http proxy server. @refill @t{http-proxy-host} and @t{http-proxy-port} should specify the hostname and port number of the proxy server. See @t{http-proxy-loginpw} if your proxy requires authentication. @refill -Please note that gvpe will still try to resolve all hostnames in the configuration file, so if you are behind a proxy without access to a dns server better use numerical IP addresses. +Please note that gvpe will still try to resolve all hostnames in the configuration file, so if you are behind a proxy without access to a DNS server better use numerical IP addresses. @refill -To make best use of this option disable all protocols except tcp in your config file and make sure your routers (or all other hosts) are listening on a port that the proxy allows (443, https, is a common choice). +To make best use of this option disable all protocols except TCP in your config file and make sure your routers (or all other nodes) are listening on a port that the proxy allows (443, https, is a common choice). @refill -If you have a router, connecting to it will suffice. Otherwise tcp must be enabled on all hosts. +If you have a router, connecting to it will suffice. Otherwise TCP must be enabled on all nodes. @refill Example: @refill @@ -895,7 +877,7 @@ @item -@b{http-proxy-port = proxy-tcp-port} +http-proxy-port = proxy-tcp-port @cindex http-proxy-port The port where your proxy server listens. @@ -903,23 +885,23 @@ @item -@b{http-proxy-auth = login:password} +http-proxy-auth = login:password @cindex http-proxy-auth -The optional login and password used to authenticate to the proxy server, seperated by a literal colon (@t{:}). Only basic authentication is currently supported. +The optional login and password used to authenticate to the proxy server, separated by a literal colon (@t{:}). Only basic authentication is currently supported. @refill @item -@b{keepalive = seconds} +keepalive = seconds @cindex keepalive -Sets the keepalive probe interval in seconds (default: @t{60}). After this many seconds of inactivity the daemon will start to send keepalive probe every 5 seconds until it receives a reply from the other end. If no reply is received within 30 seconds, the peer is considered unreachable and the connection is closed. +Sets the keepalive probe interval in seconds (default: @t{60}). After this many seconds of inactivity the daemon will start to send keepalive probe every 3 seconds until it receives a reply from the other end. If no reply is received within 15 seconds, the peer is considered unreachable and the connection is closed. @refill @item -@b{loglevel = noise|trace|debug|info|notice|warn|error|critical} +loglevel = noise|trace|debug|info|notice|warn|error|critical @cindex loglevel Set the logging level. Connection established messages are logged at level @t{info}, notable errors are logged with @t{error}. Default is @t{info}. @@ -927,19 +909,19 @@ @item -@b{mtu = bytes} +mtu = bytes @cindex mtu -Sets the maximum MTU that should be used on outgoing packets (basically the MTU of the outgoing interface) The daemon will automatically calculate maximum overhead (e.g. udp header size, encryption blocksize...) and pass this information to the @t{if-up} script. +Sets the maximum MTU that should be used on outgoing packets (basically the MTU of the outgoing interface) The daemon will automatically calculate maximum overhead (e.g. UDP header size, encryption blocksize...) and pass this information to the @t{if-up} script. @refill Recommended values are 1500 (ethernet), 1492 (pppoe), 1472 (pptp). @refill -This value must be the minimum of the mtu values of all hosts. +This value must be the minimum of the MTU values of all nodes. @refill @item -@b{node = nickname} +node = nickname @cindex node Not really a config setting but introduces a node section. The nickname is used to select the right configuration section and must be passed as an argument to the gvpe daemon. @@ -947,10 +929,12 @@ @item -@b{node-up = relative-or-absolute-path} +node-up = relative-or-absolute-path @cindex node-up -Sets a command (default: no script) that should be called whenever a connection is established (even on rekeying operations). In addition to all the variables passed to @t{if-up} scripts, the following environment variables will be set: +Sets a command (default: none) that should be called whenever a connection is established (even on rekeying operations). Note that node-up/down scripts will be run asynchronously, but execution is serialised, so there will only ever be one such script running. +@refill +In addition to all the variables passed to @t{if-up} scripts, the following environment variables will be set (values are just examples): @refill @@ -958,7 +942,7 @@ @item -@b{DESTNODE=branch2} +DESTNODE=branch2 @cindex DESTNODE The name of the remote node. @@ -966,7 +950,7 @@ @item -@b{DESTID=2} +DESTID=2 @cindex DESTID The node id of the remote node. @@ -974,30 +958,38 @@ @item -@b{DESTIP=188.13.66.8} +DESTSI=rawip/88.99.77.55:0 + +@cindex DESTSI +The "socket info" of the target node, protocol dependent but usually in the format protocol/ip:port. +@refill + + +@item +DESTIP=188.13.66.8 @cindex DESTIP -The numerical IP address of the remote host (gvpe accepts connections from everywhere, as long as the other host can authenticate itself). +The numerical IP address of the remote node (gvpe accepts connections from everywhere, as long as the other node can authenticate itself). @refill @item -@b{DESTPORT=655 # deprecated} +DESTPORT=655 # deprecated @cindex DESTPORT -The UDP port used by the other side. +The protocol port used by the other side, if applicable. @refill @item -@b{STATE=UP} +STATE=up @cindex STATE -Node-up scripts get called with STATE=UP, node-down scripts get called with STATE=DOWN. +Node-up scripts get called with STATE=up, node-change scripts get called with STATE=change and node-down scripts get called with STATE=down. @refill @end itemize -Here is a nontrivial example that uses nsupdate to update the name => ip mapping in some dns zone: +Here is a nontrivial example that uses nsupdate to update the name => ip mapping in some DNS zone: @refill @@ -1013,7 +1005,15 @@ @item -@b{node-down = relative-or-absolute-path} +node-change = relative-or-absolute-path + +@cindex node-change +Same as @t{node-change}, but gets called whenever something about a connection changes (such as the source IP address). +@refill + + +@item +node-down = relative-or-absolute-path @cindex node-down Same as @t{node-up}, but gets called whenever a connection is lost. @@ -1021,7 +1021,7 @@ @item -@b{pid-file = path} +pid-file = path @cindex pid-file The path to the pid file to check and create (default: @t{LOCALSTATEDIR/run/gvpe.pid}). @@ -1029,21 +1029,37 @@ @item -@b{private-key = relative-path-to-key} +private-key = relative-path-to-key @cindex private-key Sets the path (relative to the config directory) to the private key (default: @t{hostkey}). This is a printf format string so every @t{%} must be doubled. A single @t{%s} is replaced by the hostname, so you could use paths like @t{hostkeys/%s} to fetch the files at the location where @t{gvpectrl} puts them. @refill -Since only the private key file of the current node is used and the private key file should be kept secret per-host to avoid spoofings, it is not recommended to use this feature. +Since only the private key file of the current node is used and the private key file should be kept secret per-node to avoid spoofing, it is not recommended to use this feature. @refill @item -@b{rekey = seconds} +rekey = seconds @cindex rekey -Sets the rekeying interval in seconds (default: @t{3600}). Connections are reestablished every @t{rekey} seconds. +Sets the rekeying interval in seconds (default: @t{3600}). Connections are reestablished every @t{rekey} seconds, making them use a new encryption key. +@refill + + +@item +nfmark = integer + +@cindex nfmark +This advanced option, when set to a nonzero value (default: @t{0}), tries to set the netfilter mark (or fwmark) value on all sockets gvpe uses to send packets. @refill +This can be used to make gvpe use a different set of routing rules. For example, on GNU/Linux, the @t{if-up} could set @t{nfmark} to 1000 and then put all routing rules into table @t{99} and then use an ip rule to make gvpe traffic avoid that routing table, in effect routing normal traffic via gvpe and gvpe traffic via the normal system routing tables: +@refill + + +@example + ip rule add not fwmark 1000 lookup 99 +@end example + @end itemize @@ -1057,7 +1073,7 @@ @item -@b{allow-direct = nodename} +allow-direct = nodename @cindex allow-direct Allow direct connections to this node. See @t{deny-direct} for more info. @@ -1065,45 +1081,47 @@ @item -@b{compress = yes|true|on | no|false|off} +compress = yes|true|on | no|false|off @cindex compress -Wether to compress data packets sent to this host (default: @t{yes}). Compression is really cheap even on slow computers and has no size overhead at all, so enabling this is a good idea. +For the current node, this specified whether it will accept compressed packets, and for all other nodes, this specifies whether to try to compress data packets sent to this node (default: @t{yes}). Compression is really cheap even on slow computers, has no size overhead at all and will only be used when the other side supports compression, so enabling this is often a good idea. @refill @item -@b{connect = ondemand | never | always | disabled} +connect = ondemand | never | always | disabled @cindex connect -Sets the connect mode (default: @t{always}). It can be @t{always} (always try to establish and keep a connection to the given host), @t{never} (never initiate a connection to the given host, but accept connections), @t{ondemand} (try to establish a connection on the first packet sent, and take it down after the keepalive interval) or @t{disabled} (node is bad, don't talk to it). +Sets the connect mode (default: @t{always}). It can be @t{always} (always try to establish and keep a connection to the given node), @t{never} (never initiate a connection to the given host, but accept connections), @t{ondemand} (try to establish a connection when there are outstanding packets in the queue and take it down after the keepalive interval) or @t{disabled} (node is bad, don't talk to it). +@refill +Routers will automatically be forced to @t{always} unless they are @t{disabled}, to ensure all nodes can talk to each other. @refill @item -@b{deny-direct = nodename | *} +deny-direct = nodename | * @cindex deny-direct Deny direct connections to the specified node (or all nodes when @t{*} is given). Only one node can be specified, but you can use multiple @t{allow-direct} and @t{deny-direct} statements. This only makes sense in networks with routers, as routers are required for indirect connections. @refill -Sometimes, a node cannot reach some other nodes for reasons of network connectivity. For example, a node behind a firewall that only allows conenctions to/from a single other node in the network. In this case one should specify @t{deny-direct = *} and @t{allow-direct = othernodename} (the other node @emph{must} be a router for this to work). +Sometimes, a node cannot reach some other nodes for reasons of network connectivity. For example, a node behind a firewall that only allows connections to/from a single other node in the network. In this case one should specify @t{deny-direct = *} and @t{allow-direct = othernodename} (the other node @emph{must} be a router for this to work). @refill -The algorithm to check wether a connection may be direct is as follows: +The algorithm to check whether a connection may be direct is as follows: @refill -1. Other node mentioned in a @t{allow-direct}? If yes, allow the connection. +1. Other node mentioned in an @t{allow-direct}? If yes, allow the connection. @refill 2. Other node mentioned in a @t{deny-direct}? If yes, deny direct connections. @refill 3. Allow the connection. @refill -That is, @t{allow-direct} takes precende over @t{deny-direct}. +That is, @t{allow-direct} takes precedence over @t{deny-direct}. @refill The check is done in both directions, i.e. both nodes must allow a direct connection before one is attempted, so you only need to specify connect limitations on one node. @refill @item -@b{dns-domain = domain-suffix} +dns-domain = domain-suffix @cindex dns-domain The DNS domain suffix that points to the DNS tunnel server for this node. @@ -1129,7 +1147,7 @@ @item -@b{dns-hostname = hostname/ip} +dns-hostname = hostname/ip @cindex dns-hostname The address to bind the DNS tunnel socket to, similar to the @t{hostname}, but for the DNS tunnel protocol only. Default: @t{0.0.0.0}, but that might change. @@ -1137,7 +1155,7 @@ @item -@b{dns-port = port-number} +dns-port = port-number @cindex dns-port The port to bind the DNS tunnel socket to. Must be @t{53} on DNS tunnel servers. @@ -1145,7 +1163,7 @@ @item -@b{enable-dns = yes|true|on | no|false|off} +enable-dns = yes|true|on | no|false|off @cindex enable-dns See gvpe.protocol(7) for a description of the DNS transport protocol. Avoid this protocol if you can. @@ -1155,17 +1173,17 @@ @item -@b{enable-icmp = yes|true|on | no|false|off} +enable-icmp = yes|true|on | no|false|off @cindex enable-icmp See gvpe.protocol(7) for a description of the ICMP transport protocol. @refill -Enable the ICMP transport using icmp packets of type @t{icmp-type} on this node. +Enable the ICMP transport using ICMP packets of type @t{icmp-type} on this node. @refill @item -@b{enable-rawip = yes|true|on | no|false|off} +enable-rawip = yes|true|on | no|false|off @cindex enable-rawip See gvpe.protocol(7) for a description of the RAW IP transport protocol. @@ -1175,7 +1193,7 @@ @item -@b{enable-tcp = yes|true|on | no|false|off} +enable-tcp = yes|true|on | no|false|off @cindex enable-tcp See gvpe.protocol(7) for a description of the TCP transport protocol. @@ -1185,37 +1203,39 @@ @item -@b{enable-udp = yes|true|on | no|false|off} +enable-udp = yes|true|on | no|false|off @cindex enable-udp See gvpe.protocol(7) for a description of the UDP transport protocol. @refill Enable the UDPv4 transport using the @t{udp-port} port (default: @t{no}, unless no other protocol is enabled for a node, in which case this protocol is enabled automatically). @refill -NOTE: Please specify @t{enable-udp = yes} if you want t use it even though it might get switched on automatically, as some future version might default to another default protocol. +NOTE: Please specify @t{enable-udp = yes} if you want to use it even though it might get switched on automatically, as some future version might default to another default protocol. @refill @item -@b{hostname = hostname | ip [can not be defaulted]} +hostname = hostname | ip [can not be defaulted] @cindex hostname -Forces the address of this node to be set to the given dns hostname or ip address. It will be resolved before each connect request, so dyndns should work fine. If this setting is not specified and a router is available, then the router will be queried for the address of this node. Otherwise, the connection attempt will fail. +Forces the address of this node to be set to the given DNS hostname or IP address. It will be resolved before each connect request, so dyndns should work fine. If this setting is not specified and a router is available, then the router will be queried for the address of this node. Otherwise, the connection attempt will fail. +@refill +Note that DNS resolving is done synchronously, pausing the daemon. If that is an issue you need to specify IP addresses. @refill @item -@b{icmp-type = integer} +icmp-type = integer @cindex icmp-type Sets the type value to be used for outgoing (and incoming) packets sent via the ICMP transport. @refill -The default is @t{0} (which is @t{echo-reply}, also known as "ping-replies"). Other useful values include @t{8} (@t{echo-request}, a.k.a. "ping") and @t{11} (@t{time-exceeded}), but any 8-bit value can be used. +The default is @t{0} (which is @t{echo-reply}, also known as "ping-reply"). Other useful values include @t{8} (@t{echo-request}, a.k.a. "ping") and @t{11} (@t{time-exceeded}), but any 8-bit value can be used. @refill @item -@b{if-up-data = value} +if-up-data = value @cindex if-up-data The value specified using this directive will be passed to the @t{if-up} script in the environment variable @t{IFUPDATA}. @@ -1223,35 +1243,57 @@ @item -@b{inherit-tos = yes|true|on | no|false|off} +inherit-tos = yes|true|on | no|false|off @cindex inherit-tos -Wether to inherit the TOS settings of packets sent to the tunnel when sending packets to this node (default: @t{yes}). If set to @t{yes} then outgoing tunnel packets will have the same TOS setting as the packets sent to the tunnel device, which is usually what you want. +Whether to inherit the TOS settings of packets sent to the tunnel when sending packets to this node (default: @t{yes}). If set to @t{yes} then outgoing tunnel packets will have the same TOS setting as the packets sent to the tunnel device, which is usually what you want. @refill @item -@b{max-retry = positive-number} +max-retry = positive-number @cindex max-retry -The maximum interval in seconds (default: @t{3600}, one hour) between retries to establish a connection to this node. When a connection cannot be established, gvpe uses exponential backoff capped at this value. It's sometimes useful to set this to a much lower value (e.g. @t{120}) on connections to routers that usually are stable but sometimes are down, to assure quick reconnections even after longer downtimes. +The maximum interval in seconds (default: @t{3600}, one hour) between retries to establish a connection to this node. When a connection cannot be established, gvpe uses exponential back-off capped at this value. It's sometimes useful to set this to a much lower value (e.g. @t{120}) on connections to routers that usually are stable but sometimes are down, to assure quick reconnections even after longer downtimes. @refill @item -@b{router-priority = 0 | 1 | positive-number>=2} +max-ttl = seconds + +@cindex max-ttl +Expire packets that couldn't be sent after this many seconds (default: @t{60}). Gvpe will normally queue packets for a node without an active connection, in the hope of establishing a connection soon. This value specifies the maximum lifetime a packet will stay in the queue, if a packet gets older, it will be thrown away. +@refill + + +@item +max-queue = positive-number>=1 + +@cindex max-queue +The maximum number of packets that will be queued (default: @t{512}) for this node. If more packets are sent then earlier packets will be expired. See @t{max-ttl}, above. +@refill + + +@item +router-priority = 0 | 1 | positive-number>=2 @cindex router-priority -Sets the router priority of the given host (default: @t{0}, disabled). If some host tries to connect to another host without a hostname, it asks the router host for it's IP address. The router host is the one with the highest priority larger than @t{1} that is currently reachable. +Sets the router priority of the given node (default: @t{0}, disabled). @refill -Make sure all hosts always connect (@t{connect = always}) to the router hosts, otherwise connecting to them might be impossible. +If some node tries to connect to another node but it doesn't have a hostname, it asks a router node for it's IP address. The router node chosen is the one with the highest priority larger than @t{1} that is currently reachable. This is called a @emph{mediated} connection, as the connection itself will still be direct, but it uses another node to mediate between the two nodes. @refill -The special value @t{1} allows other hosts to route through the router host, but they will never route through it by default. The value @t{0} disables routing. The idea behind this is that some hosts can, if required, bump the @t{router-priority} setting to higher than @t{1} in their local config to route through specific hosts. If @t{router-priority} is @t{0}, then routing will be refused, so @t{1} serves as a "enable, but do not use by default" switch. +The value @t{0} disables routing, that means if the node receives a packet not for itself it will not forward it but instead drop it. +@refill +The special value @t{1} allows other hosts to route through the router host, but they will never route through it by default (i.e. the config file of another node needs to specify a router priority higher than one to choose such a node for routing). +@refill +The idea behind this is that some hosts can, if required, bump the @t{router-priority} setting to higher than @t{1} in their local config to route through specific hosts. If @t{router-priority} is @t{0}, then routing will be refused, so @t{1} serves as a "enable, but do not use by default" switch. +@refill +Nodes with @t{router-priority} set to @t{2} or higher will always be forced to @t{connect} = @t{always} (unless they are @t{disabled}). @refill @item -@b{tcp-port = port-number} +tcp-port = port-number @cindex tcp-port Similar to @t{udp-port} (default: @t{655}), but sets the TCP port number. @@ -1259,7 +1301,7 @@ @item -@b{udp-port = port-number} +udp-port = port-number @cindex udp-port Sets the port number used by the UDP protocol (default: @t{655}, not officially assigned by IANA!). @@ -1277,47 +1319,35 @@ @item -@b{ -@cindex gvpe.conf -gvpe.conf} +gvpe.conf The config file. @refill @item -@b{ -@cindex if-up -if-up} +if-up The if-up script @refill @item -@b{ -@cindex node-up -node-up, -@cindex node-down -node-down} +node-up, node-down If used the node up or node-down scripts. @refill @item -@b{ -@cindex hostkey -hostkey} +hostkey The private key (taken from @t{hostkeys/nodename}) of the current host. @refill @item -@b{ -@cindex pubkey/nodename -pubkey/nodename} +pubkey/nodename The public keys of the other nodes, one file per node. @refill @@ -1352,42 +1382,49 @@ @item -@b{@strong{-c}, @strong{--config=}@emph{DIR}} +@strong{-c}, @strong{--config=}@emph{DIR} Read configuration options from @emph{DIR}. @refill @item -@b{@strong{-g}, @strong{--generate-keys}} +@strong{-g}, @strong{--generate-keys} + +Generate public/private RSA key-pair and exit. +@refill + + +@item +@strong{-q}, @strong{--quiet} -Generate public/private RSA keypair and exit. +Suppresses messages the author finds nonessential for scripting purposes. @refill @item -@b{@strong{--help}} +@strong{--help} Display short list of options. @refill @item -@b{@strong{--kill}[@strong{=}@emph{SIGNAL}]} +@strong{--kill}[@strong{=}@emph{SIGNAL}] Attempt to kill a running @t{gvpectrl} (optionally with the specified @emph{SIGNAL} instead of @t{SIGTERM}) and exit. @refill @item -@b{@strong{--show-config}} +@strong{--show-config} Show a summary of the configuration, and how gvpe interprets it. Can also be very useful when designing firewall scripts. @refill @item -@b{@strong{--version}} +@strong{--version} Output version information and exit. @refill @@ -1416,9 +1453,11 @@ @section DESCRIPTION -See the gvpe(5) manpage for an introduction to the gvpe suite. +See the gvpe(5) man page for an introduction to the gvpe suite. @refill -This is the manual page for gvpe, the virtual private ethernet daemon. When started, @t{gvpe} will read it's configuration file to determine the network topology, and other configuration information, assuming the role of node @emph{NODENAME}. It will then connect to the tun/tap device and set up a socket for incoming connections. Then a script will be executed to further configure the virtual device. If that succeeds, it will detach from the controlling terminal and continue in the background, accepting and setting up connections to other gvpe daemons that are part of the virtual private ethernet. +This is the manual page for gvpe, the virtual private ethernet daemon. When started, @t{gvpe} will read it's configuration file to determine the network topology, and other configuration information, assuming the role of node @emph{NODENAME} +@refill +It will then create/connect to the tun/tap device and set up a socket for incoming connections. Then a @t{if-up} script will be executed to further configure the virtual network device. If that succeeds, it will detach from the controlling terminal and continue in the background, accepting and setting up connections to other gvpe daemons that are part of the same virtual private ethernet. @refill The optional arguments after the node name have to be of the form: @refill @@ -1428,7 +1467,7 @@ [I.]var=value @end example -If the argument has a prefix of @t{nodename.} (i.e. @t{laptop.enable-dns=yes}) then it will be parsed after all the config directives for that node, if not, it is parsed befroe the first node directive in the config file, and can be used to set global options or default variables. +If the argument has a prefix of @t{nodename.} (i.e. @t{laptop.enable-dns=yes}) then it will be parsed after all the config directives for that node, if not, it is parsed before the first node directive in the config file, and can be used to set global options or default variables. @refill For example, to start @t{gvpe} in the foreground, with log-level @t{info} on the node @t{laptop}, with TCP enabled and HTTP-Proxy host and Port set, use this: @refill @@ -1449,42 +1488,42 @@ @item -@b{@strong{-c}, @strong{--config=}@emph{DIR}} +@strong{-c}, @strong{--config=}@emph{DIR} Read configuration options from @emph{DIR} @refill @item -@b{@strong{-d}, @strong{--l=}@emph{LEVEL}} +@strong{-d}, @strong{--l=}@emph{LEVEL} Set logging level to @emph{LEVEL} (one of: noise, trace, debug, info, notice, warn, error, critical). @refill @item -@b{@strong{--help}} +@strong{--help} Display short list of options. @refill @item -@b{@strong{-D}, @strong{--no-detach}} +@strong{-D}, @strong{--no-detach} Don't fork and detach but stay in foreground and log messages to stderr in addition to syslog. @refill @item -@b{@strong{-L}, @strong{--mlock}} +@strong{-L}, @strong{--mlock} -Lock @t{gvpe} into main memory. This will prevent sensitive data like shared private keys to be written to the system swap files/partitions. +Lock @t{gvpe} into main memory. This will prevent sensitive data like shared private keys to be written to the system swap files/partitions. @refill @item -@b{@strong{--version}} +@strong{--version} Output version information and exit. @refill @@ -1499,21 +1538,21 @@ @item -@b{HUP} +HUP Closes/resets all connections, resets the retry time and will start connecting again (it will NOT re-read the config file). This is useful e.g. in a @t{/etc/ppp/if-up} script. @refill @item -@b{TERM} +TERM Closes/resets all connections and exits. @refill @item -@b{USR1} +USR1 Dump current network status into the syslog (at loglevel @t{notice}, so make sure your loglevel allows this). @refill @@ -1528,42 +1567,42 @@ @item -@b{@t{/etc/gvpe/gvpe.conf}} +@t{/etc/gvpe/gvpe.conf} The configuration file for @t{gvpe}. @refill @item -@b{@t{/etc/gvpe/if-up}} +@t{/etc/gvpe/if-up} Script which is executed as soon as the virtual network device has been allocated. Purpose is to further configure that device. @refill @item -@b{@t{/etc/gvpe/node-up}} +@t{/etc/gvpe/node-up} Script which is executed whenever a node connects to this node. This can be used for example to run nsupdate. @refill @item -@b{@t{/etc/gvpe/node-down}} +@t{/etc/gvpe/node-down} Script which is executed whenever a connection to another node is lost. for example to run nsupdate. @refill @item -@b{@t{/etc/gvpe/pubkey/*}} +@t{/etc/gvpe/pubkey/*} The directory containing the public keys for every node, usually autogenerated by executing @t{gvpectrl --generate-keys}. @refill @item -@b{@t{/var/run/gvpe.pid}} +@t{/var/run/gvpe.pid} The PID of the currently running @t{gvpe} is stored in this file. @refill @@ -1594,7 +1633,7 @@ @section PART 1: Transport protocols -GVPE offers a range of transport protocols that can be used to interchange data between nodes. Protocols differ in their overhead, speed, reliability, and robustness. +GVPE offers a wide range of transport protocols that can be used to interchange data between nodes. Protocols differ in their overhead, speed, reliability, and robustness. @refill The following sections describe each transport protocol in more detail. They are sorted by overhead/efficiency, the most efficient transport is listed first: @refill @@ -1603,18 +1642,18 @@ @subsection RAW IP This protocol is the best choice, performance-wise, as the minimum overhead per packet is only 38 bytes. @refill -It works by sending the VPN payload using raw ip frames (using the protocol set by @t{ip-proto}). +It works by sending the VPN payload using raw IP frames (using the protocol set by @t{ip-proto}). @refill -Using raw ip frames has the drawback that many firewalls block "unknown" protocols, so this transport only works if you have full IP connectivity between nodes. +Using raw IP frames has the drawback that many firewalls block "unknown" protocols, so this transport only works if you have full IP connectivity between nodes. @refill @subsection ICMP -This protocol offers very low overhead (minimum 42 bytes), and can sometimes tunnel through firewalls when other protocols cannot. +This protocol offers very low overhead (minimum 42 bytes), and can sometimes tunnel through firewalls when other protocols can not. @refill -It works by prepending a ICMP header with type @t{icmp-type} and a code of @t{255}. The default @t{icmp-type} is @t{echo-reply}, so the resulting packets look like echo replies, which looks rather strange to network admins. +It works by prepending an ICMP header with type @t{icmp-type} and a code of @t{255}. The default @t{icmp-type} is @t{echo-reply}, so the resulting packets look like echo replies, which looks rather strange to network administrators. @refill -This transport should only be used if other transports (i.e. raw ip) are not available or undesirable (due to their overhead). +This transport should only be used if other transports (i.e. raw IP) are not available or undesirable (due to their overhead). @refill @@ -1632,7 +1671,7 @@ @refill It is an abuse of the usage a proxy was designed for, so make sure you are allowed to use it for GVPE. @refill -This protocol also has server and client sides. If the @t{tcp-port} is set to zero, other nodes cannot connect to this node directly (and @t{tcp-port} zero cannot be used). If the @t{tcp-port} is non-zero, the node can act both as a client as well as a server. +This protocol also has server and client sides. If the @t{tcp-port} is set to zero, other nodes cannot connect to this node directly. If the @t{tcp-port} is non-zero, the node can act both as a client as well as a server. @refill @@ -1643,11 +1682,11 @@ @refill In addition, the same problems as the TCP transport also plague this protocol. @refill -Most configuration needs to be done by editing @t{src/vpn_dns.C} directly. +It's only use is to tunnel through firewalls that do not allow direct internet access. Similar to using a HTTP proxy (as the TCP transport does), it uses a local DNS server/forwarder (given by the @t{dns-forw-host} configuration value) as a proxy to send and receive data as a client, and an @t{NS} record pointing to the GVPE server (as given by the @t{dns-hostname} directive). @refill -It's only use is to tunnel through firewalls that do not allow direct internet access. Similar to using a HTTP proxy (as the TCP transport does), it uses a local DNS server/forwarder (given by the @t{dns-forw-host} configuration value) as a proxy to send and receive data as a client, and a @t{NS} record pointing to the GVPE server (as given by the @t{dns-hostname} directive). +The only good side of this protocol is that it can tunnel through most firewalls mostly undetected, iff the local DNS server/forwarder is sane (which is true for most routers, wireless LAN gateways and nameservers). @refill -The only good side of this protocol is that it can tunnel through most firewalls undetected, iff the local DNS server/forwarder is sane (which is true for most routers, wlan gateways and nameservers). +Fine-tuning needs to be done by editing @t{src/vpn_dns.C} directly. @refill @@ -1657,7 +1696,7 @@ @subsection Anatomy of a VPN packet -The exact layout and field lengths of a VPN packet is determined at compiletime and doesn't change. The same structure is used for all transort protocols, be it RAWIP or TCP. +The exact layout and field lengths of a VPN packet is determined at compile time and doesn't change. The same structure is used for all transport protocols, be it RAWIP or TCP. @refill @@ -1671,7 +1710,7 @@ @refill The TYPE field is a single byte and determines the purpose of the packet (e.g. RESET, COMPRESSED/UNCOMPRESSED DATA, PING, AUTH REQUEST/RESPONSE, CONNECT REQUEST/INFO etc.). @refill -SRCDST is a three byte field which contains the source and destination node ids (12 bits each). The protocol does not yet scale well beyond 30+ hosts, since all hosts must connect to each other once on startup. But if restarts are rare or tolerable and most connections are on demand, much larger networks are feasible. +SRCDST is a three byte field which contains the source and destination node IDs (12 bits each). @refill The DATA portion differs between each packet type, naturally, and is the only part that can be encrypted. Data packets contain more fields, as shown: @refill @@ -1685,44 +1724,72 @@ RAND is a sequence of fully random bytes, used to increase the entropy of the data for encryption purposes. @refill -SEQNO is a 32-bit sequence number. It is negotiated at every connection initialization and starts at some random 31 bit value. VPE currently uses a sliding window of 512 packets/sequence numbers to detect reordering, duplication and reply attacks. +SEQNO is a 32-bit sequence number. It is negotiated at every connection initialization and starts at some random 31 bit value. VPE currently uses a sliding window of 512 packets/sequence numbers to detect reordering, duplication and replay attacks. @refill -@subsection The authentification protocol -Before hosts can exchange packets, they need to establish authenticity of the other side and a key. Every host has a private RSA key and the public RSA keys of all other hosts. +@subsection The authentication protocol +Before nodes can exchange packets, they need to establish authenticity of the other side and a key. Every node has a private RSA key and the public RSA keys of all other nodes. @refill -A host establishes a simplex connection by sending the other host a RSA encrypted challenge containing a random challenge (consisting of the encryption key to use when sending packets, more random data and PKCS1_OAEP padding) and a random 16 byte "challenge-id" (used to detect duplicate auth packets). The destination host will respond by replying with an (unencrypted) RIPEMD160 hash of the decrypted challenge, which will authentify that host. The destination host will also set the outgoing encryption parameters as given in the packet. +A host establishes a simplex connection by sending the other node an RSA encrypted challenge containing a random challenge (consisting of the encryption key to use when sending packets, more random data and PKCS1_OAEP padding) and a random 16 byte "challenge-id" (used to detect duplicate auth packets). The destination node will respond by replying with an (unencrypted) RIPEMD160 hash of the decrypted challenge, which will authenticate that node. The destination node will also set the outgoing encryption parameters as given in the packet. @refill -When the source host receives a correct auth reply (by verifying the hash and the id, which will expire after 120 seconds), it will start to accept data packets from the destination host. +When the source node receives a correct auth reply (by verifying the hash and the id, which will expire after 120 seconds), it will start to accept data packets from the destination node. @refill -This means that a host can only initate a simplex connection, telling the other side the key it has to use when it sends packets. The challenge reply is only used to set the current IP address of the other side and protocol parameters. +This means that a node can only initiate a simplex connection, telling the other side the key it has to use when it sends packets. The challenge reply is only used to set the current IP address of the other side and protocol parameters. @refill -This protocol is completely symmetric, so to be able to send packets the destination host must send a challenge in the exact same way as already described (so, in essence, two simplex connections are created per host pair). +This protocol is completely symmetric, so to be able to send packets the destination node must send a challenge in the exact same way as already described (so, in essence, two simplex connections are created per node pair). @refill @subsection Retrying -When there is no response to an auth request, the host will send auth requests in bursts with an exponential backoff. After some time it will resort to PING packets, which are very small (8 bytes) and lightweight (no RSA operations required). A host that receives ping requests from an unconnected peer will respond by trying to create a connection. +When there is no response to an auth request, the node will send auth requests in bursts with an exponential back-off. After some time it will resort to PING packets, which are very small (8 bytes + protocol header) and lightweight (no RSA operations required). A node that receives ping requests from an unconnected peer will respond by trying to create a connection. +@refill +In addition to the exponential back-off, there is a global rate-limit on a per-IP base. It allows long bursts but will limit total packet rate to something like one control packet every ten seconds, to avoid accidental floods due to protocol problems (like a RSA key file mismatch between two nodes). @refill -In addition to the exponential backoff, there is a global rate-limit on a per-IP base. It allows long bursts but will limit total packet rate to something like one control packet every ten seconds, to avoid accidental floods due to protocol problems (like a RSA key file mismatch between two hosts). +The intervals between retries are limited by the @t{max-retry} configuration value. A node with @t{connect} = @t{always} will always retry, a node with @t{connect} = @t{ondemand} will only try (and re-try) to connect as long as there are packets in the queue, usually this limits the retry period to @t{max-ttl} seconds. +@refill +Sending packets over the VPN will reset the retry intervals as well, which means as long as somebody is trying to send packets to a given node, GVPE will try to connect every few seconds. @refill @subsection Routing and Protocol translation -The gvpe routing algorithm is easy: there isn't any routing. GVPE always tries to establish direct connections, if the protocol abilities of the two hosts allow it. -@refill -If the two hosts should be able to reach each other (common protocol, ip and port all known), but cannot (network down), then there will be no connection, point. +The GVPE routing algorithm is easy: there isn't much routing to speak of: When routing packets to another node, GVPE trues the following options, in order: @refill -A host can usually declare itself unreachable directly by setting it's port number(s) to zero. It can declare other hosts as unreachable by using a config-file that disables all protocols for these other hosts. -@refill -If two hosts cannot connect to each other because their IP address(es) are not known (such as dialup hosts), one side will send a connection request to a router (routers must be configured to act as routers!), which will send both the originating and the destination host a connection info request with protocol information and IP address of the other host (if known). Both hosts will then try to establish a connection to the other peer, which is usually possible even when both hosts are behind a NAT gateway. -@refill -If the hosts cannot reach each other because they have no common protocol, the originator instead use the router with highest priority and matching protocol as peer. Since the SRCDST field is not encrypted, the router host can just forward the packet to the destination host. Since each host uses it's own private key, the router will not be able to decrypt or encrypt packets, it will just act as a simple router and protocol translator. + + +@itemize + + +@item +If the two nodes should be able to reach each other directly (common protocol, port known), then GVPE will send the packet directly to the other node. + + + +@item +If this isn't possible (e.g. because the node doesn't have a @t{hostname} or known port), but the nodes speak a common protocol and a router is available, then GVPE will ask a router to "mediate" between both nodes (see below). + + + +@item +If a direct connection isn't possible (no common protocols) or forbidden (@t{deny-direct}) and there are any routers, then GVPE will try to send packets to the router with the highest priority that is connected already @emph{and} is able (as specified by the config file) to connect directly to the target node. + + + +@item +If no such router exists, then GVPE will simply send the packet to the node with the highest priority available. + + + +@item +Failing all that, the packet will be dropped. + +@end itemize + +A host can usually declare itself unreachable directly by setting it's port number(s) to zero. It can declare other hosts as unreachable by using a config-file that disables all protocols for these other hosts. Another option is to disable all protocols on that host in the other config files. @refill -When no router is connected, the host will aggressively try to connect to all routers, and if a router is asked for an unconnected host it will try to ask another router to establish the connection. +If two hosts cannot connect to each other because their IP address(es) are not known (such as dial-up hosts), one side will send a @emph{mediated} connection request to a router (routers must be configured to act as routers!), which will send both the originating and the destination host a connection info request with protocol information and IP address of the other host (if known). Both hosts will then try to establish a direct connection to the other peer, which is usually possible even when both hosts are behind a NAT gateway. @refill -... more not yet written about the details of the routing, please bug me ... +Routing via other nodes works because the SRCDST field is not encrypted, so the router can just forward the packet to the destination host. Since each host uses it's own private key, the router will not be able to decrypt or encrypt packets, it will just act as a simple router and protocol translator. @refill @@ -1741,25 +1808,13 @@ udp-port = 407 # use this UDP port mtu = 1492 # handy for TDSL ifname = vpn0 # I prefer vpn0 over e.g. tap0 -@end example - - -@example node = huffy # arbitrary node name hostname = 1.2.3.4 # ip address if this host -@end example - - -@example node = welshy hostname = www.example.net # resolve at connection time -@end example - - -@example node = wheelery # no hostname, will be determinded dynamically using router1 or router2 @end example