Project

General

Profile

The ungleich VPN infrastructure » History » Version 13

Nico Schottelius, 01/25/2019 11:03 PM

1 1 Nico Schottelius
h1. The ungleich VPN infrastructure
2
3 5 Nico Schottelius
{{toc}}
4
5 11 Nico Schottelius
h2. Status
6
7
This document is *IN PRODUCTION*.
8
9 13 Nico Schottelius
h2. Security of IPv6 vs. NAT
10
11
A quick reminder: whether you are using private RFC1918 IPv4 addresses or IPv6 addresses, if you don't want people to access your network, you need to configure a firewall.
12
13 1 Nico Schottelius
h2. Wireguard on vpn-2a0ae5c1.ungleich.ch
14
15
* Server: vpn-2a0ae5c1.ungleich.ch
16
* Port: 51820
17
* Requires a public key
18 7 Nico Schottelius
* Client network: 2a0a:e5c1:100::/40
19 1 Nico Schottelius
* Client network size: /48
20
21 9 Nico Schottelius
h3. How to add a new customer connection
22 1 Nico Schottelius
23 9 Nico Schottelius
* Get the public key of the customer
24
* Edit dot-cdist/type/__ungleich_wireguard/manifest and add the new network definition at the end of the file
25
* Let the customer know their network
26 1 Nico Schottelius
27 9 Nico Schottelius
h3. Sample clustomer client configuration
28
29
* "Install wireguard":https://www.wireguard.com/install/
30
* Create your private key: @umask 077; wg genkey > privkey@
31
* Get your public key: @wg pubkey < privkey@
32
** You need to send this pubkey to ungleich
33
* You will get your network definition after we have received your public key
34
* Create /etc/wireguard/wg0.conf
35
36 1 Nico Schottelius
<pre>
37
[Interface]
38
PrivateKey = YOURKEYHERE
39 12 Nico Schottelius
Address = YOURIPv6IPADDRESSHERE/48
40 1 Nico Schottelius
ListenPort = 51280
41
42
[Peer]
43 9 Nico Schottelius
PublicKey = hi60lGP+xEUQ+kVnqA7PlJAO1SVqTS1W36g0LhFP0xQ=
44 1 Nico Schottelius
Endpoint = vpn-2a0ae5c1.ungleich.ch:51820
45
AllowedIPs = ::/0
46
</pre>
47
48
Commands for setting it up
49
50
<pre>
51
MY_NET=2a0a:e5c1:XXXX::1/48
52
53
ip link add dev wg0 type wireguard
54
55
# Replace with your range
56
ip addr add $MY_NET dev wg0
57
58
# Add routing
59
ip route add 2a0a:e5c1:100::/40 dev wg0
60
ip route add ::/0 via 2a0a:e5c1:100::1
61
62
# Configure the interface
63
wg setconf wg0 /etc/wireguard/wg0.conf
64
65
# Bring it up
66
ip link set wg0 up
67
</pre>
68 12 Nico Schottelius
69
Once it runs, you can also use @wg-quick@ to get it up faster:
70
71
<pre>
72
wg-quick up wg0
73
</pre>
74
75
(this just requires a configuration file named /etc/wireguard/wg0.conf to be existing)
76 1 Nico Schottelius
77
Debugging
78
79
* wg show
80
* ping 2a0a:e5c1:100::1
81 6 Nico Schottelius
82
h3. Sample server configuration
83 1 Nico Schottelius
84 10 Nico Schottelius
This is just for reference - as a client you don't need this configuration
85
86 6 Nico Schottelius
/etc/wireguard/wg0.conf:
87
88
<pre>
89
[Interface]
90
ListenPort = 51820
91 7 Nico Schottelius
PrivateKey = SERVERKEYHERE
92 6 Nico Schottelius
93
# Nico, 2019-01-23
94
[Peer]
95
PublicKey = kL1S/Ipq6NkFf1MAsNRou4b9VoUsnnb4ZxgiBrH0zA8=
96
AllowedIPs = 2a0a:e5c1:101::/48
97
98
# Customer networks below
99
# ...
100
</pre>
101
102
Sample server rc.local:
103
104
<pre>
105
ip link add dev wg0 type wireguard
106
ip addr add 2a0a:e5c1:100::1/40 dev wg0
107
wg setconf wg0 /etc/wireguard/wg0.conf
108
ip link set wg0 up
109
110 1 Nico Schottelius
</pre>
111
112
h2. OpenVPN on openvpn.ungleich.ch
113
114
* Server: openvpn.ungleich.ch
115
* Port: 1195
116
* Requires a certificate
117
* Address range: 2a0a:e5c0:3::/48
118
** Client networks are /64