From 1723f5703590877d6d6c6e8e7b158a7379adeee6 Mon Sep 17 00:00:00 2001 From: afeiszli Date: Tue, 20 Sep 2022 11:50:15 -0400 Subject: [PATCH] fixing flags and config --- logic/gateway.go | 18 +++++++++--------- netclient/cli_options/flags.go | 8 ++++---- netclient/config/config.go | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/logic/gateway.go b/logic/gateway.go index 25945f3c..2837b24c 100644 --- a/logic/gateway.go +++ b/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 diff --git a/netclient/cli_options/flags.go b/netclient/cli_options/flags.go index 2887306d..89204dd2 100644 --- a/netclient/cli_options/flags.go +++ b/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", diff --git a/netclient/config/config.go b/netclient/config/config.go index 5a8276ff..2132c59d 100644 --- a/netclient/config/config.go +++ b/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")