Reinier Hernández
5 years ago
No known key found for this signature in database
GPG Key ID: A902FE79315AFA9F
2 changed files with
3 additions and
3 deletions
-
src/lib/WireGuard.js
-
src/package.json
|
|
|
@ -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; |
|
|
|
|
|
|
|
@ -30,4 +30,4 @@ |
|
|
|
"engines": { |
|
|
|
"node": "14" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|