From 138c7abfe7516817e40b80fae35ef7a4114ec848 Mon Sep 17 00:00:00 2001 From: Anton Palgunov Date: Fri, 22 Oct 2021 14:01:29 +0300 Subject: [PATCH] fix: use WG_PORT in iptables --- src/lib/WireGuard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 529b0620..a05da96c 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -55,7 +55,7 @@ module.exports = class WireGuard { await Util.exec('wg-quick down wg0').catch(() => {}); 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();