mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 05:04:27 +08:00
fixing flags and config
This commit is contained in:
parent
1a6cbf5b39
commit
1723f57035
3 changed files with 15 additions and 15 deletions
|
@ -212,12 +212,12 @@ func CreateIngressGateway(netid string, nodeid string) (models.Node, error) {
|
|||
|
||||
if node.PostUp != "" {
|
||||
if !strings.Contains(node.PostUp, postUpCmd) {
|
||||
postUpCmd = node.PostUp + " ; " + postUpCmd
|
||||
postUpCmd = node.PostUp + postUpCmd
|
||||
}
|
||||
}
|
||||
if node.PostDown != "" {
|
||||
if !strings.Contains(node.PostDown, postDownCmd) {
|
||||
postDownCmd = node.PostDown + " ; " + postDownCmd
|
||||
postDownCmd = node.PostDown + postDownCmd
|
||||
}
|
||||
}
|
||||
node.SetLastModified()
|
||||
|
@ -385,12 +385,12 @@ func firewallIPTablesCommandsCreateIngress(networkInterface string, ipv4, ipv6 b
|
|||
// spacing around ; is important for later parsing of postup/postdown in wireguard/common.go
|
||||
postUp += "ip6tables -A FORWARD -i " + networkInterface + " -j ACCEPT ; "
|
||||
postUp += "ip6tables -A FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
||||
postUp += "ip6tables -t nat -A POSTROUTING -o " + networkInterface + " -j MASQUERADE"
|
||||
postUp += "ip6tables -t nat -A POSTROUTING -o " + networkInterface + " -j MASQUERADE ; "
|
||||
|
||||
// doesn't remove potentially empty tables or chains
|
||||
postDown += "ip6tables -D FORWARD -i " + networkInterface + " -j ACCEPT ; "
|
||||
postDown += "ip6tables -D FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
||||
postDown += "ip6tables -t nat -D POSTROUTING -o " + networkInterface + " -j MASQUERADE"
|
||||
postDown += "ip6tables -t nat -D POSTROUTING -o " + networkInterface + " -j MASQUERADE ; "
|
||||
}
|
||||
return postUp, postDown
|
||||
}
|
||||
|
@ -402,13 +402,13 @@ func firewallIPTablesCommandsCreateEgress(networkInterface string, gatewayInterf
|
|||
postDown := ""
|
||||
if ipv4 {
|
||||
postUp += "iptables -A FORWARD -i " + networkInterface + " -j ACCEPT ; "
|
||||
postUp += "iptables -A FORWARD -o " + networkInterface + " -j ACCEPT"
|
||||
postUp += "iptables -A FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
||||
postDown += "iptables -D FORWARD -i " + networkInterface + " -j ACCEPT ; "
|
||||
postDown += "iptables -D FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
||||
|
||||
if egressNatEnabled == "yes" {
|
||||
postUp += " ; iptables -t nat -A POSTROUTING -o " + gatewayInterface + " -j MASQUERADE ; "
|
||||
postDown += " ; iptables -t nat -D POSTROUTING -o " + gatewayInterface + " -j MASQUERADE ; "
|
||||
postUp += "iptables -t nat -A POSTROUTING -o " + gatewayInterface + " -j MASQUERADE ; "
|
||||
postDown += "iptables -t nat -D POSTROUTING -o " + gatewayInterface + " -j MASQUERADE ; "
|
||||
}
|
||||
}
|
||||
if ipv6 {
|
||||
|
@ -418,8 +418,8 @@ func firewallIPTablesCommandsCreateEgress(networkInterface string, gatewayInterf
|
|||
postDown += "ip6tables -D FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
||||
|
||||
if egressNatEnabled == "yes" {
|
||||
postUp += " ; ip6tables -t nat -A POSTROUTING -o " + gatewayInterface + " -j MASQUERADE"
|
||||
postDown += " ; ip6tables -t nat -D POSTROUTING -o " + gatewayInterface + " -j MASQUERADE"
|
||||
postUp += "ip6tables -t nat -A POSTROUTING -o " + gatewayInterface + " -j MASQUERADE ; "
|
||||
postDown += "ip6tables -t nat -D POSTROUTING -o " + gatewayInterface + " -j MASQUERADE ; "
|
||||
}
|
||||
}
|
||||
return postUp, postDown
|
||||
|
|
|
@ -134,11 +134,11 @@ func GetFlags(hostname string) []cli.Flag {
|
|||
Usage: "Access Token for signing up machine with Netmaker server during initial 'add'.",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "login-server",
|
||||
Aliases: []string{"l"},
|
||||
EnvVars: []string{"LOGIN_SERVER"},
|
||||
Name: "server",
|
||||
Aliases: []string{"s"},
|
||||
EnvVars: []string{"HOST_SERVER"},
|
||||
Value: "",
|
||||
Usage: "Login server URL, use it for the Single Sign-on along with the network parameter",
|
||||
Usage: "Host server (domain of API) [Example: api.example.com]. Do not include \"http(s)://\" use it for the Single Sign-on along with the network parameter",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "user",
|
||||
|
|
|
@ -240,8 +240,8 @@ func GetCLIConfig(c *cli.Context) (ClientConfig, string, error) {
|
|||
if c.String("apiserver") != "" {
|
||||
cfg.Server.API = c.String("apiserver")
|
||||
}
|
||||
} else if c.String("login-server") != "" {
|
||||
cfg.SsoServer = c.String("login-server")
|
||||
} else if c.String("server") != "" {
|
||||
cfg.SsoServer = c.String("server")
|
||||
cfg.Network = c.String("network")
|
||||
cfg.Node.Network = c.String("network")
|
||||
global_settings.User = c.String("user")
|
||||
|
|
Loading…
Add table
Reference in a new issue