bundles/pppd: add iptables rules on ifup/ifdown
This commit is contained in:
parent
f65e216828
commit
870a5252e5
3 changed files with 20 additions and 0 deletions
5
bundles/pppd/files/ip-down
Normal file
5
bundles/pppd/files/ip-down
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rm /etc/iptables-rules.d/90-pppd
|
||||||
|
|
||||||
|
/usr/local/sbin/iptables-enforce
|
7
bundles/pppd/files/ip-up
Normal file
7
bundles/pppd/files/ip-up
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
INTERFACE=$1
|
||||||
|
|
||||||
|
echo "iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE" > /etc/iptables-rules.d/90-pppd
|
||||||
|
|
||||||
|
/usr/local/sbin/iptables-enforce
|
|
@ -50,6 +50,14 @@ files = {
|
||||||
'svc_systemd:pppoe:restart',
|
'svc_systemd:pppoe:restart',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'/etc/ppp/ip-down.d/iptables': {
|
||||||
|
'source': 'ip-down',
|
||||||
|
'mode': '0755',
|
||||||
|
},
|
||||||
|
'/etc/ppp/ip-up.d/iptables': {
|
||||||
|
'source': 'ip-up',
|
||||||
|
'mode': '0755',
|
||||||
|
},
|
||||||
'/etc/ppp/peers/provider': {
|
'/etc/ppp/peers/provider': {
|
||||||
'content_type': 'mako',
|
'content_type': 'mako',
|
||||||
'context': node.metadata['pppd'],
|
'context': node.metadata['pppd'],
|
||||||
|
|
Loading…
Reference in a new issue