Browse Source

config.js: remove the firewall rules after stop/restart

Fixes: https://github.com/wg-easy/wg-easy/issues/795
pull/842/head
Philip H 2 years ago
committed by pheiduck
parent
commit
a273c21e05
  1. 10
      src/config.js

10
src/config.js

@ -20,12 +20,12 @@ module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0';
module.exports.WG_PRE_UP = process.env.WG_PRE_UP || '';
module.exports.WG_POST_UP = process.env.WG_POST_UP || `
iptables -t nat -A POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE;
iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT;
iptables -A FORWARD -i wg0 -j ACCEPT;
iptables -A FORWARD -o wg0 -j ACCEPT;
iptables -t nat -A POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE -m comment --comment "wg-easy rule";
iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT -m comment --comment "wg-easy rule";
iptables -A FORWARD -i wg0 -j ACCEPT -m comment --comment "wg-easy rule";
iptables -A FORWARD -o wg0 -j ACCEPT -m comment --comment "wg-easy rule";
`.split('\n').join(' ');
module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || '';
module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || 'iptables-save | grep -vF "wg-easy rule" | iptables-restore';
module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || '';
module.exports.LANG = process.env.LANG || 'en';

Loading…
Cancel
Save