diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cba2ef71..5b072c935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ ## What's New * Bug fix: Upgrading a controller from 0.22.0 or earlier to 0.22.2 will no longer leave old sessions w/o identityId properties. Workaround for previous versions is to use `ziti-controller delete-sessions` +* Bug fix: If a router/tunneler loses connectivity with the controller long enough for the api session to time out, the router will now restablish any terminators for hosted services +* Enhancement: Add some short aliases for the CLI + * edge-router -> er + * service-policy -> sp + * edge-router-policy -> erp + * service-edge-router-policy -> serp +* Feature: Add GetServiceTerminators to Golang SDK ziti.Context +* Feature: Add GetSourceIdentifier to Golang SDK edge.ServiceConn # Release 0.22.1 diff --git a/go.mod b/go.mod index 409a2618e..b319a4bc2 100644 --- a/go.mod +++ b/go.mod @@ -34,10 +34,10 @@ 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.6.1 - github.com/openziti/edge v0.20.39 - github.com/openziti/fabric v0.16.97 - github.com/openziti/foundation v0.15.71 - github.com/openziti/sdk-golang v0.15.87 + github.com/openziti/edge v0.20.42 + github.com/openziti/fabric v0.16.98 + github.com/openziti/foundation v0.15.72 + github.com/openziti/sdk-golang v0.15.90 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 diff --git a/go.sum b/go.sum index c97ab43b1..b5a9dd5f3 100644 --- a/go.sum +++ b/go.sum @@ -723,14 +723,15 @@ github.com/openziti/bbolt v1.3.6-0.20210317142109-547da822475e h1:ST9+54UtCr96S5 github.com/openziti/bbolt v1.3.6-0.20210317142109-547da822475e/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge v0.20.39 h1:1LiRJAvxQ/0WMLoc+ZR2sjNfqHzx15siHE8PL/XCKks= -github.com/openziti/edge v0.20.39/go.mod h1:Fm9gkZpN+A1ayoFTh+1fx6Ha94k7biNGhLpdoL4IOWE= -github.com/openziti/fabric v0.16.97 h1:30J85Yxg4ZOlnrTMwZp+gVCoFGKRvIp9WMPR0GUqiU8= -github.com/openziti/fabric v0.16.97/go.mod h1:unmDyUxL/FKyvSVZdFzkQfVl1gwaeTYV62R7dv2zCxQ= -github.com/openziti/foundation v0.15.71 h1:GOAFIZtthfKhWbuW2W7j4EPXAKDL3oRU9jJVWW9JUzg= -github.com/openziti/foundation v0.15.71/go.mod h1:Njk4vQbg6ILR/RQiU5DQOk35oMulQRPGHLn386+RSew= -github.com/openziti/sdk-golang v0.15.87 h1:KAKGMb2lA2SIKluzMXUWEr3DyiKBTce6SoOKc6u3/vA= -github.com/openziti/sdk-golang v0.15.87/go.mod h1:EcgYTqC9tr7b5HSiRP+v86tqbR9BjHom1xYfdBctUoc= +github.com/openziti/edge v0.20.42 h1:TGiEuycNBE41lGZ+dfZgpCxcvYL3g416AlPayvALHnU= +github.com/openziti/edge v0.20.42/go.mod h1:en8pqgrYYt690F1/PQsiiCPhUxvEu1lEJV9DJwW+TEk= +github.com/openziti/fabric v0.16.98 h1:Aybn3nhlZNkcyeUbaXewavwT0Usvc6LoGOjtU/rH2Ns= +github.com/openziti/fabric v0.16.98/go.mod h1:gqbGQLg1+eUqOKQr2FvIXhcS9TNqzdolj1q2XDrp7FY= +github.com/openziti/foundation v0.15.72 h1:2QKzS5dbAZdeawEtr0R4Rd27cqP8DIHqVNpYPhvX0c4= +github.com/openziti/foundation v0.15.72/go.mod h1:Njk4vQbg6ILR/RQiU5DQOk35oMulQRPGHLn386+RSew= +github.com/openziti/sdk-golang v0.15.89/go.mod h1:315ao/EdOOQQkN5f5yZhf5HkXxA/gWQ5NqW+ozIY+B0= +github.com/openziti/sdk-golang v0.15.90 h1:Li3US66NOBVVRINOt6EyKKP5l9beZZnQuo0F+RVFmsc= +github.com/openziti/sdk-golang v0.15.90/go.mod h1:315ao/EdOOQQkN5f5yZhf5HkXxA/gWQ5NqW+ozIY+B0= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= 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= diff --git a/ziti/cmd/ziti/cmd/edge/create_edge_router.go b/ziti/cmd/ziti/cmd/edge/create_edge_router.go index 41c043040..976206717 100644 --- a/ziti/cmd/ziti/cmd/edge/create_edge_router.go +++ b/ziti/cmd/ziti/cmd/edge/create_edge_router.go @@ -46,7 +46,7 @@ func newCreateEdgeRouterCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) cmd := &cobra.Command{ Use: "edge-router ", - Aliases: []string{"gateway"}, + Aliases: []string{"gateway", "er"}, Short: "creates an edge router managed by the Ziti Edge Controller", Long: "creates an edge router managed by the Ziti Edge Controller", Args: cobra.ExactArgs(1), diff --git a/ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go b/ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go index b42bae146..1dc0e0b54 100644 --- a/ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go +++ b/ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go @@ -42,10 +42,11 @@ func newCreateEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Wr } cmd := &cobra.Command{ - Use: "edge-router-policy ", - Short: "creates an edge-router-policy managed by the Ziti Edge Controller", - Long: "creates an edge-router-policy managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), + Use: "edge-router-policy ", + Aliases: []string{"erp"}, + Short: "creates an edge-router-policy managed by the Ziti Edge Controller", + Long: "creates an edge-router-policy managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go b/ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go index 3e787151f..891e891f1 100644 --- a/ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go +++ b/ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go @@ -42,10 +42,11 @@ func newCreateServiceEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOu } cmd := &cobra.Command{ - Use: "service-edge-router-policy ", - Short: "creates a service-edge-router-policy managed by the Ziti Edge Controller", - Long: "creates a service-edge-router-policy managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), + Use: "service-edge-router-policy ", + Aliases: []string{"serp"}, + Short: "creates a service-edge-router-policy managed by the Ziti Edge Controller", + Long: "creates a service-edge-router-policy managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/create_service_policy.go b/ziti/cmd/ziti/cmd/edge/create_service_policy.go index 910b0f695..de0ac32ff 100644 --- a/ziti/cmd/ziti/cmd/edge/create_service_policy.go +++ b/ziti/cmd/ziti/cmd/edge/create_service_policy.go @@ -45,10 +45,11 @@ func newCreateServicePolicyCmd(out io.Writer, errOut io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "service-policy ", - Short: "creates a service-policy managed by the Ziti Edge Controller", - Long: "creates a service-policy managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(2), + Use: "service-policy ", + Aliases: []string{"sp"}, + Short: "creates a service-policy managed by the Ziti Edge Controller", + Long: "creates a service-policy managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/delete.go b/ziti/cmd/ziti/cmd/edge/delete.go index 5ac04b690..fc8d9886b 100644 --- a/ziti/cmd/ziti/cmd/edge/delete.go +++ b/ziti/cmd/ziti/cmd/edge/delete.go @@ -56,12 +56,12 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(newDeleteCmdForEntityType("ca", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("config", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("config-type", newOptions())) - cmd.AddCommand(newDeleteCmdForEntityType("edge-router", newOptions())) - cmd.AddCommand(newDeleteCmdForEntityType("edge-router-policy", newOptions())) + cmd.AddCommand(newDeleteCmdForEntityType("edge-router", newOptions(), "er", "ers")) + cmd.AddCommand(newDeleteCmdForEntityType("edge-router-policy", newOptions(), "erp", "erps")) cmd.AddCommand(newDeleteCmdForEntityType("identity", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("service", newOptions())) - cmd.AddCommand(newDeleteCmdForEntityType("service-edge-router-policy", newOptions())) - cmd.AddCommand(newDeleteCmdForEntityType("service-policy", newOptions())) + cmd.AddCommand(newDeleteCmdForEntityType("service-edge-router-policy", newOptions(), "serp", "serps")) + cmd.AddCommand(newDeleteCmdForEntityType("service-policy", newOptions(), "sp", "sps")) cmd.AddCommand(newDeleteCmdForEntityType("session", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("terminator", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("posture-check", newOptions())) @@ -70,12 +70,12 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command { } // newDeleteCmdForEntityType creates the delete command for the given entity type -func newDeleteCmdForEntityType(entityType string, options *edgeOptions) *cobra.Command { +func newDeleteCmdForEntityType(entityType string, options *edgeOptions, aliases ...string) *cobra.Command { cmd := &cobra.Command{ Use: entityType + " ", Short: "deletes " + getPlural(entityType) + " managed by the Ziti Edge Controller", Args: cobra.MinimumNArgs(1), - Aliases: []string{getPlural(entityType)}, + Aliases: append(aliases, getPlural(entityType)), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/list.go b/ziti/cmd/ziti/cmd/edge/list.go index 424859952..c01fca82e 100644 --- a/ziti/cmd/ziti/cmd/edge/list.go +++ b/ziti/cmd/ziti/cmd/edge/list.go @@ -57,12 +57,12 @@ func newListCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(newListCmdForEntityType("config-types", runListConfigTypes, newOptions())) cmd.AddCommand(newListCmdForEntityType("configs", runListConfigs, newOptions())) cmd.AddCommand(newListEdgeRoutersCmd(newOptions())) - cmd.AddCommand(newListCmdForEntityType("edge-router-policies", runListEdgeRouterPolicies, newOptions())) + cmd.AddCommand(newListCmdForEntityType("edge-router-policies", runListEdgeRouterPolicies, newOptions(), "erps")) cmd.AddCommand(newListCmdForEntityType("terminators", runListTerminators, newOptions())) cmd.AddCommand(newListIdentitiesCmd(newOptions())) cmd.AddCommand(newListServicesCmd(newOptions())) - cmd.AddCommand(newListCmdForEntityType("service-edge-router-policies", runListServiceEdgeRouterPolices, newOptions())) - cmd.AddCommand(newListCmdForEntityType("service-policies", runListServicePolices, newOptions())) + cmd.AddCommand(newListCmdForEntityType("service-edge-router-policies", runListServiceEdgeRouterPolices, newOptions(), "serps")) + cmd.AddCommand(newListCmdForEntityType("service-policies", runListServicePolices, newOptions(), "sps")) cmd.AddCommand(newListCmdForEntityType("sessions", runListSessions, newOptions())) cmd.AddCommand(newListCmdForEntityType("transit-routers", runListTransitRouters, newOptions())) @@ -76,13 +76,13 @@ func newListCmd(out io.Writer, errOut io.Writer) *cobra.Command { configTypeListRootCmd := newEntityListRootCmd("config-type") configTypeListRootCmd.AddCommand(newSubListCmdForEntityType("config-type", "configs", outputConfigs, newOptions())) - edgeRouterListRootCmd := newEntityListRootCmd("edge-router") + edgeRouterListRootCmd := newEntityListRootCmd("edge-router", "er") edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "edge-router-policies", outputEdgeRouterPolicies, newOptions())) edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "service-edge-router-policies", outputServiceEdgeRouterPolicies, newOptions())) edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "identities", outputIdentities, newOptions())) edgeRouterListRootCmd.AddCommand(newSubListCmdForEntityType("edge-routers", "services", outputServices, newOptions())) - edgeRouterPolicyListRootCmd := newEntityListRootCmd("edge-router-policy") + edgeRouterPolicyListRootCmd := newEntityListRootCmd("edge-router-policy", "erp") edgeRouterPolicyListRootCmd.AddCommand(newSubListCmdForEntityType("edge-router-policies", "edge-routers", outputEdgeRouters, newOptions())) edgeRouterPolicyListRootCmd.AddCommand(newSubListCmdForEntityType("edge-router-policies", "identities", outputIdentities, newOptions())) @@ -101,11 +101,11 @@ func newListCmd(out io.Writer, errOut io.Writer) *cobra.Command { serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "identities", outputIdentities, newOptions())) serviceListRootCmd.AddCommand(newSubListCmdForEntityType("services", "edge-routers", outputEdgeRouters, newOptions())) - serviceEdgeRouterPolicyListRootCmd := newEntityListRootCmd("service-edge-router-policy") + serviceEdgeRouterPolicyListRootCmd := newEntityListRootCmd("service-edge-router-policy", "serp") serviceEdgeRouterPolicyListRootCmd.AddCommand(newSubListCmdForEntityType("service-edge-router-policies", "services", outputServices, newOptions())) serviceEdgeRouterPolicyListRootCmd.AddCommand(newSubListCmdForEntityType("service-edge-router-policies", "edge-routers", outputEdgeRouters, newOptions())) - servicePolicyListRootCmd := newEntityListRootCmd("service-policy") + servicePolicyListRootCmd := newEntityListRootCmd("service-policy", "sp") servicePolicyListRootCmd.AddCommand(newSubListCmdForEntityType("service-policies", "services", outputServices, newOptions())) servicePolicyListRootCmd.AddCommand(newSubListCmdForEntityType("service-policies", "identities", outputIdentities, newOptions())) servicePolicyListRootCmd.AddCommand(newSubListCmdForEntityType("service-policies", "posture-checks", outputPostureChecks, newOptions())) @@ -164,12 +164,13 @@ type listCommandRunner func(*edgeOptions) error type outputFunction func(o *edgeOptions, children []*gabs.Container, pagingInfo *paging) error -func newEntityListRootCmd(entityType string) *cobra.Command { +func newEntityListRootCmd(entityType string, aliases ...string) *cobra.Command { desc := fmt.Sprintf("list entities related to a %v instance managed by the Ziti Edge Controller", entityType) return &cobra.Command{ - Use: entityType, - Short: desc, - Long: desc, + Use: entityType, + Aliases: aliases, + Short: desc, + Long: desc, Run: func(cmd *cobra.Command, args []string) { err := cmd.Help() cmdhelper.CheckErr(err) @@ -178,12 +179,13 @@ func newEntityListRootCmd(entityType string) *cobra.Command { } // newListCmdForEntityType creates the list command for the given entity type -func newListCmdForEntityType(entityType string, command listCommandRunner, options *edgeOptions) *cobra.Command { +func newListCmdForEntityType(entityType string, command listCommandRunner, options *edgeOptions, aliases ...string) *cobra.Command { cmd := &cobra.Command{ - Use: entityType + " ?", - Short: "lists " + entityType + " managed by the Ziti Edge Controller", - Long: "lists " + entityType + " managed by the Ziti Edge Controller", - Args: cobra.MaximumNArgs(1), + Use: entityType + " ?", + Short: "lists " + entityType + " managed by the Ziti Edge Controller", + Long: "lists " + entityType + " managed by the Ziti Edge Controller", + Args: cobra.MaximumNArgs(1), + Aliases: aliases, Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args @@ -238,10 +240,11 @@ func newListEdgeRoutersCmd(options *edgeOptions) *cobra.Command { var roleSemantic string cmd := &cobra.Command{ - Use: "edge-routers ?", - Short: "lists edge routers managed by the Ziti Edge Controller", - Long: "lists edge routers managed by the Ziti Edge Controller", - Args: cobra.MaximumNArgs(1), + Use: "edge-routers ?", + Short: "lists edge routers managed by the Ziti Edge Controller", + Long: "lists edge routers managed by the Ziti Edge Controller", + Args: cobra.MaximumNArgs(1), + Aliases: []string{"ers"}, Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/update_edge_router.go b/ziti/cmd/ziti/cmd/edge/update_edge_router.go index dee9d85a7..1b74fd965 100644 --- a/ziti/cmd/ziti/cmd/edge/update_edge_router.go +++ b/ziti/cmd/ziti/cmd/edge/update_edge_router.go @@ -47,10 +47,11 @@ func newUpdateEdgeRouterCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) } cmd := &cobra.Command{ - Use: "edge-router ", - Short: "updates an edge router managed by the Ziti Edge Controller", - Long: "updates an edge router managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), + Use: "edge-router ", + Aliases: []string{"er"}, + Short: "updates an edge router managed by the Ziti Edge Controller", + Long: "updates an edge router managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go b/ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go index 9e35a42fb..59754d855 100644 --- a/ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go +++ b/ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go @@ -44,10 +44,11 @@ func newUpdateEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Wr } cmd := &cobra.Command{ - Use: "edge-router-policy ", - Short: "updates an edge router policy managed by the Ziti Edge Controller", - Long: "updates an edge router policy managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), + Use: "edge-router-policy ", + Aliases: []string{"erp"}, + Short: "updates an edge router policy managed by the Ziti Edge Controller", + Long: "updates an edge router policy managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go b/ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go index f6eb68c1b..b5a4a248b 100644 --- a/ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go +++ b/ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go @@ -44,10 +44,11 @@ func newUpdateServiceEdgeRouterPolicyCmd(f cmdutil.Factory, out io.Writer, errOu } cmd := &cobra.Command{ - Use: "service-edge-router-policy ", - Short: "updates a service edge router policy managed by the Ziti Edge Controller", - Long: "updates a service edge router policy managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), + Use: "service-edge-router-policy ", + Aliases: []string{"serp"}, + Short: "updates a service edge router policy managed by the Ziti Edge Controller", + Long: "updates a service edge router policy managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args diff --git a/ziti/cmd/ziti/cmd/edge/update_service_policy.go b/ziti/cmd/ziti/cmd/edge/update_service_policy.go index 6af752901..3837b4d27 100644 --- a/ziti/cmd/ziti/cmd/edge/update_service_policy.go +++ b/ziti/cmd/ziti/cmd/edge/update_service_policy.go @@ -45,10 +45,11 @@ func newUpdateServicePolicyCmd(f cmdutil.Factory, out io.Writer, errOut io.Write } cmd := &cobra.Command{ - Use: "service-policy ", - Short: "updates a service-policy managed by the Ziti Edge Controller", - Long: "updates a service-policy managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), + Use: "service-policy ", + Aliases: []string{"sp"}, + Short: "updates a service-policy managed by the Ziti Edge Controller", + Long: "updates a service-policy managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args