Browse Source

Merge pull request #1580 from gravitl/bugfix_v0.16.0_flags_and_postrules

fixing flags and config
Alex Feiszli 2 years ago
parent
commit
8fe4001334
3 changed files with 15 additions and 15 deletions
  1. 9 9
      logic/gateway.go
  2. 4 4
      netclient/cli_options/flags.go
  3. 2 2
      netclient/config/config.go

+ 9 - 9
logic/gateway.go

@@ -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

+ 4 - 4
netclient/cli_options/flags.go

@@ -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",

+ 2 - 2
netclient/config/config.go

@@ -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")