Skip to content

Commit e1c35ad

Browse files
committed
[feature] Added support for WireGuard and VXLAN #225
Added two images: - wireguard: image that runs WireGuard and VXLAN server - wireguard_updater: image that runs a Flask app that is used for triggering configuration update for WireGuard and VXLAN server Closes #225
1 parent 179a956 commit e1c35ad

File tree

20 files changed

+643
-13
lines changed

20 files changed

+643
-13
lines changed

.env

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
DASHBOARD_DOMAIN=dashboard.openwisp.org
66
API_DOMAIN=api.openwisp.org
77
VPN_DOMAIN=openvpn.openwisp.org
8+
WIREGUARD_UPDATER_DOMAIN=wireguard-updater.openwisp.org
89
EMAIL_DJANGO_DEFAULT=example@example.org
910
DB_USER=admin
1011
DB_PASS=admin
@@ -42,6 +43,10 @@ X509_COMMON_NAME=OpenWISP
4243
# VPN
4344
VPN_NAME=default
4445
VPN_CLIENT_NAME=default-management-vpn
46+
# WireGuard
47+
WIREGUARD_UPDATER_PORT=8081
48+
WIREGUARD_UPDATER_ENDPOINT=/trigger-update
49+
WIREGUARD_UPDATER_KEY=openwisp-wireguard-updater-auth-key
4550
# Developer
4651
DEBUG_MODE=False
4752
DJANGO_LOG_LEVEL=INFO

.github/workflows/branch.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030

