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