iptables now being set by client

This commit is contained in:
afeiszli
2021-04-15 09:48:14 -04:00
parent 77914d22b0
commit e2ec093eaf
9 changed files with 78 additions and 13 deletions

View File

@@ -592,12 +592,12 @@ func createGateway(w http.ResponseWriter, r *http.Request) {
nodechange.IsGateway = true
nodechange.GatewayRange = gateway.RangeString
if gateway.PostUp == "" {
nodechange.PostUp = "iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o " + gateway.Interface + " -j MASQUERADE"
nodechange.PostUp = "iptables -A FORWARD -i " + node.Interface + " -j ACCEPT; iptables -t nat -A POSTROUTING -o " + gateway.Interface + " -j MASQUERADE"
} else {
nodechange.PostUp = gateway.PostUp
}
if gateway.PostDown == "" {
nodechange.PostDown = "iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o " + gateway.Interface + " -j MASQUERADE"
nodechange.PostDown = "iptables -D FORWARD -i " + node.Interface + " -j ACCEPT; iptables -t nat -D POSTROUTING -o " + gateway.Interface + " -j MASQUERADE"
} else {
nodechange.PostDown = gateway.PostDown
}