1 |
pcg |
1.1 |
|
2 |
pcg |
1.2 |
==== NAME ==== |
3 |
|
|
|
4 |
pcg |
1.6 |
GNU-VPE - Overview of the GNU Virtual Private Ethernet suite. |
5 |
pcg |
1.2 |
|
6 |
|
|
|
7 |
|
|
==== DESCRIPTION ==== |
8 |
|
|
|
9 |
pcg |
1.7 |
GVPE is a suite designed to provide a virtual private network for |
10 |
pcg |
1.2 |
multiple nodes over an untrusted network. |
11 |
|
|
|
12 |
|
|
"Virtual" means that no physical network is created (of course), but an |
13 |
|
|
ethernet is emulated by creating multiple tunnels between the member |
14 |
pcg |
1.4 |
nodes. |
15 |
|
|
|
16 |
|
|
"Private" means that non-participating nodes cannot decode ("sniff)" nor |
17 |
|
|
inject ("spoof") packets. |
18 |
|
|
|
19 |
pcg |
1.7 |
In the case of gvpe, even participating nodes cannot sniff packets send |
20 |
pcg |
1.4 |
to other nodes or spoof packets as if sent from other nodes. |
21 |
|
|
|
22 |
|
|
"Network" means that more than two parties can participate in the |
23 |
|
|
network, so for instance it's possible to connect multiple branches of a |
24 |
|
|
company into a single network. Many so-called "vpn" solutions only |
25 |
|
|
create point-to-point tunnels. |
26 |
pcg |
1.2 |
|
27 |
|
|
|
28 |
|
|
== DESIGN GOALS == |
29 |
|
|
|
30 |
|
|
: SIMPLE DESIGN |
31 |
|
|
Cipher, HMAC algorithms and other key parameters must be selected at |
32 |
|
|
compile time - this makes it possible to only link in algorithms you |
33 |
|
|
actually need. It also makes the crypto part of the source very |
34 |
|
|
transparent and easy to inspect. |
35 |
|
|
|
36 |
|
|
: EASY TO SETUP |
37 |
|
|
A few lines of config (the config file is shared unmodified between |
38 |
pcg |
1.7 |
all hosts) and a single run of ``gvpectrl'' to generate the keys |
39 |
pcg |
1.2 |
suffices to make it work. |
40 |
|
|
|
41 |
|
|
: MAC-BASED SECURITY |
42 |
|
|
Since every host has it's own private key, other hosts cannot spoof |
43 |
pcg |
1.7 |
traffic from this host. That makes it possible to filter packet by |
44 |
pcg |
1.2 |
MAC address, e.g. to ensure that packets from a specific IP address |
45 |
pcg |
1.7 |
come, in fact, from a specific host that is associated with that IP |
46 |
|
|
and not from another host. |
47 |
pcg |
1.2 |
|
48 |
|
|
|
49 |
|
|
==== PROGRAMS ==== |
50 |
|
|
|
51 |
pcg |
1.7 |
Vpe comes with two programs: one daemon (``gvpe'') and one control |
52 |
|
|
program (``gvpectrl''). |
53 |
pcg |
1.2 |
|
54 |
pcg |
1.7 |
: gvpectrl |
55 |
pcg |
1.3 |
Is used to generate the keys, check and give an overview of of the |
56 |
|
|
configuration and contorl the daemon (restarting etc.). |
57 |
pcg |
1.2 |
|
58 |
pcg |
1.7 |
: gvpe |
59 |
|
|
Is the daemon used to establish and maintain connections to the |
60 |
pcg |
1.2 |
other network members. It should be run on the gateway machine. |
61 |
|
|
|
62 |
|
|
|
63 |
pcg |
1.3 |
==== COMPILETIME CONFIGURATION ==== |
64 |
pcg |
1.2 |
|
65 |
pcg |
1.7 |
Please have a look at the ``gvpe.osdep(5)'' manpage for |
66 |
|
|
platform-specific information. |
67 |
pcg |
1.6 |
|
68 |
pcg |
1.7 |
Here are a few recipes for compiling your gvpe: |
69 |
pcg |
1.2 |
|
70 |
|
|
|
71 |
|
|
== AS LOW PACKET OVERHEAD AS POSSIBLE == |
72 |
|
|
|
73 |
pcg |
1.3 |
./configure --enable-hmac-length=4 --enable-rand-length=0 |
74 |
pcg |
1.2 |
|
75 |
pcg |
1.3 |
Minimize the header overhead of VPN packets (the above will result in |
76 |
|
|
only 4 bytes of overhead over the raw ethernet frame). |
77 |
pcg |
1.2 |
|
78 |
|
|
|
79 |
|
|
== MINIMIZE CPU TIME REQUIRED == |
80 |
|
|
|
81 |
pcg |
1.3 |
./configure --enable-cipher=bf --enable-digest=md4 |
82 |
pcg |
1.2 |
|
83 |
pcg |
1.7 |
Use the fastest cipher and digest algorithms currently available in |
84 |
|
|
gvpe. |
85 |
pcg |
1.2 |
|
86 |
|
|
|
87 |
|
|
== MAXIMIZE SECURITY == |
88 |
|
|
|
89 |
pcg |
1.3 |
./configure --enable-hmac-length=16 --enable-rand-length=8 --enable-digest=sha1 |
90 |
|
|
|
91 |
|
|
This uses a 16 byte HMAC checksum to authenticate packets (I guess 8-12 |
92 |
|
|
would also be pretty secure ;) and will additionally prefix each packet |
93 |
|
|
with 8 bytes of random data. |
94 |
pcg |
1.2 |
|
95 |
|
|
In general, remember that AES-128 seems to be more secure and faster |
96 |
pcg |
1.3 |
than AES-192 or AES-256, more randomness helps against sniffing and a |
97 |
|
|
longer HMAC helps against spoofing. MD4 is a fast digest, SHA1 or |
98 |
|
|
RIPEMD160 are better, and Blowfish is a fast cipher (and also quite |
99 |
|
|
secure). |
100 |
pcg |
1.2 |
|
101 |
|
|
|
102 |
|
|
==== HOW TO SET UP A SIMPLE VPN ==== |
103 |
|
|
|
104 |
|
|
In this section I will describe how to get a simple VPN consisting of |
105 |
|
|
three hosts up and running. |
106 |
|
|
|
107 |
|
|
|
108 |
|
|
== STEP 1: configuration == |
109 |
|
|
|
110 |
|
|
First you have to create a daemon configuation file and put it into the |
111 |
pcg |
1.7 |
configuration directory. This is usually ``/etc/gvpe'', depending on how |
112 |
|
|
you configured gvpe, and can be overwritten using the ``-c'' commandline |
113 |
pcg |
1.2 |
switch. |
114 |
|
|
|
115 |
pcg |
1.7 |
Put the following lines into ``/etc/gvpe/gvpe.conf'': |
116 |
pcg |
1.2 |
|
117 |
pcg |
1.3 |
udp-port = 50000 # the external port to listen on (configure your firewall) |
118 |
|
|
mtu = 1400 # minimum MTU of all outgoing interfaces on all hosts |
119 |
|
|
ifname = vpn0 # the local network device name |
120 |
pcg |
1.2 |
|
121 |
pcg |
1.3 |
node = first # just a nickname |
122 |
|
|
hostname = first.example.net # the DNS name or IP address of the host |
123 |
pcg |
1.2 |
|
124 |
pcg |
1.3 |
node = second |
125 |
|
|
hostname = 133.55.82.9 |
126 |
pcg |
1.2 |
|
127 |
pcg |
1.3 |
node = third |
128 |
|
|
hostname = third.example.net |
129 |
pcg |
1.2 |
|
130 |
|
|
The only other file neccessary if the ``if-up'' script that initializes |
131 |
|
|
the local ethernet interface. Put the following lines into |
132 |
pcg |
1.7 |
``/etc/gvpe/if-up'' and make it execute (``chmod 755 /etc/gvpe/if-up''): |
133 |
pcg |
1.2 |
|
134 |
pcg |
1.3 |
#!/bin/sh |
135 |
|
|
ip link set $IFNAME address $MAC mtu $MTU up |
136 |
|
|
[ $NODENAME = first ] && ip addr add 10.0.1.1 dev $IFNAME |
137 |
|
|
[ $NODENAME = second ] && ip addr add 10.0.2.1 dev $IFNAME |
138 |
|
|
[ $NODENAME = third ] && ip addr add 10.0.3.1 dev $IFNAME |
139 |
|
|
ip route add 10.0.0.0/16 dev $IFNAME |
140 |
pcg |
1.2 |
|
141 |
|
|
This script will give each node a different IP address in the |
142 |
|
|
``10.0/16'' network. The internal network (e.g. the ``eth0'' interface) |
143 |
|
|
should then be set to a subset of that network, e.g. ``10.0.1.0/24'' on |
144 |
|
|
node ``first'', ``10.0.2.0/24'' on node ``second'', and so on. |
145 |
|
|
|
146 |
pcg |
1.7 |
By enabling routing on the gateway host that runs ``gvpe'' all nodes |
147 |
pcg |
1.2 |
will be able to reach the other nodes. You can, of course, also use |
148 |
|
|
proxy arp or other means of pseudo-bridging (or even real briding), or |
149 |
|
|
(best) full routing - the choice is yours. |
150 |
|
|
|
151 |
|
|
|
152 |
|
|
== STEP 2: create the RSA key pairs for all hosts == |
153 |
|
|
|
154 |
|
|
Run the following command to generate all key pairs (that might take a |
155 |
|
|
while): |
156 |
|
|
|
157 |
pcg |
1.7 |
gvpectrl -c /etc/gvpe -g |
158 |
pcg |
1.2 |
|
159 |
|
|
This command will put the public keys into |
160 |
pcg |
1.7 |
``/etc/gvpe/pubkeys/*nodename*'' and the private keys into |
161 |
|
|
``/etc/gvpe/hostkeys/*nodename*''. |
162 |
pcg |
1.2 |
|
163 |
|
|
|
164 |
|
|
== STEP 3: distribute the config files to all nodes == |
165 |
|
|
|
166 |
|
|
Now distribute the config files to the other nodes. This should be done |
167 |
|
|
in two steps, since the private keys should not be distributed. The |
168 |
|
|
example uses rsync-over-ssh |
169 |
|
|
|
170 |
|
|
First all the config files without the hostkeys should be distributed: |
171 |
|
|
|
172 |
pcg |
1.7 |
rsync -avzessh /etc/gvpe first.example.net:/etc/. --exclude hostkeys |
173 |
|
|
rsync -avzessh /etc/gvpe 133.55.82.9:/etc/. --exclude hostkeys |
174 |
|
|
rsync -avzessh /etc/gvpe third.example.net:/etc/. --exclude hostkeys |
175 |
pcg |
1.2 |
|
176 |
|
|
Then the hostkeys should be copied: |
177 |
|
|
|
178 |
pcg |
1.7 |
rsync -avzessh /etc/gvpe/hostkeys/first first.example.net:/etc/hostkey |
179 |
|
|
rsync -avzessh /etc/gvpe/hostkeys/second 133.55.82.9:/etc/hostkey |
180 |
|
|
rsync -avzessh /etc/gvpe/hostkeys/third third.example.net:/etc/hostkey |
181 |
pcg |
1.2 |
|
182 |
pcg |
1.7 |
You should now check the configration by issuing the command ``gvpectrl |
183 |
|
|
-c /etc/gvpe -s'' on each node and verify it's output. |
184 |
pcg |
1.2 |
|
185 |
|
|
|
186 |
pcg |
1.7 |
== STEP 4: starting gvpe == |
187 |
pcg |
1.2 |
|
188 |
pcg |
1.7 |
You should then start gvpe on each node by issuing a command like: |
189 |
pcg |
1.2 |
|
190 |
pcg |
1.7 |
gvpe -D -linfo first # first is the nodename |
191 |
pcg |
1.2 |
|
192 |
pcg |
1.7 |
This will make the gvpe stay in foreground. You should then see |
193 |
pcg |
1.2 |
"connection established" messages. If you don't see them check your |
194 |
|
|
firewall and routing (use tcpdump ;). |
195 |
|
|
|
196 |
|
|
If this works you should check your networking setup by pinging various |
197 |
|
|
endpoints. |
198 |
|
|
|
199 |
pcg |
1.7 |
To make gvpe run more permanently you can either run it as a daemon (by |
200 |
pcg |
1.2 |
starting it without the ``-D'' switch), or, much better, from your |
201 |
|
|
inittab. I use a line like this on my systems: |
202 |
|
|
|
203 |
pcg |
1.7 |
t1:2345:respawn:/opt/gvpe/sbin/gvpe -D -L first >/dev/null 2>&1 |
204 |
pcg |
1.2 |
|
205 |
|
|
|
206 |
|
|
== STEP 5: enjoy == |
207 |
|
|
|
208 |
pcg |
1.7 |
... and play around. Sending a -HUP (``gvpectrl -kHUP'') to the daemon |
209 |
pcg |
1.2 |
will make it try to connect to all other nodes again. If you run it from |
210 |
pcg |
1.7 |
inittab, as is recommended, ``gvpectrl -k'' (or simply ``killall gvpe'') |
211 |
pcg |
1.2 |
will kill the daemon, start it again, making it read it's configuration |
212 |
|
|
files again. |
213 |
|
|
|
214 |
|
|
|
215 |
|
|
==== SEE ALSO ==== |
216 |
|
|
|
217 |
pcg |
1.7 |
gvpe.osdep(5) for OS-depedendent information, gvpe.conf(5), gvpectrl(8), |
218 |
pcg |
1.6 |
and for a description of the protocol and routing algorithms, |
219 |
pcg |
1.7 |
gvpe.protocol(7). |
220 |
pcg |
1.2 |
|
221 |
|
|
|
222 |
|
|
==== AUTHOR ==== |
223 |
|
|
|
224 |
pcg |
1.7 |
Marc Lehmann <gvpe@plan9.de> |
225 |
pcg |
1.6 |
|
226 |
|
|
|
227 |
|
|
==== COPYRIGHTS AND LICENSES ==== |
228 |
|
|
|
229 |
|
|
Vpe itself is distributed under the GENERAL PUBLIC LICENSE (see the file |
230 |
|
|
COPYING that should be part of your distribution). |
231 |
|
|
|
232 |
|
|
In some configurations it uses modified versions of the tinc vpn suite, |
233 |
|
|
which is also available under the GENERAL PUBLIC LICENSE. |
234 |
|
|
|
235 |
|
|
In some configurations (notably darwin), it uses a poll emulation |
236 |
|
|
library that comes with the following license notice: |
237 |
|
|
|
238 |
|
|
Copyright (c) 1995-2002 Brian M. Clapper |
239 |
|
|
All rights reserved. |
240 |
|
|
|
241 |
|
|
Redistribution and use in source and binary forms are permitted |
242 |
|
|
provided that: (1) source distributions retain this entire |
243 |
|
|
copyright notice and comment; (2) modifications made to the |
244 |
|
|
software are prominently mentioned, and a copy of the original |
245 |
|
|
software (or a pointer to its location) are included; and (3) |
246 |
|
|
distributions including binaries display the following |
247 |
|
|
acknowledgement: "This product includes software developed by Brian |
248 |
|
|
M. Clapper <bmc@clapper.org>" in the documentation or other |
249 |
|
|
materials provided with the distribution. The name of the author |
250 |
|
|
may not be used to endorse or promote products derived from this |
251 |
|
|
software without specific prior written permission. |
252 |
|
|
|
253 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
254 |
|
|
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
255 |
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
256 |
pcg |
1.2 |
|