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.6 by pcg, Sun Aug 10 23:04:05 2008 UTC vs.
Revision 1.10 by root, Fri Jul 12 04:16:18 2013 UTC

23=head2 RAW IP 23=head2 RAW IP
24 24
25This protocol is the best choice, performance-wise, as the minimum 25This protocol is the best choice, performance-wise, as the minimum
26overhead per packet is only 38 bytes. 26overhead per packet is only 38 bytes.
27 27
28It works by sending the VPN payload using raw ip frames (using the 28It works by sending the VPN payload using raw IP frames (using the
29protocol set by C<ip-proto>). 29protocol set by C<ip-proto>).
30 30
31Using raw ip frames has the drawback that many firewalls block "unknown" 31Using raw IP frames has the drawback that many firewalls block "unknown"
32protocols, so this transport only works if you have full IP connectivity 32protocols, so this transport only works if you have full IP connectivity
33between nodes. 33between nodes.
34 34
35=head2 ICMP 35=head2 ICMP
36 36
38sometimes tunnel through firewalls when other protocols can not. 38sometimes tunnel through firewalls when other protocols can not.
39 39
40It works by prepending an ICMP header with type C<icmp-type> and a code 40It works by prepending an 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 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 42packets look like echo replies, which looks rather strange to network
43admins. 43administrators.
44 44
45This transport should only be used if other transports (i.e. raw ip) are 45This transport should only be used if other transports (i.e. raw IP) are
46not available or undesirable (due to their overhead). 46not available or undesirable (due to their overhead).
47 47
48=head2 UDP 48=head2 UDP
49 49
50This is a good general choice for the transport protocol as UDP packets 50This is a good general choice for the transport protocol as UDP packets
89traffic even if it doesn't need to transport packets. 89traffic even if it doesn't need to transport packets.
90 90
91In addition, the same problems as the TCP transport also plague this 91In addition, the same problems as the TCP transport also plague this
92protocol. 92protocol.
93 93
94It's only use is to tunnel through firewalls that do not allow direct 94Its only use is to tunnel through firewalls that do not allow direct
95internet access. Similar to using a HTTP proxy (as the TCP transport 95internet access. Similar to using a HTTP proxy (as the TCP transport
96does), it uses a local DNS server/forwarder (given by the C<dns-forw-host> 96does), it uses a local DNS server/forwarder (given by the C<dns-forw-host>
97configuration value) as a proxy to send and receive data as a client, 97configuration value) as a proxy to send and receive data as a client,
98and an C<NS> record pointing to the GVPE server (as given by the 98and an C<NS> record pointing to the GVPE server (as given by the
99C<dns-hostname> directive). 99C<dns-hostname> directive).
100 100
101The only good side of this protocol is that it can tunnel through most 101The only good side of this protocol is that it can tunnel through most
102firewalls mostly undetected, iff the local DNS server/forwarder is sane 102firewalls mostly undetected, iff the local DNS server/forwarder is sane
103(which is true for most routers, WLAN gateways and nameservers). 103(which is true for most routers, wireless LAN gateways and nameservers).
104 104
105Finetuning needs to be done by editing C<src/vpn_dns.C> directly. 105Fine-tuning needs to be done by editing C<src/vpn_dns.C> directly.
106 106
107=head1 PART 2: The GNU VPE protocol 107=head1 PART 2: The GNU VPE protocol
108 108
109This section, unfortunately, is not yet finished, although the protocol 109This section, unfortunately, is not yet finished, although the protocol
110is stable (until bugs in the cryptography are found, which will likely 110is stable (until bugs in the cryptography are found, which will likely
112you some overview over the protocol. 112you some overview over the protocol.
113 113
114=head2 Anatomy of a VPN packet 114=head2 Anatomy of a VPN packet
115 115
116The 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
117compiletime and doesn't change. The same structure is used for all 117compile time and doesn't change. The same structure is used for all
118transort protocols, be it RAWIP or TCP. 118transport protocols, be it RAWIP or TCP.
119 119
120 +------+------+--------+------+ 120 +------+------+--------+------+
121 | HMAC | TYPE | SRCDST | DATA | 121 | HMAC | TYPE | SRCDST | DATA |
122 +------+------+--------+------+ 122 +------+------+--------+------+
123 123
146SEQNO is a 32-bit sequence number. It is negotiated at every connection 146SEQNO is a 32-bit sequence number. It is negotiated at every connection
147initialization and starts at some random 31 bit value. VPE currently uses 147initialization and starts at some random 31 bit value. VPE currently uses
148a sliding window of 512 packets/sequence numbers to detect reordering, 148a sliding window of 512 packets/sequence numbers to detect reordering,
149duplication and replay attacks. 149duplication and replay attacks.
150 150
151The encryption is done on RAND+SEQNO+DATA in CBC mode with zero IV (or,
152equivalently, the IV is RAND+SEQNO, encrypted with the block cipher,
153unless RAND size is decreased or increased over the default value).
154
151=head2 The authentication protocol 155=head2 The authentication protocol
152 156
153Before hosts can exchange packets, they need to establish authenticity of 157Before nodes can exchange packets, they need to establish authenticity of
154the other side and a key. Every host has a private RSA key and the public 158the other side and a key. Every node has a private RSA key and the public
155RSA keys of all other hosts. 159RSA keys of all other nodes.
156 160
157A host establishes a simplex connection by sending the other host an 161A host establishes a simplex connection by sending the other node an RSA
158RSA encrypted challenge containing a random challenge (consisting of 162encrypted challenge containing a random challenge (consisting of the
159the encryption key to use when sending packets, more random data and 163encryption and authentication keys to use when sending packets, more
160PKCS1_OAEP padding) and a random 16 byte "challenge-id" (used to detect 164random data and PKCS1_OAEP padding) and a random 16 byte "challenge-id"
161duplicate auth packets). The destination host will respond by replying 165(used to detect duplicate auth packets). The destination node will respond
162with an (unencrypted) RIPEMD160 hash of the decrypted challenge, which 166by replying with an (unencrypted) hash of the decrypted challenge, which
163will authenticate that host. The destination host will also set the 167will authenticate that node. The destination node will also set the
164outgoing encryption parameters as given in the packet. 168outgoing encryption parameters as given in the packet.
165 169
166When the source host receives a correct auth reply (by verifying the 170When the source node receives a correct auth reply (by verifying the
167hash and the id, which will expire after 120 seconds), it will start to 171hash and the id, which will expire after 120 seconds), it will start to
168accept data packets from the destination host. 172accept data packets from the destination node.
169 173
170This means that a host can only initate a simplex connection, telling the 174This means that a node can only initiate a simplex connection, telling the
171other side the key it has to use when it sends packets. The challenge 175other side the key it has to use when it sends packets. The challenge
172reply is only used to set the current IP address of the other side and 176reply is only used to set the current IP address of the other side and
173protocol parameters. 177protocol parameters.
174 178
175This protocol is completely symmetric, so to be able to send packets the 179This protocol is completely symmetric, so to be able to send packets the
176destination host must send a challenge in the exact same way as already 180destination node must send a challenge in the exact same way as already
177described (so, in essence, two simplex connections are created per host 181described (so, in essence, two simplex connections are created per node
178pair). 182pair).
179 183
180=head2 Retrying 184=head2 Retrying
181 185
182When there is no response to an auth request, the host will send auth 186When there is no response to an auth request, the node will send auth
183requests in bursts with an exponential backoff. After some time it will 187requests in bursts with an exponential back-off. After some time it will
184resort to PING packets, which are very small (8 bytes + protocol header) 188resort to PING packets, which are very small (8 bytes + protocol header)
185and lightweight (no RSA operations required). A host that receives ping 189and lightweight (no RSA operations required). A node that receives ping
186requests from an unconnected peer will respond by trying to create a 190requests from an unconnected peer will respond by trying to create a
187connection. 191connection.
188 192
189In addition to the exponential backoff, there is a global rate-limit on 193In addition to the exponential back-off, there is a global rate-limit on
190a per-IP base. It allows long bursts but will limit total packet rate to 194a per-IP base. It allows long bursts but will limit total packet rate to
191something like one control packet every ten seconds, to avoid accidental 195something like one control packet every ten seconds, to avoid accidental
192floods due to protocol problems (like a RSA key file mismatch between two 196floods due to protocol problems (like a RSA key file mismatch between two
193hosts). 197nodes).
194 198
195The intervals between retries are limited by the C<max-retry> 199The intervals between retries are limited by the C<max-retry>
196configuration value. A node with C<connect> = C<always> will always retry, 200configuration value. A node with C<connect> = C<always> will always retry,
197a node with C<connect> = C<ondemand> will only try (and re-try) to connect 201a node with C<connect> = C<ondemand> will only try (and re-try) to connect
198as long as there are packets in the queue, usually this limits the retry 202as long as there are packets in the queue, usually this limits the retry
203will try to connect every few seconds. 207will try to connect every few seconds.
204 208
205=head2 Routing and Protocol translation 209=head2 Routing and Protocol translation
206 210
207The GVPE routing algorithm is easy: there isn't much routing to speak 211The GVPE routing algorithm is easy: there isn't much routing to speak
208of: When routing packets to another node, GVPE trues the following 212of: When routing packets to another node, GVPE tries the following
209options, in order: 213options, in order:
210 214
211=over 4 215=over 4
212 216
213=item If the two hosts should be able to reach each other directly (common 217=item If the two nodes should be able to reach each other directly (common
214protocol, port known), then GVPE will send the packet directly to the 218protocol, port known), then GVPE will send the packet directly to the
215other node. 219other node.
216 220
217=item If this isn't possible (e.g. because the node doesn't have a 221=item If this isn't possible (e.g. because the node doesn't have a
218C<hostname> or known port), but the nodes speak a common protocol and a 222C<hostname> or known port), but the nodes speak a common protocol and a
236port number(s) to zero. It can declare other hosts as unreachable by using 240port number(s) to zero. It can declare other hosts as unreachable by using
237a config-file that disables all protocols for these other hosts. Another 241a config-file that disables all protocols for these other hosts. Another
238option is to disable all protocols on that host in the other config files. 242option is to disable all protocols on that host in the other config files.
239 243
240If two hosts cannot connect to each other because their IP address(es) 244If two hosts cannot connect to each other because their IP address(es)
241are not known (such as dialup hosts), one side will send a I<mediated> 245are not known (such as dial-up hosts), one side will send a I<mediated>
242connection request to a router (routers must be configured to act as 246connection request to a router (routers must be configured to act as
243routers!), which will send both the originating and the destination host 247routers!), which will send both the originating and the destination host
244a connection info request with protocol information and IP address of the 248a connection info request with protocol information and IP address of the
245other host (if known). Both hosts will then try to establish a direct 249other host (if known). Both hosts will then try to establish a direct
246connection to the other peer, which is usually possible even when both 250connection to the other peer, which is usually possible even when both

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines