Browse Source

iptables using the WP_PORT variable

pull/20/head
Reinier Hernández 5 years ago
parent
commit
706a005993
No known key found for this signature in database GPG Key ID: A902FE79315AFA9F
  1. 4
      src/lib/WireGuard.js
  2. 2
      src/package.json

4
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;

2
src/package.json

@ -30,4 +30,4 @@
"engines": {
"node": "14"
}
}
}

Loading…
Cancel
Save