Browse Source

Automatically remove the firewall rules

pull/491/head
BrainStone 3 years ago
parent
commit
2743913ca1
  1. 10
      src/config.js

10
src/config.js

@ -18,11 +18,11 @@ 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 eth0 -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 eth0 -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 || '';

Loading…
Cancel
Save