diff --git a/CHANGELOG.md b/CHANGELOG.md index 4030187b0..52f59d066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,88 @@ +# Release 0.18.8 + +## What's New + +* Websocket binding in Edge Router to support connections from BrowZer-based apps that use + the `ziti-sdk-js`. Edge Routers support various configurations including a single `tls` binding, a + single `ws` binding, or having both `tls` and `ws` bindings simultaneously. If both binding types + are used, they must be specified with different ports. +* Edge Router list for current identity +* Fix terminator PATCH, don't update/clear peer data unless requested +* Fix concurrency related crash in router +* Fix resource leak in fabric: forwarder tables weren't always updated after unroute + +## Websocket Binding + +``` +# Example Edge Router config snippet (note new `ws` address type): + +listeners: + - binding: edge + address: ws:0.0.0.0:3021 + options: + advertise: curt-edge-ws-router:3021 + - binding: edge + address: tls:0.0.0.0:3022 + options: + advertise: curt-edge-ws-router:3022 +``` + +* Fix router memory leak: purge session from forwardTable during unroutTimeout + +## Edge Router List For Current Identity + +A new endpoint has been added which will display the list of Edge Routers an authenticated session +has access to via any policy. The records will indicate whether the router is online, its hostname, +and its supported protocols. This endpoint will not return Edge Routers that have not completed +enrollment. Edge Routers that are offline will not have hostname and supported protocol information. + +Endpoint: `GET /current-identity/edge-routers` + +Example Output: + +``` +{ + "data": [ + { + "createdAt": "2021-01-27T20:13:18.599Z", + "id": "LolSlAQMq", + "tags": {}, + "updatedAt": "2021-01-27T20:13:19.762Z", + "hostname": "", + "isOnline": false, + "name": "er1", + "supportedProtocols": {} + }, + { + "createdAt": "2021-01-27T20:13:19.308Z", + "id": "oVzRl6kCq", + "tags": {}, + "updatedAt": "2021-01-27T20:13:19.901Z", + "hostname": "127.0.0.1:5002", + "isOnline": true, + "name": "er2", + "supportedProtocols": { + "tls": "tls://127.0.0.1:5002", + "wss": "wss://127.0.0.1:5002" + } + } + ], + "meta": { + "filterableFields": [ + "id", + "createdAt", + "updatedAt", + "name", + ], + "pagination": { + "limit": 10, + "offset": 0, + "totalCount": 2 + } + } +} +``` + # Release 0.18.7 ## What's New diff --git a/common/enrollment/enroll.go b/common/enrollment/enroll.go index 06f76443c..53fe1a17c 100644 --- a/common/enrollment/enroll.go +++ b/common/enrollment/enroll.go @@ -92,9 +92,9 @@ func NewEnrollCommand() *cobra.Command { var keyDesc = "" engines := certtools.ListEngines() if len(engines) > 0 { - keyDesc = fmt.Sprintf("The key to use with the certifcate. Optionally specify the engine to use. supported engines: %v", engines) + keyDesc = fmt.Sprintf("The key to use with the certificate. Optionally specify the engine to use. supported engines: %v", engines) } else { - keyDesc = fmt.Sprintf("The key to use with the certifcate.") + keyDesc = fmt.Sprintf("The key to use with the certificate.") } enrollSubCmd.Flags().StringVarP(&keyPath, "key", "k", "", keyDesc) diff --git a/go.mod b/go.mod index 20e787b9e..4730ffd4f 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ go 1.15 //replace github.com/openziti/sdk-golang => ../sdk-golang -//replace github.com/openziti/edge => ../edge +// replace github.com/openziti/edge => ../edge require ( github.com/Jeffail/gabs v1.4.0 @@ -24,9 +24,9 @@ require ( github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.3.6 - github.com/openziti/edge v0.17.56 - github.com/openziti/fabric v0.15.18 - github.com/openziti/foundation v0.15.10 + github.com/openziti/edge v0.17.60 + github.com/openziti/fabric v0.15.20 + github.com/openziti/foundation v0.15.12 github.com/openziti/sdk-golang v0.15.13 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 8cef59055..aedf2e0df 100644 --- a/go.sum +++ b/go.sum @@ -520,18 +520,23 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openziti/edge v0.17.56 h1:K775G+6l1GT9xwlt5UOCGteu91PTwX9jBsHm+P9okTs= -github.com/openziti/edge v0.17.56/go.mod h1:pHFEpTmILwipHcmvMzSYDKLaWGgb5Iob/4CHp8UdppQ= -github.com/openziti/fabric v0.15.15/go.mod h1:H2bwevoCxvJxr3xIsG9AQq9Wy+rxOMNrJTQaPzj/Pas= +github.com/openziti/edge v0.17.60 h1:Qfwqh+7S9SiTE6DiN4/fhWRfrvo4sEVUnUbRRXoBTs8= +github.com/openziti/edge v0.17.60/go.mod h1:tuzW9dGztEPiDY8P7a45dq+N8VA3KRDGnYIGOR+DFJE= github.com/openziti/fabric v0.15.18 h1:Ze/v2ZCGjo2QqA5Y+o2PP/Mcf/GLRSDGc3Ia2+2c6jw= github.com/openziti/fabric v0.15.18/go.mod h1:KKvO246Nk8twpNv+Mee60NVJh83eh9ZreAb3H8JEnJY= +github.com/openziti/fabric v0.15.20 h1:V3ILMQEbVVGzs/ciHWZe/elPa6stL+O2jmJbozHlhcM= +github.com/openziti/fabric v0.15.20/go.mod h1:2Q63EWL1MDcdhZYoaMQDVjbGzRgonIdgRmzxaNDHJI0= github.com/openziti/foundation v0.15.9/go.mod h1:34ifQ24R2EUNjakzZBKY1M4EvnOWeIYJOrJxRGdRNh4= github.com/openziti/foundation v0.15.10 h1:gDU2Ot2u50q+x5kkVvJqi4XjLeZRVRoVCFJjN6QCCFA= github.com/openziti/foundation v0.15.10/go.mod h1:34ifQ24R2EUNjakzZBKY1M4EvnOWeIYJOrJxRGdRNh4= +github.com/openziti/foundation v0.15.12 h1:fdhhEsJPfvVIdarY4fd4gPGHkOGIAuxIig2hHweZ9K0= +github.com/openziti/foundation v0.15.12/go.mod h1:34ifQ24R2EUNjakzZBKY1M4EvnOWeIYJOrJxRGdRNh4= github.com/openziti/sdk-golang v0.15.13 h1:Pd5WqFcPxrM8o/VeqCoKeGCgL+pC9Y5dVb1tqMhRprI= github.com/openziti/sdk-golang v0.15.13/go.mod h1:L1UbvXUV7DV6a3pd50CAJqtt9z6nN53p2cKNJlHZXR8= github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6 h1:lNCW6THrCKBiJBpz8kbVGjC7MgdCGKwuvBgc7LoD6sw= github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= +github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231 h1:fa50YL1pzKW+1SsBnJDOHppJN9stOEwS+CRWyUtyYGU= +github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= diff --git a/ziti-enroller/subcmd/root.go b/ziti-enroller/subcmd/root.go index 1547dc66d..61ee594fc 100644 --- a/ziti-enroller/subcmd/root.go +++ b/ziti-enroller/subcmd/root.go @@ -53,9 +53,9 @@ func init() { var keyDesc = "" engines := certtools.ListEngines() if len(engines) > 0 { - keyDesc = fmt.Sprintf("The key to use with the certifcate. Optionally specify the engine to use. supported engines: %v", engines) + keyDesc = fmt.Sprintf("The key to use with the certificate. Optionally specify the engine to use. supported engines: %v", engines) } else { - keyDesc = fmt.Sprintf("The key to use with the certifcate.") + keyDesc = fmt.Sprintf("The key to use with the certificate.") } rootCmd.Flags().StringVarP(&keyPath, "key", "k", "", keyDesc) diff --git a/ziti-router/main.go b/ziti-router/main.go index d20203cbd..f99bce3f4 100644 --- a/ziti-router/main.go +++ b/ziti-router/main.go @@ -24,6 +24,7 @@ import ( "github.com/openziti/foundation/transport/tcp" "github.com/openziti/foundation/transport/tls" "github.com/openziti/foundation/transport/transwarp" + "github.com/openziti/foundation/transport/ws" "github.com/openziti/foundation/transport/wss" "github.com/openziti/ziti/common/version" "github.com/openziti/ziti/ziti-router/subcmd" @@ -38,6 +39,7 @@ func init() { transport.AddAddressParser(tls.AddressParser{}) transport.AddAddressParser(tcp.AddressParser{}) transport.AddAddressParser(transwarp.AddressParser{}) + transport.AddAddressParser(ws.AddressParser{}) transport.AddAddressParser(wss.AddressParser{}) build.InitBuildInfo(version.GetCmdBuildInfo()) diff --git a/ziti-router/subcmd/enrollgw.go b/ziti-router/subcmd/enrollgw.go index 10f20634d..162a56a28 100644 --- a/ziti-router/subcmd/enrollgw.go +++ b/ziti-router/subcmd/enrollgw.go @@ -20,16 +20,20 @@ import ( "github.com/michaelquigley/pfxlog" "github.com/openziti/edge/router/enroll" "github.com/openziti/fabric/router" + "github.com/openziti/sdk-golang/ziti/config" "github.com/spf13/cobra" "io/ioutil" ) var jwtPath *string var engine *string +var keyAlg config.KeyAlgVar func init() { jwtPath = enrollEdgeRouterCmd.Flags().StringP("jwt", "j", "", "The path to a JWT file") engine = enrollEdgeRouterCmd.Flags().StringP("engine", "e", "", "An engine") + keyAlg.Set("RSA") // set default + enrollEdgeRouterCmd.Flags().VarP(&keyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key") root.AddCommand(enrollEdgeRouterCmd) } @@ -57,7 +61,7 @@ func enrollGw(cmd *cobra.Command, args []string) { log.Panicf("could not load JWT file from path [%s]", *jwtPath) } - if err := enroller.Enroll(jwtBuf, true, *engine); err != nil { + if err := enroller.Enroll(jwtBuf, true, *engine, keyAlg); err != nil { log.Fatalf("enrollment failure: (%v)", err) } } else { diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go b/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go index ff8a24e46..3802b3ed9 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go +++ b/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go @@ -101,7 +101,10 @@ func rootPostRun(cmd *cobra.Command, _ []string) { log := pfxlog.Logger() if cliAgentEnabled { - if err := agent.Listen(agent.Options{Addr: cliAgentAddr}); err != nil { + // don't use the agent's shutdown handler. it calls os.Exit on SIGINT + // which interferes with the servicePoller shutdown + cleanup := false + if err := agent.Listen(agent.Options{Addr: cliAgentAddr, ShutdownCleanup: &cleanup}); err != nil { pfxlog.Logger().WithError(err).Error("unable to start CLI agent") } } @@ -151,4 +154,7 @@ func rootPostRun(cmd *cobra.Command, _ []string) { log.WithError(err).Fatal("failed to authenticate") } serviceListener.WaitForShutdown() + if cliAgentEnabled { + agent.Close() + } }