1 |
=head1 NAME |
2 |
|
3 |
vpe - Overview of the virtual private ethernet suite. |
4 |
|
5 |
=head1 DESCRIPTION |
6 |
|
7 |
Vpe is a suite designed to provide a virtual private network for multiple |
8 |
nodes over an untrusted network. |
9 |
|
10 |
"Virtual" means that no physical network is created (of course), but an |
11 |
ethernet is emulated by creating multiple tunnels between the member |
12 |
nodes. |
13 |
|
14 |
"Private" means that non-participating nodes cannot decode ("sniff)" nor |
15 |
inject ("spoof") packets. |
16 |
|
17 |
In the case of vpe, even participating nodes cannot sniff packets send to |
18 |
other nodes or spoof packets as if sent from other nodes. |
19 |
|
20 |
"Network" means that more than two parties can participate in the |
21 |
network, so for instance it's possible to connect multiple branches of a |
22 |
company into a single network. Many so-called "vpn" solutions only create |
23 |
point-to-point tunnels. |
24 |
|
25 |
=head2 DESIGN GOALS |
26 |
|
27 |
=over 4 |
28 |
|
29 |
=item SIMPLE DESIGN |
30 |
|
31 |
Cipher, HMAC algorithms and other key parameters must be selected |
32 |
at compile time - this makes it possible to only link in algorithms |
33 |
you actually need. It also makes the crypto part of the source very |
34 |
transparent and easy to inspect. |
35 |
|
36 |
=item EASY TO SETUP |
37 |
|
38 |
A few lines of config (the config file is shared unmodified between all |
39 |
hosts) and a single run of C<vpectrl> to generate the keys suffices to |
40 |
make it work. |
41 |
|
42 |
=item MAC-BASED SECURITY |
43 |
|
44 |
Since every host has it's own private key, other hosts cannot spoof |
45 |
traffic from this host. That makes it possible to filter packest by MAC |
46 |
address, e.g. to ensure that packets from a specific IP address come, in |
47 |
fact, from a specific host. |
48 |
|
49 |
=back |
50 |
|
51 |
=head1 PROGRAMS |
52 |
|
53 |
Vpe comes with two programs: one daemon (C<vped>) and one control program |
54 |
(C<vpectrl>). |
55 |
|
56 |
=over 4 |
57 |
|
58 |
=item vpectrl |
59 |
|
60 |
Is used to generate the keys, check and give an overview of of the |
61 |
configuration and contorl the daemon (restarting etc.). |
62 |
|
63 |
=item vped |
64 |
|
65 |
Is the daemon used to establish and maintain conenctions to the other |
66 |
network members. It should be run on the gateway machine. |
67 |
|
68 |
=back |
69 |
|
70 |
=head1 COMPILETIME CONFIGURATION |
71 |
|
72 |
Here are a few recipes for compiling your vpe: |
73 |
|
74 |
=head2 AS LOW PACKET OVERHEAD AS POSSIBLE |
75 |
|
76 |
./configure --enable-hmac-length=4 --enable-rand-length=0 |
77 |
|
78 |
Minimize the header overhead of VPN packets (the above will result in only |
79 |
4 bytes of overhead over the raw ethernet frame). |
80 |
|
81 |
=head2 MINIMIZE CPU TIME REQUIRED |
82 |
|
83 |
./configure --enable-cipher=bf --enable-digest=md4 |
84 |
|
85 |
Use the fastest cipher and digest algorithms currently available in vpe. |
86 |
|
87 |
=head2 MAXIMIZE SECURITY |
88 |
|
89 |
./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 |
|
95 |
In general, remember that AES-128 seems to be more secure and faster than |
96 |
AES-192 or AES-256, more randomness helps against sniffing and a longer |
97 |
HMAC helps against spoofing. MD4 is a fast digest, SHA1 or RIPEMD160 are |
98 |
better, and Blowfish is a fast cipher (and also quite secure). |
99 |
|
100 |
=head1 HOW TO SET UP A SIMPLE VPN |
101 |
|
102 |
In this section I will describe how to get a simple VPN consisting of |
103 |
three hosts up and running. |
104 |
|
105 |
=head2 STEP 1: configuration |
106 |
|
107 |
First you have to create a daemon configuation file and put it into the |
108 |
configuration directory. This is usually C</etc/vpe>, depending on how you |
109 |
configured vpe, and can be overwritten using the C<-c> commandline switch. |
110 |
|
111 |
Put the following lines into C</etc/vpe/vped.conf>: |
112 |
|
113 |
udp-port = 50000 # the external port to listen on (configure your firewall) |
114 |
mtu = 1400 # minimum MTU of all outgoing interfaces on all hosts |
115 |
ifname = vpn0 # the local network device name |
116 |
|
117 |
node = first # just a nickname |
118 |
hostname = first.example.net # the DNS name or IP address of the host |
119 |
|
120 |
node = second |
121 |
hostname = 133.55.82.9 |
122 |
|
123 |
node = third |
124 |
hostname = third.example.net |
125 |
|
126 |
The only other file neccessary if the C<if-up> script that initializes the |
127 |
local ethernet interface. Put the following lines into C</etc/vpe/if-up> |
128 |
and make it execute (C<chmod 755 /etc/vpe/if-up>): |
129 |
|
130 |
#!/bin/sh |
131 |
ip link set $IFNAME address $MAC mtu $MTU up |
132 |
[ $NODENAME = first ] && ip addr add 10.0.1.1 dev $IFNAME |
133 |
[ $NODENAME = second ] && ip addr add 10.0.2.1 dev $IFNAME |
134 |
[ $NODENAME = third ] && ip addr add 10.0.3.1 dev $IFNAME |
135 |
ip route add 10.0.0.0/16 dev $IFNAME |
136 |
|
137 |
This script will give each node a different IP address in the C<10.0/16> |
138 |
network. The internal network (e.g. the C<eth0> interface) should then be |
139 |
set to a subset of that network, e.g. C<10.0.1.0/24> on node C<first>, |
140 |
C<10.0.2.0/24> on node C<second>, and so on. |
141 |
|
142 |
By enabling routing on the gateway host that runs C<vped> all nodes will |
143 |
be able to reach the other nodes. You can, of course, also use proxy arp |
144 |
or other means of pseudo-bridging (or even real briding), or (best) full |
145 |
routing - the choice is yours. |
146 |
|
147 |
=head2 STEP 2: create the RSA key pairs for all hosts |
148 |
|
149 |
Run the following command to generate all key pairs (that might take a |
150 |
while): |
151 |
|
152 |
vpectrl -c /etc/vpe -g |
153 |
|
154 |
This command will put the public keys into C<< |
155 |
/etc/vpe/pubkeys/I<nodename> >> and the private keys into C<< |
156 |
/etc/vpe/hostkeys/I<nodename> >>. |
157 |
|
158 |
=head2 STEP 3: distribute the config files to all nodes |
159 |
|
160 |
Now distribute the config files to the other nodes. This should be done in two steps, since the |
161 |
private keys should not be distributed. The example uses rsync-over-ssh |
162 |
|
163 |
First all the config files without the hostkeys should be distributed: |
164 |
|
165 |
rsync -avzessh /etc/vpe first.example.net:/etc/. --exclude hostkeys |
166 |
rsync -avzessh /etc/vpe 133.55.82.9:/etc/. --exclude hostkeys |
167 |
rsync -avzessh /etc/vpe third.example.net:/etc/. --exclude hostkeys |
168 |
|
169 |
Then the hostkeys should be copied: |
170 |
|
171 |
rsync -avzessh /etc/vpe/hostkeys/first first.example.net:/etc/hostkey |
172 |
rsync -avzessh /etc/vpe/hostkeys/second 133.55.82.9:/etc/hostkey |
173 |
rsync -avzessh /etc/vpe/hostkeys/third third.example.net:/etc/hostkey |
174 |
|
175 |
You should now check the configration by issuing the command C<vpectrl -c |
176 |
/etc/vpe -s> on each node and verify it's output. |
177 |
|
178 |
=head2 STEP 4: starting vped |
179 |
|
180 |
You should then start vped on each node by issuing a command like: |
181 |
|
182 |
vped -D -linfo first # first is the nodename |
183 |
|
184 |
This will make the vped stay in foreground. You should then see |
185 |
"connection established" messages. If you don't see them check your |
186 |
firewall and routing (use tcpdump ;). |
187 |
|
188 |
If this works you should check your networking setup by pinging various |
189 |
endpoints. |
190 |
|
191 |
To make vped run more permanently you can either run it as a daemon |
192 |
(by starting it without the C<-D> switch), or, much better, from your |
193 |
inittab. I use a line like this on my systems: |
194 |
|
195 |
t1:2345:respawn:/opt/vpe/sbin/vped -D -L first >/dev/null 2>&1 |
196 |
|
197 |
=head2 STEP 5: enjoy |
198 |
|
199 |
... and play around. Sending a -HUP (C<vpectrl -kHUP>) to the daemon |
200 |
will make it try to connect to all other nodes again. If you run it from |
201 |
inittab, as is recommended, C<vpectrl -k> (or simply C<killall vped>) will |
202 |
kill the daemon, start it again, making it read it's configuration files |
203 |
again. |
204 |
|
205 |
=head1 SEE ALSO |
206 |
|
207 |
vped.conf(5), vpectrl(8), and for a description of the protocol and |
208 |
routing algorithms, vpe.protocol(7). |
209 |
|
210 |
=head1 AUTHOR |
211 |
|
212 |
Marc Lehmann <vpe@plan9.de> |
213 |
|