ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/doc/gvpe.protocol.7.pod
(Generate patch)

Comparing gvpe/doc/gvpe.protocol.7.pod (file contents):
Revision 1.1 by pcg, Fri Jun 11 15:56:13 2004 UTC vs.
Revision 1.3 by pcg, Thu Mar 17 22:24:31 2005 UTC

1=head1 The GNU-VPE Protocol 1=head1 The GNU-VPE Protocols
2
3=head1 Overview
4
5GVPE can make use of a number of protocols. One of them is the GNU VPE
6protocol which is used to authenticate tunnels and send encrypted data
7packets. This protocol is described in more detail the second part of this
8document.
9
10The first part of this document describes the transport protocols which
11are used by GVPE to send it's data packets over the network.
12
13=head1 PART 1: Tansport protocols
14
15GVPE offers a range of transport protocols that can be used to interchange
16data between nodes. Protocols differ in their overhead, speed,
17reliability, and robustness.
18
19The following sections describe each transport protocol in more
20detail. They are sorted by overhead/efficiency, the most efficient
21transprot is listed first:
22
23=head2 RAW IP
24
25This protocol is the best choice, performance-wise, as the minimum
26overhead per packet is only 38 bytes.
27
28It works by sending the VPN payload using raw ip frames (using the
29protocol set by C<ip-proto>).
30
31Using raw ip frames has the drawback that many firewalls block "unknown"
32protocols, so this transport only works if you have full IP connectivity
33between nodes.
34
35=head2 ICMP
36
37This protocol offers very low overhead (minimum 42 bytes), and can
38sometimes tunnel through firewalls when other protocols cannot.
39
40It works by prepending a ICMP header with type C<icmp-type> and a code
41of C<255>. The default C<icmp-type> is C<echo-reply>, so the resulting
42packets look like echo replies, which looks rather strange to network
43admins.
44
45This transport should only be used if other transports (i.e. raw ip) are
46not available or undesirable (due to their overhead).
47
48=head2 UDP
49
50This is a good general choice for the transport protocol as UDP packets
51tunnel well through most firewalls and routers, and the overhead per
52packet is moderate (minimum 58 bytes).
53
54It should be used if RAW IP is not available.
55
56=head2 TCP
57
58This protocol is a very bad choice, as it not only has high overhead (more
59than 60 bytes), but the transport also retries on it's own, which leads
60to congestion when the link has moderate packet loss (as both the TCP
61transport and the tunneled traffic will retry, increasing congestion more
62and more). It also has high latency and is quite inefficient.
63
64It's only useful when tunneling through firewalls that block better
65protocols. If a node doesn't have direct internet access but a HTTP proxy
66that supports the CONNECT method it can be used to tunnel through a web
67proxy. For this to work, the C<tcp-port> should be C<443> (C<https>), as
68most proxies do not allow connections to other ports.
69
70It is an abuse of the usage a proxy was designed for, so make sure you are
71allowed to use it for GVPE.
72
73This protocol also has server and client sides. If the C<tcp-port> is set
74to zero, other nodes cannot connect to this node directly (and C<tcp-port>
75zero cannot be used). If the C<tcp-port> is non-zero, the node can act
76both as a client as well as a server.
77
78=head2 DNS
79
80B<WARNING:> Parsing and generating DNS packets is rather tricky. The code
81almost certainly contains buffer overflows and other, likely exploitable,
82bugs. You have been warned.
83
84This is the worst choice of transport protocol with respect to overhead
85(overhead can be 2-3 times higher than the transferred data), and latency
86(which can be many seconds). Some DNS servers might not be prepared to
87handle the traffic and drop or corrupt packets. The client also has to
88constantly poll the server for data, so the client will constantly create
89traffic even if it doesn't need to transport packets.
90
91In addition, the same problems as the TCP transport also plague this
92protocol.
93
94Most configuration needs to be done by editing C<src/vpn_dns.C> directly.
95
96It's only use is to tunnel through firewalls that do not allow direct
97internet access. Similar to using a HTTP proxy (as the TCP transport
98does), it uses a local DNS server/forwarder (given by the C<dns-forw-host>
99configuration value) as a proxy to send and receive data as a client,
100and a C<NS> record pointing to the GVPE server (as given by the
101C<dns-hostname> directive).
102
103The only good side of this protocol is that it can tunnel through most
104firewalls undetected, iff the local DNS server/forwarder is sane (which is
105true for most routers, wlan gateways and nameservers).
106
107=head1 PART 2: The GNU VPE protocol
108
109This section, unfortunately, is not yet finished, although the protocol
110is stable (until bugs in the cryptography are found, which will likely
111completely change the following description). Nevertheless, it should give
112you some overview over the protocol.
2 113
3=head2 Anatomy of a VPN packet 114=head2 Anatomy of a VPN packet
4 115
5The exact layout and field lengths of a VPN packet is determined at 116The exact layout and field lengths of a VPN packet is determined at
6compiletime and doesn't change. The same structure is used for all 117compiletime and doesn't change. The same structure is used for all
7protocols, be it rawip or tcp. 118transort protocols, be it RAWIP or TCP.
8 119
9 +------+------+--------+------+ 120 +------+------+--------+------+
10 | HMAC | TYPE | SRCDST | DATA | 121 | HMAC | TYPE | SRCDST | DATA |
11 +------+------+--------+------+ 122 +------+------+--------+------+
12 123
13The HMAC field is present in all packets, even if not used (e.g. in auth 124The HMAC field is present in all packets, even if not used (e.g. in auth
14request packets), in which case it is set to all zeroes. The checksum 125request packets), in which case it is set to all zeroes. The checksum
15itself is over the TYPE, SRCDST and DATA fields in all cases. 126itself is calculated over the TYPE, SRCDST and DATA fields in all cases.
16 127
17The TYPE field is a single byte and determines the purpose of the packet 128The TYPE field is a single byte and determines the purpose of the packet
18(e.g. RESET, COMPRESSED/UNCOMPRESSED DATA, PING, AUTH REQUEST/RESPONSE, 129(e.g. RESET, COMPRESSED/UNCOMPRESSED DATA, PING, AUTH REQUEST/RESPONSE,
19CONNECT REQUEST/INFO etc.). 130CONNECT REQUEST/INFO etc.).
20 131
21SRCDST is a three byte field which contains the source and destination 132SRCDST is a three byte field which contains the source and destination
22node ids (12 bits each). The protocol does not yet scale well beyond 30+ 133node ids (12 bits each). The protocol does not yet scale well beyond 30+
23hosts, since all hosts connect to each other on startup. But if restarts 134hosts, since all hosts must connect to each other once on startup. But if
24are rare or tolerable and most connections are on demand, larger networks 135restarts are rare or tolerable and most connections are on demand, much
25are possible. 136larger networks are feasible.
26 137
27The DATA portion differs between each packet type, naturally, and is the 138The DATA portion differs between each packet type, naturally, and is the
28only part that can be encrypted. Data packets contain more fields, as 139only part that can be encrypted. Data packets contain more fields, as
29shown: 140shown:
30 141
35RAND is a sequence of fully random bytes, used to increase the entropy of 146RAND is a sequence of fully random bytes, used to increase the entropy of
36the data for encryption purposes. 147the data for encryption purposes.
37 148
38SEQNO is a 32-bit sequence number. It is negotiated at every connection 149SEQNO is a 32-bit sequence number. It is negotiated at every connection
39initialization and starts at some random 31 bit value. VPE currently uses 150initialization and starts at some random 31 bit value. VPE currently uses
40a sliding window of 512 packets to detect reordering, duplication and 151a sliding window of 512 packets/sequence numbers to detect reordering,
41reply attacks. 152duplication and reply attacks.
42 153
43=head2 The authentification protocol 154=head2 The authentification protocol
44 155
45Before hosts can exchange packets, they need to establish authenticity of 156Before hosts can exchange packets, they need to establish authenticity of
46the other side and a key. Every host has a private RSA key and the public 157the other side and a key. Every host has a private RSA key and the public
59hash and the id, which will expire after 120 seconds), it will start to 170hash and the id, which will expire after 120 seconds), it will start to
60accept data packets from the destination host. 171accept data packets from the destination host.
61 172
62This means that a host can only initate a simplex connection, telling the 173This means that a host can only initate a simplex connection, telling the
63other side the key it has to use when it sends packets. The challenge 174other side the key it has to use when it sends packets. The challenge
64reply is only used to set the current IP address and protocol parameters. 175reply is only used to set the current IP address of the other side and
176protocol parameters.
65 177
66The protocol here is completely symmetric, so to be able to send packets 178This protocol is completely symmetric, so to be able to send packets the
67the destination host must send a challenge in the exact same way as 179destination host must send a challenge in the exact same way as already
68already described (so, in essence, two simplex connections are created per 180described (so, in essence, two simplex connections are created per host
69host pair). 181pair).
70 182
71=head2 Retrying 183=head2 Retrying
72 184
73When there is no response to an auth request, the host will send auth 185When there is no response to an auth request, the host will send auth
74requests in bursts with an exponential backoff. After some time it will 186requests in bursts with an exponential backoff. After some time it will
75resort to PING packets, which are very small (8 byte) and lightweight (no 187resort to PING packets, which are very small (8 bytes) and lightweight
76RSA operations). A host that receives ping requests from an unconnected 188(no RSA operations required). A host that receives ping requests from an
77peer will respond by trying to create a connection. 189unconnected peer will respond by trying to create a connection.
78 190
79In addition to the exponential backoff, there is a global rate-limit on 191In addition to the exponential backoff, there is a global rate-limit on
80a per-ip base. It allows long bursts but will limit total packet rate to 192a per-IP base. It allows long bursts but will limit total packet rate to
81something like one control packet every ten seconds, to avoid accidental 193something like one control packet every ten seconds, to avoid accidental
82floods due to protocol problems (like a rsa key file mismatch between two 194floods due to protocol problems (like a RSA key file mismatch between two
83hosts). 195hosts).
84 196
85=head2 Routing and Protocol translation 197=head2 Routing and Protocol translation
86 198
87The gvpe routing algorithm is easy: there isn't any routing. GVPE always 199The gvpe routing algorithm is easy: there isn't any routing. GVPE always

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines