From 706a0059932ef153d4493650a18c0632cf60f3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinier=20Hern=C3=A1ndez?= Date: Sat, 29 May 2021 22:07:03 -0400 Subject: [PATCH] iptables using the WP_PORT variable --- src/lib/WireGuard.js | 4 ++-- src/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 01ff330a..f8504be7 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -52,7 +52,7 @@ module.exports = class WireGuard { await this.__saveConfig(config); await Util.exec('wg-quick up wg0'); await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o eth0 -j MASQUERADE`); - await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT'); + await Util.exec(`iptables -A INPUT -p udp -m udp --dport ${WG_PORT} -j ACCEPT`); await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT'); await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT'); await this.__syncConfig(); @@ -79,7 +79,7 @@ module.exports = class WireGuard { [Interface] PrivateKey = ${config.server.privateKey} Address = ${config.server.address}/24 -ListenPort = 51820`; +ListenPort = ${WG_PORT}`; for (const [clientId, client] of Object.entries(config.clients)) { if (!client.enabled) continue; diff --git a/src/package.json b/src/package.json index f061e5b9..7f795e5d 100644 --- a/src/package.json +++ b/src/package.json @@ -30,4 +30,4 @@ "engines": { "node": "14" } -} \ No newline at end of file +}