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