From 587bb7a3f0f4399a4c911800b418b51e6615ca7a Mon Sep 17 00:00:00 2001 From: Fastidious Date: Wed, 14 Jul 2021 20:49:29 -0400 Subject: [PATCH 01/14] Adding Persistent keepalive --- src/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.js b/src/config.js index c60d25b..18f99c1 100644 --- a/src/config.js +++ b/src/config.js @@ -8,6 +8,7 @@ module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || 51820; +module.exports.WG_PERSISTENTKEEPALIVE = process.env.WG_PERSISTENTKEEPALIVE || 25; module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS From 31d1cb96fc4236d9e974a45e64f0376ff7cbec9f Mon Sep 17 00:00:00 2001 From: Fastidious Date: Wed, 14 Jul 2021 20:53:59 -0400 Subject: [PATCH 02/14] Adding Persistent Keepalive --- src/lib/WireGuard.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 565cd3e..5a5086e 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -16,6 +16,7 @@ const { WG_PORT, WG_DEFAULT_DNS, WG_DEFAULT_ADDRESS, + WG_PERSISTENTKEEPALIVE; WG_ALLOWED_IPS, } = require('../config'); @@ -181,6 +182,7 @@ ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}` : ''} PublicKey = ${config.server.publicKey} PresharedKey = ${client.preSharedKey} AllowedIPs = ${WG_ALLOWED_IPS} +PersistentKeepalive = ${WG_PERSISTENTKEEPALIVE} Endpoint = ${WG_HOST}:${WG_PORT}`; } From 5248dfec77174ac194e976ef4a5271ef8e8aa721 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Thu, 15 Jul 2021 06:54:08 -0400 Subject: [PATCH 03/14] Binding web address Ability to change whether app binds to 0.0.0.0 or other address (127.0.0.1, for proxying). --- src/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.js b/src/config.js index 18f99c1..0184974 100644 --- a/src/config.js +++ b/src/config.js @@ -4,6 +4,7 @@ const { release } = require('./package.json'); module.exports.RELEASE = release; module.exports.PORT = process.env.PORT || 51821; +module.exports.WEBHOST = process.env.WEBHOST || '0.0.0.0'; module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_HOST = process.env.WG_HOST; From ef7570777d752cd63e98c00efb043d760e011b0a Mon Sep 17 00:00:00 2001 From: Fastidious Date: Thu, 15 Jul 2021 06:57:22 -0400 Subject: [PATCH 04/14] Binding web address Adding the ability to change the binding address for the web server (0.0.0.0, open to everyone, or 127.0.0.1, for example, for proxying). --- src/lib/Server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index cf6b26e..6f157c5 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -14,6 +14,7 @@ const { PORT, RELEASE, PASSWORD, + WEBHOST, } = require('../config'); module.exports = class Server { @@ -130,8 +131,8 @@ module.exports = class Server { return WireGuard.updateClientAddress({ clientId, address }); })) - .listen(PORT, () => { - debug(`Listening on http://0.0.0.0:${PORT}`); + .listen(PORT,WEBHOST, () => { + debug(`Listening on http://${WEBHOST}:${PORT}`); }); } From 9d555730dbb34015ac131fcec9193794e32ec0c7 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Thu, 15 Jul 2021 07:01:08 -0400 Subject: [PATCH 05/14] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3dce467..82ccbc0 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ These options can be configured in `docker-compose.yml` under `environment`. | - | - | - | - | | `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. | | `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server | +| `WEBHOST` | - | `0.0.0.0` | IP where the the web server listens | `WG_PORT` | `51820` | `51820` | The public UDP port of your VPN server | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use | @@ -90,4 +91,4 @@ docker-compose down docker-compose pull docker-compose up --detach --remove-orphans docker image prune -``` \ No newline at end of file +``` From 83ebd8af4a10f87616447100ab7185541e9cdebe Mon Sep 17 00:00:00 2001 From: Fastidious Date: Thu, 15 Jul 2021 07:01:26 -0400 Subject: [PATCH 06/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82ccbc0..4c2b2cf 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ These options can be configured in `docker-compose.yml` under `environment`. | - | - | - | - | | `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. | | `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server | -| `WEBHOST` | - | `0.0.0.0` | IP where the the web server listens +| `WEBHOST` | - | `0.0.0.0` | IP where the web server listens | `WG_PORT` | `51820` | `51820` | The public UDP port of your VPN server | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use | From 8069985c9209fea851c82f4098cd3803cdb68d4d Mon Sep 17 00:00:00 2001 From: Fastidious Date: Thu, 15 Jul 2021 09:45:00 -0400 Subject: [PATCH 07/14] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4c2b2cf..953cefc 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ These options can be configured in `docker-compose.yml` under `environment`. | `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server | | `WEBHOST` | - | `0.0.0.0` | IP where the web server listens | `WG_PORT` | `51820` | `51820` | The public UDP port of your VPN server | +| `WG_PERSISTENTKEEPALIVE` | `25` | `60` | Value in seconds to keep the "connection" open | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use | From 00135d0c35b04cb787ec11254bf15c5c449884c1 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Fri, 16 Jul 2021 07:02:46 -0400 Subject: [PATCH 08/14] Small fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 953cefc..26dc3d8 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ These options can be configured in `docker-compose.yml` under `environment`. | - | - | - | - | | `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. | | `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server | -| `WEBHOST` | - | `0.0.0.0` | IP where the web server listens +| `WEBHOST` | `0.0.0.0` | `127.0.0.1` | IP where the web server listens | `WG_PORT` | `51820` | `51820` | The public UDP port of your VPN server | | `WG_PERSISTENTKEEPALIVE` | `25` | `60` | Value in seconds to keep the "connection" open | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range | From 49a2949aea79bc0da4a71e7d27b9af9a99dfd319 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Sat, 17 Jul 2021 10:18:19 -0400 Subject: [PATCH 09/14] Renaming and settings values Renaming environmental variable, and changing its default value. --- src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 0184974..de13f85 100644 --- a/src/config.js +++ b/src/config.js @@ -9,7 +9,7 @@ module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || 51820; -module.exports.WG_PERSISTENTKEEPALIVE = process.env.WG_PERSISTENTKEEPALIVE || 25; +module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVEE || 0; module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS From 6a0a5a10beba9db866e37e905dc99100f6b39228 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Sat, 17 Jul 2021 10:19:17 -0400 Subject: [PATCH 10/14] Update WireGuard.js --- src/lib/WireGuard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 5a5086e..80af6c4 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -16,7 +16,7 @@ const { WG_PORT, WG_DEFAULT_DNS, WG_DEFAULT_ADDRESS, - WG_PERSISTENTKEEPALIVE; + WG_PERSISTENT_KEEPALIVE; WG_ALLOWED_IPS, } = require('../config'); @@ -182,7 +182,7 @@ ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}` : ''} PublicKey = ${config.server.publicKey} PresharedKey = ${client.preSharedKey} AllowedIPs = ${WG_ALLOWED_IPS} -PersistentKeepalive = ${WG_PERSISTENTKEEPALIVE} +PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE} Endpoint = ${WG_HOST}:${WG_PORT}`; } From 534fb0ab798df529b512849fc18305dd86db3948 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Sat, 17 Jul 2021 10:20:01 -0400 Subject: [PATCH 11/14] Update config.js --- src/config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/config.js b/src/config.js index de13f85..4c535be 100644 --- a/src/config.js +++ b/src/config.js @@ -4,7 +4,6 @@ const { release } = require('./package.json'); module.exports.RELEASE = release; module.exports.PORT = process.env.PORT || 51821; -module.exports.WEBHOST = process.env.WEBHOST || '0.0.0.0'; module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_HOST = process.env.WG_HOST; From b3ab0a9ddf4a13ebe5cb738f04f197f4652d8f74 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Sat, 17 Jul 2021 10:20:46 -0400 Subject: [PATCH 12/14] Update Server.js --- src/lib/Server.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index 6f157c5..cf6b26e 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -14,7 +14,6 @@ const { PORT, RELEASE, PASSWORD, - WEBHOST, } = require('../config'); module.exports = class Server { @@ -131,8 +130,8 @@ module.exports = class Server { return WireGuard.updateClientAddress({ clientId, address }); })) - .listen(PORT,WEBHOST, () => { - debug(`Listening on http://${WEBHOST}:${PORT}`); + .listen(PORT, () => { + debug(`Listening on http://0.0.0.0:${PORT}`); }); } From 31abeaeff73d61f441ebc0f0bc43af045b48c9f9 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Sat, 17 Jul 2021 10:22:10 -0400 Subject: [PATCH 13/14] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 26dc3d8..d75733f 100644 --- a/README.md +++ b/README.md @@ -74,9 +74,8 @@ These options can be configured in `docker-compose.yml` under `environment`. | - | - | - | - | | `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. | | `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server | -| `WEBHOST` | `0.0.0.0` | `127.0.0.1` | IP where the web server listens | `WG_PORT` | `51820` | `51820` | The public UDP port of your VPN server | -| `WG_PERSISTENTKEEPALIVE` | `25` | `60` | Value in seconds to keep the "connection" open | +| `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use | From 0c46cbf30a51cac4dde805eec6bdd2fa73497a52 Mon Sep 17 00:00:00 2001 From: Fastidious Date: Sat, 17 Jul 2021 10:44:33 -0400 Subject: [PATCH 14/14] Extra E Removed an extra E. Sorry! --- src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 4c535be..d9cf5af 100644 --- a/src/config.js +++ b/src/config.js @@ -8,7 +8,7 @@ module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || 51820; -module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVEE || 0; +module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || 0; module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' ? process.env.WG_DEFAULT_DNS