File: gvpe.5.pod

package info (click to toggle)
gvpe 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 2,632 kB
  • sloc: ansic: 9,303; cpp: 6,668; sh: 4,583; perl: 149; makefile: 70; sed: 16
file content (298 lines) | stat: -rw-r--r-- 10,370 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
=head1 NAME

GNU-VPE - Overview of the GNU Virtual Private Ethernet suite.

=head1 DESCRIPTION

GVPE is a suite designed to provide a virtual private network for multiple
nodes over an untrusted network. This document first gives an introduction
to VPNs in general and then describes the specific implementation of GVPE.

=head2 WHAT IS A VPN?

VPN is an acronym, it stands for:

=over 4

=item Virtual

Virtual means that no physical network is created (of course), but a
network is I<emulated> by creating multiple tunnels between the member
nodes by encapsulating and sending data over another transport network.

Usually the emulated network is a normal IP or Ethernet, and the transport
network is the Internet. However, using a VPN system like GVPE to connect
nodes over other untrusted networks such as Wireless LAN is not uncommon.

=item Private

Private means that non-participating nodes cannot decode ("sniff)" nor
inject ("spoof") packets. This means that nodes can be connected over
untrusted networks such as the public Internet without fear of being
eavesdropped while at the same time being able to trust data sent by other
nodes.

In the case of GVPE, even participating nodes cannot sniff packets
send to other nodes or spoof packets as if sent from other nodes, so
communications between any two nodes is private to those two nodes.

=item Network

Network means that more than two parties can participate in the network,
so for instance it's possible to connect multiple branches of a company
into a single network. Many so-called "VPN" solutions only create
point-to-point tunnels, which in turn can be used to build larger
networks.

GVPE provides a true multi-point network in which any number of nodes (at
least a few dozen in practise, the theoretical limit is 4095 nodes) can
participate.

=back

=head2 GVPE DESIGN GOALS

=over 4

=item SIMPLE DESIGN

Cipher, HMAC algorithms and other key parameters must be selected
at compile time - this makes it possible to only link in algorithms
you actually need. It also makes the crypto part of the source very
transparent and easy to inspect, and last not least this makes it possible
to hardcode the layout of all packets into the binary. GVPE goes a step
further and internally reserves blocks of the same length for all packets,
which virtually removes all possibilities of buffer overflows, as there is
only a single type of buffer and it's always of fixed length.

=item EASY TO SETUP

A few lines of config (the config file is shared unmodified between all
hosts) and generating an RSA key-pair on each node suffices to make it
work.

=item MAC-BASED SECURITY

Since every host has it's own private key, other hosts cannot spoof
traffic from this host. That makes it possible to filter packet by MAC
address, e.g. to ensure that packets from a specific IP address come, in
fact, from a specific host that is associated with that IP and not from
another host.

=back

=head1 PROGRAMS

Gvpe comes with two programs: one daemon (C<gvpe>) and one control program
(C<gvpectrl>).

=over 4

=item gvpectrl

This program is used to generate the keys, check and give an overview of of the
configuration and to control the daemon (restarting etc.).

=item gvpe

This is the daemon used to establish and maintain connections to the other
network nodes. It should be run on the gateway of each VPN subnet.

=back

=head1 COMPILETIME CONFIGURATION

Please have a look at the C<gvpe.osdep(5)> manpage for platform-specific
information.

Gvpe hardcodes most encryption parameters. While this reduces flexibility,
it makes the program much simpler and helps making buffer overflows
impossible under most circumstances.

Here are a few recipes for compiling your gvpe, showing the extremes
(fast, small, insecure OR slow, large, more secure), between which you
should choose:

=head2 AS LOW PACKET OVERHEAD AS POSSIBLE

   ./configure --enable-hmac-length=4 --enable-rand-length=0

Minimize the header overhead of VPN packets (the above will result in
only 4 bytes of overhead over the raw ethernet frame). This is a insecure
configuration because a HMAC length of 4 makes collision attacks almost
trivial.

=head2 MINIMIZE CPU TIME REQUIRED

   ./configure --enable-cipher=bf --enable-digest=md4

Use the fastest cipher and digest algorithms currently available in
gvpe. MD4 has been broken and is quite insecure, though, so using another
digest algorithm is recommended.

=head2 MAXIMIZE SECURITY

   ./configure --enable-hmac-length=16 --enable-rand-length=12 --enable-digest=ripemd610

This uses a 16 byte HMAC checksum to authenticate packets (I guess 8-12
would also be pretty secure ;) and will additionally prefix each packet
with 12 bytes of random data.

In general, remember that AES-128 seems to be as secure but faster than
AES-192 or AES-256, more randomness helps against sniffing and a longer
HMAC helps against spoofing. MD4 is a fast digest, SHA1, RIPEMD160, SHA256
are consecutively better, and Blowfish is a fast cipher (and also quite
secure).

=head1 HOW TO SET UP A SIMPLE VPN

In this section I will describe how to get a simple VPN consisting of
three hosts up and running.

=head2 STEP 1: configuration

First you have to create a daemon configuration file and put it into the
configuration directory. This is usually C</etc/gvpe>, depending on how you
configured gvpe, and can be overwritten using the C<-c> command line switch.

Put the following lines into C</etc/gvpe/gvpe.conf>:

   udp-port = 50000 # the external port to listen on (configure your firewall)
   mtu = 1400       # minimum MTU of all outgoing interfaces on all hosts
   ifname = vpn0    # the local network device name

   node = first     # just a nickname
   hostname = first.example.net # the DNS name or IP address of the host

   node = second
   hostname = 133.55.82.9

   node = third
   hostname = third.example.net

The only other file necessary is the C<if-up> script that initializes the
virtual ethernet interface on the local host. Put the following lines into
C</etc/gvpe/if-up> and make it executable (C<chmod 755 /etc/gvpe/if-up>):

   #!/bin/sh
   ip link set $IFNAME address $MAC mtu $MTU up
   [ $NODENAME = first  ] && ip addr add 10.0.1.1 dev $IFNAME
   [ $NODENAME = second ] && ip addr add 10.0.2.1 dev $IFNAME
   [ $NODENAME = third  ] && ip addr add 10.0.3.1 dev $IFNAME
   ip route add 10.0.0.0/16 dev $IFNAME

This script will give each node a different IP address in the C<10.0/16>
network.  The internal network (if gvpe runs on a router) should then be
set to a subset of that network, e.g.  C<10.0.1.0/24> on node C<first>,
C<10.0.2.0/24> on node C<second>, and so on.

By enabling routing on the gateway host that runs C<gvpe> all nodes will
be able to reach the other nodes. You can, of course, also use proxy ARP
or other means of pseudo-bridging, or (best) full routing - the choice is
yours.

=head2 STEP 2: create the RSA key pair for each node

Next you have to generate the RSA keys for the nodes. While you can set
up GVPE so you can generate all keys on a single host and centrally
distribute all keys, it is safer to generate the key for each node on the
node, so that the secret/private key does not have to be copied over the
network.

To do so, run the following command to generate a key pair:

   gvpectrl -c /etc/gvpe -g nodekey

This will create two files, F<nodekey> and F<nodekey.privkey>. The former
should be copied to F<< /etc/gvpe/pubkey/I<nodename> >> on the host where
your config file is (you will have to create the F<pubkey> directory
first):

   scp nodekey confighost:/etc/gvpe/pubkey/nodename

The private key F<nodekey.privkey> should be moved to F</etc/gvpe/hostkey>:

   mkdir -p /etc/gvpe
   mv nodekey.privkey /etc/gvpe/hostkey

=head2 STEP 3: distribute the config files to all nodes

Now distribute the config files and public keys to the other nodes.

The example uses rsync-over-ssh to copy the config file and all the public
keys:

   rsync -avzessh /etc/gvpe first.example.net:/etc/. --exclude hostkey
   rsync -avzessh /etc/gvpe 133.55.82.9:/etc/.       --exclude hostkey
   rsync -avzessh /etc/gvpe third.example.net:/etc/. --exclude hostkey

You should now check the configuration by issuing the command C<gvpectrl
-c /etc/gvpe -s> on each node and verify it's output.

=head2 STEP 4: starting gvpe

You should then start gvpe on each node by issuing a command like:

   gvpe -D -l info first # first is the nodename

This will make the gvpe daemon stay in foreground. You should then see
"connection established" messages. If you don't see them check your
firewall and routing (use tcpdump ;).

If this works you should check your networking setup by pinging various
endpoints.

To make gvpe run more permanently you can either run it as a daemon (by
starting it without the C<-D> switch), or, much better, from your inittab
or equivalent. I use a line like this on all my systems:

   t1:2345:respawn:/opt/gvpe/sbin/gvpe -D -L first >/dev/null 2>&1

=head2 STEP 5: enjoy

... and play around. Sending a -HUP (C<gvpectrl -kHUP>) to the daemon
will make it try to connect to all other nodes again. If you run it from
inittab C<gvpectrl -k> (or simply C<killall gvpe>) will kill the daemon,
start it again, making it read it's configuration files again.

To run the GVPE daemon permanently from your SysV init, you can add it to
your F<inittab>, e.g.:

   t1:2345:respawn:/bin/sh -c "exec nice -n-20 /path/to/gvpe -D node >/var/log/gvpe.log 2>&1"

For systems using systemd, you can use a unit file similar to this one:

   [Unit]
   Description=gvpe
   After=network.target
   Before=remote-fs.target

   [Service]
   ExecStart=/path/to/gvpe -D node
   KillMode=process
   Restart=always

   [Install]
   WantedBy=multi-user.target

=head1 SEE ALSO

gvpe.osdep(5) for OS-dependent information, gvpe.conf(5), gvpectrl(8),
and for a description of the transports, protocol, and routing algorithm,
gvpe.protocol(7).

The GVPE mailing list, at L<http://lists.schmorp.de/>, or
C<gvpe@lists.schmorp.de>.

=head1 AUTHOR

Marc Lehmann <gvpe@schmorp.de>

=head1 COPYRIGHTS AND LICENSES

GVPE itself is distributed under the GENERAL PUBLIC LICENSE (see the file
COPYING that should be part of your distribution).

In some configurations it uses modified versions of the tinc vpn suite,
which is also available under the GENERAL PUBLIC LICENSE.