diff --git a/DesktopEdge/Properties/AssemblyInfo.cs b/DesktopEdge/Properties/AssemblyInfo.cs
index ec3cefc3..127f5b62 100644
--- a/DesktopEdge/Properties/AssemblyInfo.cs
+++ b/DesktopEdge/Properties/AssemblyInfo.cs
@@ -50,6 +50,6 @@ using System.Windows;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.9.3.0")]
-[assembly: AssemblyVersion("1.9.3.0")]
-[assembly: AssemblyFileVersion("1.9.3.0")]
+// [assembly: AssemblyVersion("1.9.4.0")]
+[assembly: AssemblyVersion("1.9.4.0")]
+[assembly: AssemblyFileVersion("1.9.4.0")]
diff --git a/DesktopEdge/Views/Screens/MainMenu.xaml b/DesktopEdge/Views/Screens/MainMenu.xaml
index d3a8286a..0961caf4 100644
--- a/DesktopEdge/Views/Screens/MainMenu.xaml
+++ b/DesktopEdge/Views/Screens/MainMenu.xaml
@@ -93,6 +93,21 @@
+
+
+
+
+
+
+
+
+
diff --git a/DesktopEdge/Views/Screens/MainMenu.xaml.cs b/DesktopEdge/Views/Screens/MainMenu.xaml.cs
index aeb5726e..d85a9b7a 100644
--- a/DesktopEdge/Views/Screens/MainMenu.xaml.cs
+++ b/DesktopEdge/Views/Screens/MainMenu.xaml.cs
@@ -424,6 +424,23 @@ namespace ZitiDesktopEdge {
CheckForUpdate.IsEnabled = true;
}
+ async private void UpdateConfig_Click(object sender, RoutedEventArgs e) {
+ logger.Info("updating config...");
+ DataClient client = (DataClient)Application.Current.Properties["ServiceClient"];
+ try {
+ var newMaskVar = Int32.Parse(ConfigMaskNew.Text);
+ var addDnsNewVar = Convert.ToBoolean(AddDnsNew.Text);
+
+ var r = await client.UpdateConfigAsync(ConfigIpNew.Text, newMaskVar, addDnsNewVar);
+ logger.Info("Got response from update config task : {0}", r);
+ } catch (DataStructures.ServiceException se) {
+ logger.Error(se, "service exception in update check: {0}", se.Message);
+ }
+ catch (Exception ex) {
+ logger.Error(ex, "unexpected error in update check: {0}", ex.Message);
+ }
+ }
+
async private void TriggerUpdate_Click(object sender, RoutedEventArgs e) {
try {
CheckForUpdate.IsEnabled = false;
diff --git a/Installer/ZitiDesktopEdge.aip b/Installer/ZitiDesktopEdge.aip
index fff0961b..9da73f34 100644
--- a/Installer/ZitiDesktopEdge.aip
+++ b/Installer/ZitiDesktopEdge.aip
@@ -23,10 +23,10 @@
-
+
-
+
diff --git a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs
index c64191bc..5936e0c0 100644
--- a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs
+++ b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs
@@ -459,4 +459,27 @@ namespace ZitiDesktopEdge.DataStructures {
public class MfaRecoveryCodesResponse : SvcResponse {
public string[] Payload { get; set; }
}
+
+ public class ConfigPayload
+ {
+ public string TunIPv4 { get; set; }
+ public int TunIPv4Mask { get; set; }
+ public bool AddDns { get; set; }
+ }
+
+ public class ConfigUpdateFunction : ServiceFunction
+ {
+ public ConfigUpdateFunction(string tunIPv4, int tunIPv4Mask, bool addDns)
+ {
+ this.Function = "UpdateTunIpv4";
+ this.Payload = new ConfigPayload()
+ {
+ TunIPv4 = tunIPv4,
+ TunIPv4Mask = tunIPv4Mask,
+ AddDns = addDns
+ };
+ }
+ public ConfigPayload Payload { get; set; }
+ }
+
}
diff --git a/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs b/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs
index af87b68d..cc1f0695 100644
--- a/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs
+++ b/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs
@@ -390,6 +390,30 @@ namespace ZitiDesktopEdge.ServiceClient {
return;
}
+ async public Task UpdateConfigAsync(string tunIPv4, int tunIPv4Mask, bool addDns) {
+ SvcResponse resp = null;
+ try {
+
+ ConfigUpdateFunction configPayload = new ConfigUpdateFunction(tunIPv4, tunIPv4Mask, addDns);
+
+ await sendAsync(configPayload);
+ resp = await readAsync(ipcReader);
+ Logger.Debug("config update payload is sent to the ziti tunnel");
+ } catch (Exception ex) {
+ //almost certainly a problem with the pipe - recreate the pipe...
+ //setupPipe();
+ //throw;
+ Logger.Error(ex, "Unexpected error");
+ CommunicationError(ex);
+ throw ex;
+ }
+ if (resp?.Code != 0) {
+ Logger.Warn("failed to update the config. {0} {1}", resp.Message, resp.Error);
+ throw new ServiceException("Failed to update the config", resp.Code, "Un expected error.");
+ }
+ return resp;
+ }
+
async public Task debugAsync() {
try {
await sendAsync(new ServiceFunction() { Function = "Debug" });
diff --git a/ZitiUpdateService/Properties/AssemblyInfo.cs b/ZitiUpdateService/Properties/AssemblyInfo.cs
index 6c15d9ab..7b16007f 100644
--- a/ZitiUpdateService/Properties/AssemblyInfo.cs
+++ b/ZitiUpdateService/Properties/AssemblyInfo.cs
@@ -30,6 +30,6 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.9.3.0")]
-[assembly: AssemblyVersion("1.9.3.0")]
-[assembly: AssemblyFileVersion("1.9.3.0")]
+// [assembly: AssemblyVersion("1.9.4.0")]
+[assembly: AssemblyVersion("1.9.4.0")]
+[assembly: AssemblyFileVersion("1.9.4.0")]
diff --git a/release-notes.md b/release-notes.md
index 67b66a3f..821b8fc0 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -1,16 +1,13 @@
-# Release 1.9.3
+# Release 1.9.4
## What's New
-* Page Service List
-* Sort Service on Identity Details Page
-* Consistent UX for MFA Screens
+* none
## Other changes:
-* Service to UI interaction is now with one bulk update of services instead of one event per service update
-* Added a configuration option to control if DNS is applied to the TUN. Some users are having issues with NRPT-only working. For now we'll add a boolean that allows the user to control if DNS should be added to the TUN
+* none
## Bugs fixed:
-* none
+* [#362](https://github.com/openziti/desktop-edge-win/issues/362) Update tun ip, mask and addDns flag
## Dependency Updates
* none
@@ -24,6 +21,7 @@
## Other changes:
* Service to UI interaction is now with one bulk update of services instead of one event per service update
+* Added a configuration option to control if DNS is applied to the TUN. Some users are having issues with NRPT-only working. For now we'll add a boolean that allows the user to control if DNS should be added to the TUN
## Bugs fixed:
* none
diff --git a/service/ziti-tunnel/cli/constants.go b/service/ziti-tunnel/cli/constants.go
index 3c21a278..150d45af 100644
--- a/service/ziti-tunnel/cli/constants.go
+++ b/service/ziti-tunnel/cli/constants.go
@@ -42,6 +42,10 @@ var NOTIFY_IDENTITY_UI = dto.CommandMsg{
Function: "NotifyIdentityUI",
}
+var UPDATE_TUN_IPV4 = dto.CommandMsg{
+ Function: "UpdateTunIpv4",
+}
+
var monitorIpcPipe = `\\.\pipe\OpenZiti\ziti-monitor\ipc`
var templateIdentity = `{{printf "%40s" "Name"}} | {{printf "%41s" "FingerPrint"}} | {{printf "%6s" "Active"}} | {{printf "%30s" "Config"}} | {{"Status"}}
diff --git a/service/ziti-tunnel/cli/responseGenerator.go b/service/ziti-tunnel/cli/responseGenerator.go
index f0143d26..d469dad7 100644
--- a/service/ziti-tunnel/cli/responseGenerator.go
+++ b/service/ziti-tunnel/cli/responseGenerator.go
@@ -57,11 +57,11 @@ func convertToServiceCli(svc dto.Service) dto.ServiceCli {
}
return dto.ServiceCli{
- Name: svc.Name,
- Id: svc.Id,
- Protocols: strings.Join(svc.Protocols, ","),
- Ports: cliPorts,
- Addresses: cliAddresses,
+ Name: svc.Name,
+ Id: svc.Id,
+ Protocols: strings.Join(svc.Protocols, ","),
+ Ports: cliPorts,
+ Addresses: cliAddresses,
}
}
diff --git a/service/ziti-tunnel/cli/service.go b/service/ziti-tunnel/cli/service.go
index ae695c88..dd6ebcfb 100644
--- a/service/ziti-tunnel/cli/service.go
+++ b/service/ziti-tunnel/cli/service.go
@@ -1,9 +1,27 @@
package cli
-import (
- "strings"
+/*
+ * Copyright NetFoundry, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import (
"github.com/openziti/desktop-edge-win/service/ziti-tunnel/dto"
+ "strconv"
+ "strings"
+ "net"
)
//GetIdentities is to fetch identities through cmdline
@@ -53,3 +71,40 @@ func SetLogLevel(args []string, flags map[string]bool) {
func GetFeedback(args []string, flags map[string]bool) {
GetDataFromMonitorIpcPipe(&dto.FEEDBACK_REQUEST, args, flags)
}
+
+func UpdateConfigIPSubnet(args []string, flags map[string]interface{}) {
+ CIDRstring := flags["CIDR"]
+ AddDns := flags["AddDns"]
+ log.Info("Updating the config file")
+
+ updateTunIpv4Payload := make(map[string]interface{})
+ if CIDRstring != "" {
+ ip, ipnet, err := net.ParseCIDR(CIDRstring.(string))
+ if err != nil {
+ log.Error("Incorrect cidr %s", CIDRstring.(string))
+ }
+ ipMask, _ := ipnet.Mask.Size()
+
+ updateTunIpv4Payload["TunIPv4"] = ip
+ updateTunIpv4Payload["TunIPv4Mask"] = ipMask
+ }
+ if AddDns != "" {
+ addDnsBool, err := strconv.ParseBool(AddDns.(string))
+
+ if err != nil {
+ log.Errorf("Incorrect addDns %v", err)
+ return
+ }
+ updateTunIpv4Payload["AddDns"] = addDnsBool
+ }
+
+ UPDATE_TUN_IPV4.Payload = updateTunIpv4Payload
+ log.Debugf("updateTunIpv4 Payload %v", UPDATE_TUN_IPV4)
+
+ status := GetDataFromIpcPipe(&UPDATE_TUN_IPV4, nil, GetResponseObjectFromRTS, args, nil)
+
+ if !status {
+ log.Infof("Config can be updated only if the tunnel is started")
+ }
+
+}
diff --git a/service/ziti-tunnel/cmd/config.go b/service/ziti-tunnel/cmd/config.go
new file mode 100644
index 00000000..81c2ee08
--- /dev/null
+++ b/service/ziti-tunnel/cmd/config.go
@@ -0,0 +1,41 @@
+package cmd
+
+/*
+ * Copyright NetFoundry, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import (
+ "github.com/spf13/cobra"
+)
+
+// configCmd represents the config command
+var configCmd = &cobra.Command{
+ Use: "config",
+ Short: "A brief description of your command",
+ Long: `A longer description that spans multiple lines and likely contains examples
+and usage of using your command. For example:
+
+Cobra is a CLI library for Go that empowers applications.
+This application is a tool to generate the needed files
+to quickly create a Cobra application.`,
+ Run: func(cmd *cobra.Command, args []string) {
+ checkHelp()
+ },
+}
+
+func init() {
+ rootCmd.AddCommand(configCmd)
+}
diff --git a/service/ziti-tunnel/cmd/update.go b/service/ziti-tunnel/cmd/update.go
new file mode 100644
index 00000000..25d2461c
--- /dev/null
+++ b/service/ziti-tunnel/cmd/update.go
@@ -0,0 +1,50 @@
+package cmd
+
+/*
+ * Copyright NetFoundry, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import (
+ "github.com/openziti/desktop-edge-win/service/ziti-tunnel/cli"
+
+ "github.com/spf13/cobra"
+)
+
+var CIDR string
+var AddDns string
+
+// updateCmd represents the update command
+var updateCmd = &cobra.Command{
+ Use: "update",
+ Short: "Updates data into the ziti-tunnel",
+ Long: `update command should be used as a sub command to the main command
+ It helps to update the data into the ziti-tunnel.
+ eg: ziti-tunnel config update --CIDR 100.64.0.1/10 --AddDns=true`,
+ Run: func(cmd *cobra.Command, args []string) {
+ flags := map[string]interface{}{}
+ flags["CIDR"] = CIDR
+ flags["AddDns"] = AddDns
+ cli.UpdateConfigIPSubnet(args,flags)
+ },
+}
+
+func init() {
+ configCmd.AddCommand(updateCmd)
+
+ updateCmd.Flags().StringVar(&CIDR, "CIDR", "", "Updates the cidr property in the config file")
+ updateCmd.Flags().StringVar(&AddDns, "AddDns", "", "Updates the Add Dns property in the config file")
+
+}
diff --git a/service/ziti-tunnel/main.go b/service/ziti-tunnel/main.go
index c1c3f236..1b5a51db 100644
--- a/service/ziti-tunnel/main.go
+++ b/service/ziti-tunnel/main.go
@@ -111,6 +111,8 @@ func main() {
commandline.Execute()
case "feedback":
commandline.Execute()
+ case "config":
+ commandline.Execute()
default:
usage(fmt.Sprintf("invalid command %s", cmd))
}
@@ -126,7 +128,7 @@ func usage(errmsg string) {
"%s\n\n"+
"usage: %s \n"+
" where is one of\n"+
- " install, remove, debug, start, stop, pause, continue, list, identity, loglevel, feedback or version.\n",
+ " install, remove, debug, start, stop, pause, continue, list, identity, loglevel, feedback, config or version.\n",
errmsg, os.Args[0])
os.Exit(2)
}
diff --git a/service/ziti-tunnel/service/ipc.go b/service/ziti-tunnel/service/ipc.go
index 4bd5cf49..d2343c10 100644
--- a/service/ziti-tunnel/service/ipc.go
+++ b/service/ziti-tunnel/service/ipc.go
@@ -42,6 +42,7 @@ import (
"os"
"os/signal"
"strings"
+ "strconv"
"sync"
"time"
)
@@ -498,6 +499,21 @@ func serveIpc(conn net.Conn) {
//save the state
rts.SaveState()
+ case "UpdateTunIpv4":
+ var tunIPv4 string
+ var tunIPv4Mask int
+ var addDns string
+ if cmd.Payload["TunIPv4"] != nil {
+ tunIPv4 = cmd.Payload["TunIPv4"].(string)
+ }
+ if cmd.Payload["TunIPv4Mask"] != nil {
+ var tunIpv4Mask = cmd.Payload["TunIPv4Mask"].(float64)
+ tunIPv4Mask = int(tunIpv4Mask)
+ }
+ if cmd.Payload["AddDns"] != nil {
+ addDns = strconv.FormatBool(cmd.Payload["AddDns"].(bool))
+ }
+ updateTunIpv4(enc, tunIPv4, tunIPv4Mask, addDns)
case "NotifyLogLevelUIAndUpdateService":
sendLogLevelAndNotify(enc, cmd.Payload["Level"].(string))
case "NotifyIdentityUI":
@@ -622,6 +638,17 @@ func setLogLevel(out *json.Encoder, level string) {
respond(out, dto.Response{Message: "log level set", Code: SUCCESS, Error: "", Payload: nil})
}
+func updateTunIpv4(out *json.Encoder, ip string, ipMask int, addDns string) {
+
+ err := UpdateRuntimeStateIpv4(ip, ipMask, addDns)
+ if err != nil {
+ respondWithError(out, "Could not set Tun ip and mask", UNKNOWN_ERROR, err)
+ return
+ }
+
+ respond(out, dto.Response{Message: "TunIPv4 and mask is set, Manual Restart is required", Code: SUCCESS, Error: "", Payload: ""})
+}
+
func serveLogs(conn net.Conn) {
log.Debug("accepted a logs connection, writing logs to pipe")
w := bufio.NewWriter(conn)
diff --git a/service/ziti-tunnel/service/state.go b/service/ziti-tunnel/service/state.go
index cb5b06a3..aa625adb 100644
--- a/service/ziti-tunnel/service/state.go
+++ b/service/ziti-tunnel/service/state.go
@@ -29,7 +29,8 @@ import (
"path"
"strings"
"time"
-
+ "errors"
+ "strconv"
"github.com/openziti/desktop-edge-win/service/cziti"
"github.com/openziti/desktop-edge-win/service/ziti-tunnel/config"
"github.com/openziti/desktop-edge-win/service/ziti-tunnel/constants"
@@ -106,6 +107,7 @@ func backupConfig() (string, error) {
return backup, err
}
+
func (t *RuntimeState) ToStatus(onlyInitialized bool) dto.TunnelStatus {
var uptime int64
@@ -401,6 +403,36 @@ func (t *RuntimeState) UpdateIpv4(ipv4 string) {
rts.SaveState()
}
+func UpdateRuntimeStateIpv4(ip string, ipv4Mask int, addDns string) error {
+
+ log.Infof("updating configuration ip: %s, mask: %d, dns: %t", ip, ipv4Mask, addDns)
+
+ if ipv4Mask < constants.Ipv4MaxMask || ipv4Mask > constants.Ipv4MinMask {
+ return errors.New(fmt.Sprintf("ipv4Mask should be between %d and %d", constants.Ipv4MaxMask, constants.Ipv4MinMask))
+ }
+
+ if addDns != "" {
+ addDnsBool, err := strconv.ParseBool(addDns)
+
+ if err != nil {
+ return errors.New(fmt.Sprintf("Incorrect addDns %v", err))
+ }
+
+ rts.state.AddDns = addDnsBool
+ }
+
+ // if ip is not empty, then we set both ip and mask
+ if ip != "" {
+ rts.state.TunIpv4 = ip
+ rts.state.TunIpv4Mask = ipv4Mask
+ }
+
+ rts.SaveState()
+
+
+ return nil
+}
+
// uses the registry to determine if IPv6 is enabled or disabled on this machine. If it is disabled an IPv6 DNS entry
// will end up causing a fatal error on startup of the service. For this registry key and values see the MS documentation
// at https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/configure-ipv6-in-windows
diff --git a/service/ziti-tunnel/version.go b/service/ziti-tunnel/version.go
index 6f114ee5..f7619a3b 100644
--- a/service/ziti-tunnel/version.go
+++ b/service/ziti-tunnel/version.go
@@ -20,9 +20,9 @@
package main
const (
- Version = "1.9.3"
- Revision = "a02a50cf6437"
- Branch = "main"
+ Version = "1.9.4"
+ Revision = "138ceebaefbf"
+ Branch = "release-next"
BuildUser = ""
- BuildDate = "2021-04-12 17:35:14"
+ BuildDate = "2021-04-15 16:07:55"
)
diff --git a/version b/version
index 77fee73a..d615fd0c 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-1.9.3
+1.9.4