3131
- name: Setup
3232
run: |
33-
echo "127.0.0.1 dashboard.openwisp.org api.openwisp.org" | sudo tee -a /etc/hosts
33+
echo "127.0.0.1 dashboard.openwisp.org api.openwisp.org wireguard-updater.openwisp.org" |
34+
sudo tee -a /etc/hosts
3435
3536
- name: Build & Publish
3637
run: make publish TAG=edge || (docker-compose logs && exit 1)

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ TAG = latest
9191
publish: compose-build runtests nfs-build
9292
for image in 'openwisp-base' 'openwisp-nfs' 'openwisp-api' 'openwisp-dashboard' \
9393
'openwisp-freeradius' 'openwisp-nginx' 'openwisp-openvpn' 'openwisp-postfix' \
94-
'openwisp-websocket' ; do \
94+
'openwisp-celelery' 'openwisp-websocket' 'openwisp-wireguard' \
95+
'openwisp-wireguard-updater' ; do \
9596
docker tag openwisp/$${image}:latest $(USER)/$${image}:$(TAG); \
9697
docker push $(USER)/$${image}:$(TAG); \
9798
docker rmi $(USER)/$${image}:$(TAG); \

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The sample files for deployment on kubernetes are available in the `deploy/examp
2121
- [Quick Setup](#quick-setup)
2222
- [Compose](#compose)
2323
- [Kubernetes](#kubernetes)
24+
- [Deploying WireGuard VPN](#deploying-wireguard-vpn)
2425
- [Customization](#customization)
2526
- [Custom Django Settings](#custom-django-settings)
2627
- [Custom Styles and JavaScript](#custom-styles-and-javascript)
@@ -30,6 +31,7 @@ The sample files for deployment on kubernetes are available in the `deploy/examp
3031
- [Development](#development)
3132
- [Workbench setup](#workbench-setup)
3233
- [Runtests](#runtests)
34+
- [Run Quality Assurance Checks](#run-quality-assurance-checks)
3335
- [Usage](#usage)
3436
- [Makefile Options](#makefile-options)
3537

@@ -112,6 +114,10 @@ by the images:
112114
- startup probe example: `test $(ps aux | grep -c uwsgi) -ge 2`
113115
- readiness probe example: `python services.py uwsgi_status "127.0.0.1:8001"`
114116

117+
### Deploying WireGuard VPN
118+
119+
Follow this detailed [step-by-step guide for deploying the WireGuard VPN](docs/tutorials/deploying-wireguard-vpn.md).
120+
115121
## Customization
116122

117123
The following commands will create the directory structure required for
@@ -244,7 +250,7 @@ If you want to disable a service, you can simply remove the container for that s
244250
- Default username & password are `admin`.
245251
- Default domains are: `dashboard.openwisp.org` and `api.openwisp.org`.
246252
- To reach the dashboard you may need to add the openwisp domains set in your `.env` to your `hosts` file,
247-
example: `bash -c 'echo "127.0.0.1 dashboard.openwisp.org api.openwisp.org" >> /etc/hosts'`
253+
example: `bash -c 'echo "127.0.0.1 dashboard.openwisp.org api.openwisp.org wireguard-updater.openwisp.org" >> /etc/hosts'`
248254
- Now you'll need to do steps (2) everytime you make a changes and want to build the images again.
249255
- If you want to perform actions like cleaning everything produced by `docker-openwisp`,
250256
please use the [makefile options](#makefile-options).
@@ -257,15 +263,15 @@ You can run tests either with `geckodriver` (firefox) or `chromedriver` (chromiu
257263

258264
- Setup chromedriver
259265

260-
1. Install chromium:
261-
266+
1. Install chromium:
267+
262268
```bash
263-
# On debian
269+
# On debian
264270
sudo apt --yes install chromium
265-
# On ubuntu
271+
# On ubuntu
266272
sudo apt --yes install chromium-browser
267273
```
268-
274+
269275
3. Check version: `chromium --version`
270276
4. Install Driver for your version: [`https://chromedriver.chromium.org/downloads`](https://chromedriver.chromium.org/downloads)
271277
5. Extract chromedriver to one of directories from your `$PATH`. (example: `/usr/bin/`)

docker-compose.yml

+52-3
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ services:
5757
- dashboard
5858

5959
celery:
60-
image: openwisp/openwisp-dashboard:latest
60+
image: openwisp/openwisp-celery:latest
6161
restart: always
62+
build:
63+
context: images
64+
dockerfile: openwisp_celery/Dockerfile
6265
environment:
6366
- MODULE_NAME=celery
6467
volumes:
@@ -72,8 +75,11 @@ services:
7275
- dashboard
7376

7477
celery_monitoring:
75-
image: openwisp/openwisp-dashboard:latest
78+
image: openwisp/openwisp-celery:latest
7679
restart: always
80+
build:
81+
context: images
82+
dockerfile: openwisp_celery/Dockerfile
7783
environment:
7884
- MODULE_NAME=celery_monitoring
7985
volumes:
@@ -87,8 +93,8 @@ services:
8793
- dashboard
8894

8995
celerybeat:
90-
image: openwisp/openwisp-dashboard:latest
9196
restart: always
97+
image: openwisp/openwisp-celery:latest
9298
environment:
9399
- MODULE_NAME=celerybeat
94100
env_file:
@@ -118,13 +124,15 @@ services:
118124
aliases:
119125
- dashboard.internal
120126
- api.internal
127+
- wireguard_updater.internal
121128
ports:
122129
- "80:80"
123130
- "443:443"
124131
depends_on:
125132
- dashboard
126133
- api
127134
- websocket
135+
- wireguard_updater
128136

129137
freeradius:
130138
image: openwisp/openwisp-freeradius:latest
@@ -168,6 +176,47 @@ services:
168176
cap_add:
169177
- NET_ADMIN
170178

179+
wireguard:
180+
image: openwisp/openwisp-wireguard:latest
181+
build:
182+
context: images
183+
dockerfile: openwisp_wireguard/Dockerfile
184+
env_file:
185+
- .env
186+
environment:
187+
# Substitute the placeholder values with the UUID and Key
188+
# of the VPN server.
189+
# These variables needs to be configured on individual
190+
# container to avoid conflicts between multiple VPN servers.
191+
- WIREGUARD_VPN_UUID=ENTER_WIREGUARD_VPN_UUID
192+
- WIREGUARD_VPN_KEY=ENTER_WIREGUARD_VPN_KEY
193+
# Maps the default UDP port (51820) for WireGuard VPN traffic.
194+
# Update this this if you are using different port for WireGuard.
195+
ports:
196+
- 51820:51820/udp
197+
# Following properties allow WireGuard to manage network on the
198+
# machine while running in a container.
199+
volumes:
200+
- /lib/modules:/lib/modules
201+
cap_add:
202+
- NET_ADMIN
203+
- SYS_MODULE
204+
205+
wireguard_updater:
206+
image: openwisp/openwisp-wireguard-updater:latest
207+
build:
208+
context: images
209+
dockerfile: openwisp_wireguard_updater/Dockerfile
210+
args:
211+
WIREGUARD_UPDATER_APP_PORT: 8081
212+
env_file:
213+
- .env
214+
environment:
215+
# Create an authentication token consisting alphanumeric
216+
# characters. This token will be used by OpenWISP for
217+
# triggering configuration updates.
218+
- WIREGUARD_UPDATER_KEY=openwisp-wireguard-updater-auth-key
219+
171220
postgres:
172221
image: mdillon/postgis:11-alpine
173222
restart: always

docs/ENV.md

+59
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Following are the options that can be changed. The list is divided in following
2525
- [uWSGI](#uWSGI): uWSGI configurations.
2626
- [Nginx](#Nginx): Nginx configurations.
2727
- [VPN](#VPN): Default VPN and VPN template related configurations.
28+
- [WireGuard](#WireGuard): WireGuard VPN configurations.
29+
- [WireGuard Updater](#WireGuard-Updater): WireGuard Updater app configurations.
2830
- [X509](#X509): Default certificate & certicate Authority configuration options.
2931
- [Host](#Hosts): Want to change the host of a particular service? Like pointing all the containers to a different database service.
3032
- [Developer](#Developer): DON'T change these values unless you know what you are doing.
@@ -661,6 +663,56 @@ Any OpenWISP Configuration of type `string`. `int`, `bool` or `json` is supporte
661663
- **Valid Values:** STRING
662664
- **Default:** default-management-vpn
663665

666+
## WireGuard
667+
668+
**Note:** If you have more that one WireGuard container, then these
669+
settings should be configured on individual container.
670+
671+
### `WIREGUARD_VPN_UUID`
672+
673+
- **Explanation:** ``UUID`` of the WireGuard VPN server object created on the OpenWISP dashboard.
674+
- **Valid Values:** STRING
675+
676+
### `WIREGUARD_VPN_KEY`
677+
678+
- **Explanation:** ``Key`` of the WireGuard VPN server object created on the OpenWISP dashboard.
679+
- **Valid Values:** STRING
680+
681+
## WireGuard Updater
682+
683+
### `WIREGUARD_UPDATER_KEY`
684+
685+
- **Explanation:** The authentication token required to trigger the configuration
686+
updater. It is strongly recommended to change this before deploying the container.
687+
- **Valid Values:** STRING
688+
- **Default:** openwisp-wireguard-updater-auth-key
689+
690+
### `WIREGUARD_UPDATER_DOMAIN`
691+
692+
- **Explanation:** Valid domain / IP address to reach the WireGuard updater application.
693+
- **Valid Values:** Domain
694+
- **Default:** wireguard-updater.openwisp.org
695+
696+
### `WIREGUARD_UPDATER_APP_PORT`
697+
698+
- **Explanation:** Change the port on which NGINX connects to the updater app on the WireGuard updater container. Don't change unless you know what you are doing.
699+
- **Valid Values:** INTEGER
700+
- **Default:** 8081
701+
702+
### `WIREGUARD_UPDATER_ENDPOINT`
703+
704+
- **Explanation:** The endpoint used for triggering updates to configuration of
705+
WireGuard tunnels. It should lead with a slash (`/`). Don't change unless
706+
you know what you are doing.
707+
- **Valid Values:** STRING
708+
- **Default:** /trigger-update
709+
710+
### `WIREGUARD_UPDATER_APP_SERVICE`
711+
712+
- **Explanation:** Host to establish WireGuard updater connection.
713+
- **Valid Values:** Domain | IP address
714+
- **Default:** wireguard_updater
715+
664716
## X509
665717

666718
### `X509_NAME_CA`
@@ -788,6 +840,13 @@ Any OpenWISP Configuration of type `string`. `int`, `bool` or `json` is supporte
788840
- **Valid Values:** STRING
789841
- **Default:** api.internal
790842

843+
### `WIREGUARD_UPDATER_INTERNAL`
844+
845+
- **Explanation:** Internal domain to reach the WireGuard updater app
846+
from other containers.
847+
- **Valid Values:** STRING
848+
- **Default:** wireguard_updater.internal
849+
791850
### `POSTFIX_DEBUG_MYNETWORKS`
792851

793852
- **Explanation:** Set debug_peer_list for given list of networks.
288 KB
Loading

0 commit comments

Comments
 (0)