You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/sysconfig-configure-wireguard.adoc
+65-9Lines changed: 65 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
= Configuring FCOS to use WireGuard
2
2
3
-
WARNING: Some examples in this page may not work properly. An issue with WireGuard SELinux isolation breaks Pre/Post actions in the WireGuard configuration for recent releases of Fedora Coreos. You can check the progress of this issue on the https://github.com/coreos/fedora-coreos-tracker/issues/1487[issue tracker].
4
3
5
4
== Introduction
6
5
@@ -12,10 +11,15 @@ https://www.wireguard.com/[WireGuard] is a novel VPN that runs inside the Linux
12
11
13
12
FCOS has full support for WireGuard out of the box. This guide is going to demonstrate how to set up a single connection between a FCOS server and one client computer. It goes over the basic client configuration, but it does not cover installing WireGuard on your clients.
14
13
14
+
There are several ways to set up wireguard on FCOS, here we show two approaches:
15
+
* Using [wg-quick](https://www.man7.org/linux/man-pages/man8/wg-quick.8.html).
16
+
* importing the Wireguard configuration in NetworkManager.
17
+
15
18
== Generate Keys
16
19
17
-
You will need to generate some keys to configure WireGuard. For this guide, the keys should be pre-generated on your workstation. First, let's create the FCOS WireGuard keys:
20
+
You will need to generate some keys to configure WireGuard. You can generate the keys on your workstation or a running FCOS system.
18
21
22
+
First, let's create the FCOS WireGuard keys:
19
23
.Generate FCOS WireGuard keys
20
24
[source,bash]
21
25
----
@@ -36,7 +40,7 @@ $ wg genkey | tee privatekey | wg pubkey > publickey
36
40
37
41
These keys will be referenced as `client_one_public_key` and `client_one_private_key` from here on out in this guide.
38
42
39
-
Now create a PresharedKey:
43
+
You can optionnaly generate a pre-shared key to increase security:
Description=Import wireguard configuration to NetworkManager
94
+
[Service]
95
+
Type=oneshot
96
+
RemainAfterExit=yes
97
+
ExecStart=nmcli connection import type wireguard file /etc/wireguard/wg0.conf
98
+
[Install]
99
+
WantedBy=multi-user.target
100
+
----
101
+
102
+
NOTE: NetworkManager will ignore `PostUp` and `PostDown` directives in the wiregaurd config. If you have firewall configuration to apply, make sure to apply it with a separate unit, or manually.
103
+
104
+
NOTE: If you need to make further changes to update Wireguard's configuration, delete the connection and re-import it from the updated configuration file.
105
+
.Re-import updated Wireguard configuration on FCOS
106
+
[source,bash]
107
+
----
108
+
[core@wireguard-demo ~]$ sudo nmcli con delete wg0 && sudo nmcli con import type wireguard file /etc/wireguard/wg0.conf
NOTE: <FCOS IP address> is the IP or FQDN of the FCOS server.
128
173
129
-
Write the above config to `/etc/wireguard/wg0.conf` and `chmod 0600 /etc/wireguard/wg0.conf` on your client. Run `sudo systemctl start [email protected]` and then check your configuration:
174
+
Write the above config to `/etc/wireguard/wg0.conf` and `chmod 0600 /etc/wireguard/wg0.conf` on your client.
175
+
Run `nmcli con import type wireguard file /etc/wireguard/wg0.conf` and then check your configuration:
Description=Import wireguard configuration to NetworkManager
294
+
[Service]
295
+
Type=oneshot
296
+
RemainAfterExit=yes
297
+
ExecStart=nmcli connection import type wireguard file /etc/wireguard/wg0.conf
298
+
[Install]
299
+
WantedBy=multi-user.target
244
300
----
245
301
246
302
NOTE: FCOS uses https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/[predictable interface names] by https://lists.fedoraproject.org/archives/list/[email protected]/thread/6IPTZL57Z5NLBMPYMXNVSYAGLRFZBLIP/[default]. Please take care to use the correct interface name for your hardware in the above PostUp and PostDown commands!
0 commit comments