From baef79211b1c897e4978952dcb1b4b6126698313 Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Mon, 23 May 2022 18:09:24 -0400 Subject: [PATCH 1/6] adds CLI support for authenticators/enrollments/re-enrollment - adds ability to list enrollments/authenticators - adds ability to delte enrollments/authenticators - adds ability to create authenticators --- CHANGELOG.md | 29 ++ ziti/cmd/ziti/cmd/edge/create.go | 1 + ziti/cmd/ziti/cmd/edge/create_enrollment.go | 276 ++++++++++++++++++ ziti/cmd/ziti/cmd/edge/delete.go | 5 +- .../cmd/ziti/cmd/edge/delete_authenticator.go | 37 --- .../cmd/edge/delete_authenticator_updb.go | 102 ------- ziti/cmd/ziti/cmd/edge/list.go | 75 +++++ 7 files changed, 384 insertions(+), 141 deletions(-) create mode 100644 ziti/cmd/ziti/cmd/edge/create_enrollment.go delete mode 100644 ziti/cmd/ziti/cmd/edge/delete_authenticator.go delete mode 100644 ziti/cmd/ziti/cmd/edge/delete_authenticator_updb.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bf15b84d..8546cbdd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ +# Release 0.25.10 + +## What's New +- Edge + - N/A +- Fabric + - Bug fixes +- Ziti CLI + - N/A +- SDK Golang + - N/A + +## Ziti CLI + +### CLI support for enrollments/authenticators/re-enrollment + +The CLI has been augmented to support the following commands: + +- `ziti edge list authenticators` - to generically list existing authenticators +- `ziti edge list enrollments` - to generically list existing enrollments +- `ziti edge delete enrollment ` - to generically delete existing enrollments +- `ziti edge delete authenticator ` - to generically delete existing authenticator +- `ziti edge create enrollment ott ...` - to create a new one-time-token enrollment for an existing identity +- `ziti edge create enrollment ottca ...` - to create a new one-time-token enrollment for an existing identity for a 3rd party CA issued certificate +- `ziti edge create enrollment updb ...` - to create a new updb (username/password) enrollment for an existing identity + +These commands, specifically the enrollment related ones, can be used to re-enroll existing identities. See the 0.25.9 +changelog for details. For all arguments and options, please see their CLI related `-h`. + # Release 0.25.9 ## What's New diff --git a/ziti/cmd/ziti/cmd/edge/create.go b/ziti/cmd/ziti/cmd/edge/create.go index 868678d73..9fcaa6597 100644 --- a/ziti/cmd/ziti/cmd/edge/create.go +++ b/ziti/cmd/ziti/cmd/edge/create.go @@ -49,6 +49,7 @@ func newCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(newCreateServiceEdgeRouterPolicyCmd(out, errOut)) cmd.AddCommand(newCreateServicePolicyCmd(out, errOut)) cmd.AddCommand(newCreatePostureCheckCmd(out, errOut)) + cmd.AddCommand(newCreateEnrollmentCmd(out, errOut)) return cmd } diff --git a/ziti/cmd/ziti/cmd/edge/create_enrollment.go b/ziti/cmd/ziti/cmd/edge/create_enrollment.go new file mode 100644 index 000000000..1e6f77205 --- /dev/null +++ b/ziti/cmd/ziti/cmd/edge/create_enrollment.go @@ -0,0 +1,276 @@ +/* + 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. +*/ + +package edge + +import ( + "context" + "fmt" + "github.com/go-openapi/strfmt" + "github.com/openziti/edge/rest_management_api_client/enrollment" + "github.com/openziti/edge/rest_model" + "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/spf13/cobra" + "io" + "time" +) + +func newCreateEnrollmentCmd(out io.Writer, errOut io.Writer) *cobra.Command { + cmd := &cobra.Command{ + Use: "enrollment", + } + + cmd.AddCommand(newCreateEnrollmentOtt(out, errOut)) + cmd.AddCommand(newCreateEnrollmentOttCa(out, errOut)) + cmd.AddCommand(newCreateEnrollmentUpdb(out, errOut)) + + return cmd +} + +type createEnrollmentOptions struct { + api.Options + name string + duration int64 +} + +func newCreateEnrollmentOtt(out io.Writer, errOut io.Writer) *cobra.Command { + options := &createEnrollmentOptions{ + Options: api.Options{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ott [-duration ]", + Short: "creates a one-time-token (ott) enrollment for the given identity", + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + + err := runCreateEnrollmentOtt(options) + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{}, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + options.AddCommonFlags(cmd) + cmd.Flags().Int64VarP(&options.duration, "duration", "d", 30, "the duration of time the enrollment should valid for") + + return cmd +} + +func newCreateEnrollmentOttCa(out io.Writer, errOut io.Writer) *cobra.Command { + options := &createEnrollmentOptions{ + Options: api.Options{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ottca [-duration ]", + Short: "creates a one-time-token ca (ottca) enrollment for the given identity and ca", + Args: cobra.ExactArgs(2), + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + + err := runCreateEnrollmentOttCa(options) + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{}, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + options.AddCommonFlags(cmd) + cmd.Flags().Int64VarP(&options.duration, "duration", "d", 30, "the duration of time the enrollment should valid for") + + return cmd +} + +func runCreateEnrollmentOtt(options *createEnrollmentOptions) error { + managementClient, err := util.NewEdgeManagementClient(options) + + if err != nil { + return err + } + + identityId, err := mapNameToID("identities", options.Args[0], options.Options) + + if err != nil { + return err + } + + method := rest_model.EnrollmentCreateMethodOtt + expiresAt := strfmt.DateTime(time.Now().Add(time.Duration(options.duration) * time.Minute)) + + params := &enrollment.CreateEnrollmentParams{ + Enrollment: &rest_model.EnrollmentCreate{ + ExpiresAt: &expiresAt, + IdentityID: &identityId, + Method: &method, + }, + Context: context.Background(), + } + + resp, err := managementClient.Enrollment.CreateEnrollment(params, nil) + + if err != nil { + return util.WrapIfApiError(err) + } + + enrollmentID := resp.GetPayload().Data.ID + + if _, err = fmt.Fprintf(options.Out, "%v\n", enrollmentID); err != nil { + panic(err) + } + + return err +} + +func runCreateEnrollmentOttCa(options *createEnrollmentOptions) error { + managementClient, err := util.NewEdgeManagementClient(options) + + if err != nil { + return err + } + + identityId, err := mapNameToID("identities", options.Args[0], options.Options) + + if err != nil { + return err + } + + caId, err := mapNameToID("cas", options.Args[1], options.Options) + + if err != nil { + return err + } + + method := rest_model.EnrollmentCreateMethodOttca + expiresAt := strfmt.DateTime(time.Now().Add(time.Duration(options.duration) * time.Minute)) + + params := &enrollment.CreateEnrollmentParams{ + Enrollment: &rest_model.EnrollmentCreate{ + ExpiresAt: &expiresAt, + IdentityID: &identityId, + Method: &method, + CaID: &caId, + }, + Context: context.Background(), + } + + resp, err := managementClient.Enrollment.CreateEnrollment(params, nil) + + if err != nil { + return util.WrapIfApiError(err) + } + + enrollmentID := resp.GetPayload().Data.ID + + if _, err = fmt.Fprintf(options.Out, "%v\n", enrollmentID); err != nil { + panic(err) + } + + return err +} + +func newCreateEnrollmentUpdb(out io.Writer, errOut io.Writer) *cobra.Command { + options := &createEnrollmentOptions{ + Options: api.Options{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "updb [-duration ]", + Short: "creates a username password (updb) enrollment for the given identity", + Args: cobra.ExactArgs(2), + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + + err := runCreateEnrollmentUpdb(options) + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{}, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + options.AddCommonFlags(cmd) + cmd.Flags().Int64VarP(&options.duration, "duration", "d", 30, "the duration of time the enrollment should valid for") + + return cmd +} + +func runCreateEnrollmentUpdb(options *createEnrollmentOptions) error { + managementClient, err := util.NewEdgeManagementClient(options) + + if err != nil { + return err + } + + identityId, err := mapNameToID("identities", options.Args[0], options.Options) + + if err != nil { + return err + } + + username := options.Args[1] + + method := rest_model.EnrollmentCreateMethodUpdb + expiresAt := strfmt.DateTime(time.Now().Add(time.Duration(options.duration) * time.Minute)) + + params := &enrollment.CreateEnrollmentParams{ + Enrollment: &rest_model.EnrollmentCreate{ + ExpiresAt: &expiresAt, + IdentityID: &identityId, + Method: &method, + Username: &username, + }, + Context: context.Background(), + } + + resp, err := managementClient.Enrollment.CreateEnrollment(params, nil) + + if err != nil { + return util.WrapIfApiError(err) + } + + enrollmentID := resp.GetPayload().Data.ID + + if _, err = fmt.Fprintf(options.Out, "%v\n", enrollmentID); err != nil { + panic(err) + } + + return err +} diff --git a/ziti/cmd/ziti/cmd/edge/delete.go b/ziti/cmd/ziti/cmd/edge/delete.go index a4b408ca6..580f55836 100644 --- a/ziti/cmd/ziti/cmd/edge/delete.go +++ b/ziti/cmd/ziti/cmd/edge/delete.go @@ -52,7 +52,8 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command { } cmd.AddCommand(newDeleteCmdForEntityType("api-session", newOptions())) - cmd.AddCommand(newDeleteAuthenticatorCmd("authenticator", newOptions())) + cmd.AddCommand(newDeleteCmdForEntityType("authenticator", newOptions())) + cmd.AddCommand(newDeleteCmdForEntityType("enrollment", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("ca", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("config", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("config-type", newOptions())) @@ -119,7 +120,7 @@ func newDeleteWhereCmdForEntityType(entityType string, options *api.Options) *co func runDeleteEntityOfType(o *api.Options, entityType string) error { var err error ids := o.Args - if entityType != "terminators" && entityType != "api-sessions" && entityType != "sessions" { + if entityType != "terminators" && entityType != "api-sessions" && entityType != "sessions" && entityType != "authenticators" && entityType != "enrollments" { ids, err = mapNamesToIDs(entityType, *o, ids...) } if err != nil { diff --git a/ziti/cmd/ziti/cmd/edge/delete_authenticator.go b/ziti/cmd/ziti/cmd/edge/delete_authenticator.go deleted file mode 100644 index a315c1af4..000000000 --- a/ziti/cmd/ziti/cmd/edge/delete_authenticator.go +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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. -*/ - -package edge - -import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/spf13/cobra" -) - -func newDeleteAuthenticatorCmd(idType string, options *api.Options) *cobra.Command { - - cmd := &cobra.Command{ - Use: idType, - Short: "deletes an identity's authenticator managed by the Ziti Edge Controller", - Long: "deletes a identity's authenticator managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(0), - SuggestFor: []string{}, - } - - cmd.AddCommand(newDeleteAuthenticatorUpdb("updb", options)) - - return cmd -} diff --git a/ziti/cmd/ziti/cmd/edge/delete_authenticator_updb.go b/ziti/cmd/ziti/cmd/edge/delete_authenticator_updb.go deleted file mode 100644 index 50f37bb98..000000000 --- a/ziti/cmd/ziti/cmd/edge/delete_authenticator_updb.go +++ /dev/null @@ -1,102 +0,0 @@ -/* - 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. -*/ - -package edge - -import ( - "context" - "fmt" - "github.com/openziti/edge/rest_management_api_client/authenticator" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/util" - "github.com/spf13/cobra" -) -import cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - -type deleteUpdbOptions struct { - api.Options -} - -func newDeleteAuthenticatorUpdb(idType string, options *api.Options) *cobra.Command { - updbOptions := deleteUpdbOptions{ - Options: *options, - } - - cmd := &cobra.Command{ - Use: idType + " ", - Short: "deletes an identity's " + idType + " authenticator managed by the Ziti Edge Controller", - Long: "deletes a identity's " + idType + " authenticator managed by the Ziti Edge Controller", - Args: cobra.ExactArgs(1), - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := runDeleteUpdb(args[0], &updbOptions) - cmdhelper.CheckErr(err) - }, - SuggestFor: []string{}, - } - - // allow interspersing positional args and flags - cmd.Flags().SetInterspersed(true) - - return cmd -} - -func runDeleteUpdb(idOrName string, options *deleteUpdbOptions) error { - identityId, err := mapIdentityNameToID(idOrName, options.Options) - - if err != nil { - return err - } - - client, err := util.NewEdgeManagementClient(options) - - if err != nil { - return err - } - filter := fmt.Sprintf(`identity="%s" and method="updb"`, identityId) - - result, err := client.Authenticator.ListAuthenticators(&authenticator.ListAuthenticatorsParams{ - Filter: &filter, - Context: context.Background(), - }, nil) - - if err != nil { - return util.WrapIfApiError(err) - } - - if len(result.Payload.Data) != 1 { - return fmt.Errorf("incorrect number of results, expected 1, got %d", len(result.Payload.Data)) - } - - if result.Payload.Data[0].ID == nil { - return fmt.Errorf("authenticator contained a nil id") - } - - if *result.Payload.Data[0].ID == "" { - return fmt.Errorf("authenticator contained an empty id") - } - - authenticatorId := *result.Payload.Data[0].ID - - err = deleteEntityOfType(fmt.Sprintf("authenticators/%s", authenticatorId), "", &options.Options) - - if err != nil { - return err - } - - return nil -} diff --git a/ziti/cmd/ziti/cmd/edge/list.go b/ziti/cmd/ziti/cmd/edge/list.go index e09845cb5..67d43895b 100644 --- a/ziti/cmd/ziti/cmd/edge/list.go +++ b/ziti/cmd/ziti/cmd/edge/list.go @@ -57,11 +57,13 @@ func newListCmd(out io.Writer, errOut io.Writer) *cobra.Command { } cmd.AddCommand(newListCmdForEntityType("api-sessions", runListApiSessions, newOptions())) + cmd.AddCommand(newListCmdForEntityType("authenticators", runListAuthenticators, newOptions())) cmd.AddCommand(newListCmdForEntityType("cas", runListCAs, newOptions())) 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(), "erps")) + cmd.AddCommand(newListCmdForEntityType("enrollments", runListEnrollments, newOptions())) cmd.AddCommand(newListCmdForEntityType("terminators", runListTerminators, newOptions())) cmd.AddCommand(newListIdentitiesCmd(newOptions())) cmd.AddCommand(newListServicesCmd(newOptions())) @@ -446,6 +448,79 @@ func outputEdgeRouterPolicies(o *api.Options, children []*gabs.Container, paging return nil } +func runListAuthenticators(o *api.Options) error { + children, pagingInfo, err := listEntitiesWithOptions("authenticators", o) + if err != nil { + return err + } + return outputAuthenticators(o, children, pagingInfo) +} + +func outputAuthenticators(o *api.Options, children []*gabs.Container, pagingInfo *api.Paging) error { + if o.OutputJSONResponse { + return nil + } + + t := table.NewWriter() + t.SetStyle(table.StyleRounded) + t.AppendHeader(table.Row{"ID", "Method", "Identity Id", "Identity Name", "Username/Fingerprint", "Ca Id"}) + + for _, entity := range children { + id, _ := entity.Path("id").Data().(string) + method := entity.Path("method").Data().(string) + identityId := entity.Path("identityId").Data().(string) + identityName := entity.Path("identity.name").Data().(string) + + caId := "" + if entity.Exists("caId") { + caId = entity.Path("caId").Data().(string) + } + + printOrName := "" + if entity.Exists("username") { + printOrName = entity.Path("username").Data().(string) + } else if entity.Exists("fingerprint") { + printOrName = entity.Path("fingerprint").Data().(string) + } + + t.AppendRow(table.Row{id, method, identityId, identityName, printOrName, caId}) + } + api.RenderTable(o, t, pagingInfo) + return nil +} + +func runListEnrollments(o *api.Options) error { + children, pagingInfo, err := listEntitiesWithOptions("enrollments", o) + if err != nil { + return err + } + return outputEnrollments(o, children, pagingInfo) +} + +func outputEnrollments(o *api.Options, children []*gabs.Container, pagingInfo *api.Paging) error { + if o.OutputJSONResponse { + return nil + } + + t := table.NewWriter() + t.SetStyle(table.StyleRounded) + t.AppendHeader(table.Row{"ID", "Method", "Identity Id", "Identity Name", "Expires At", "Token", "JWT"}) + + for _, entity := range children { + id, _ := entity.Path("id").Data().(string) + method := entity.Path("method").Data().(string) + identityId := entity.Path("identityId").Data().(string) + identityName := entity.Path("identity.name").Data().(string) + expiresAt := entity.Path("expiresAt").Data().(string) + token := entity.Path("token").Data().(string) + jwt := "See json" + + t.AppendRow(table.Row{id, method, identityId, identityName, expiresAt, token, jwt}) + } + api.RenderTable(o, t, pagingInfo) + return nil +} + func runListTerminators(o *api.Options) error { children, pagingInfo, err := listEntitiesWithOptions("terminators", o) if err != nil { From da6e714db8c536e95910557edd5e39a8521222df Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Tue, 24 May 2022 09:52:53 -0400 Subject: [PATCH 2/6] updates edge - include 409 enrollment fix --- go.mod | 13 +++++++------ go.sum | 25 ++++++++++++++----------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index b4126f66d..330b93011 100644 --- a/go.mod +++ b/go.mod @@ -21,13 +21,13 @@ require ( github.com/jedib0t/go-pretty/v6 v6.2.4 github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.6.9 - github.com/openziti/channel v0.18.36 - github.com/openziti/edge v0.21.217 - github.com/openziti/fabric v0.17.136 + github.com/openziti/channel v0.18.37 + github.com/openziti/edge v0.21.222 + github.com/openziti/fabric v0.17.137 github.com/openziti/foundation v0.17.25 - github.com/openziti/sdk-golang v0.16.69 + github.com/openziti/sdk-golang v0.16.70 github.com/openziti/storage v0.1.5 - github.com/openziti/transport/v2 v2.0.1 + github.com/openziti/transport/v2 v2.0.2 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 @@ -41,7 +41,7 @@ require ( github.com/stretchr/testify v1.7.1 github.com/valyala/fasttemplate v1.2.1 go.etcd.io/bbolt v1.3.6 - golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 google.golang.org/grpc v1.42.0 google.golang.org/protobuf v1.28.0 gopkg.in/AlecAivazis/survey.v1 v1.8.7 @@ -120,6 +120,7 @@ require ( github.com/oklog/ulid v1.3.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect + github.com/openziti/x509-claims v1.0.2 // indirect github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20220111122524-cb78842db373 // indirect github.com/pelletier/go-toml v1.9.4 // indirect diff --git a/go.sum b/go.sum index 4548bbdde..d098414b1 100644 --- a/go.sum +++ b/go.sum @@ -633,22 +633,24 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ 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/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openziti/channel v0.18.36 h1:x7TgEpw3ecIpginDsqAMGBTdhtCdMx2BR9m9wzXmZhY= -github.com/openziti/channel v0.18.36/go.mod h1:97VgqsQ8BV9KZ9zKiaeCM9rTOn2Kft6yaS1c+fdec9A= +github.com/openziti/channel v0.18.37 h1:a6PKCcKUZCidAlAehxpVRDrFrKOS2JVnuDqDhbZUTw4= +github.com/openziti/channel v0.18.37/go.mod h1:6ZwVC+xSY83eETr8lR/8Ic1yuaPkKYQqj6TsVwkbm/0= 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.21.217 h1:ifbZlfGAt032yyBXorxAuYWq+zZQge3HLh/haPT6JQ0= -github.com/openziti/edge v0.21.217/go.mod h1:3k4j2+jd5e8F681xleiW5rc0oTAvSMzJuI1hnAc8mYw= -github.com/openziti/fabric v0.17.136 h1:JcK+oTDv2Bg7vgJwAAYCqd5G1lxzwZMzlTqsk9UHfnY= -github.com/openziti/fabric v0.17.136/go.mod h1:6Yy/kSr3zl//g2RBAlXn/hrlMdG1IhzPlPf3SsCK1pA= +github.com/openziti/edge v0.21.222 h1:PG/sYcWoX4hjn8aUZoHGJ7TTuJNqJEqfGVL9N+Os66M= +github.com/openziti/edge v0.21.222/go.mod h1:hp48iOCDm2snkeXgDZPGcpvM5o63Cn4yW1ZApHsq190= +github.com/openziti/fabric v0.17.137 h1:3GPavC0qrGOQ70B+fEt3VHaFEBSd9FZG8fbglLhysq4= +github.com/openziti/fabric v0.17.137/go.mod h1:91EbauR7VOgADLzDOSuWxfhgzAJSqvRQdZ7XwPixhuc= github.com/openziti/foundation v0.17.25 h1:s7E7LIYHGeJQQqmQI1uLA2Ml3L2dgGbeTN+rD6Woo78= github.com/openziti/foundation v0.17.25/go.mod h1:YMalQrbDP3S5ptEcob4v3F+pyCngabaG/hQVoT9Pcxo= -github.com/openziti/sdk-golang v0.16.69 h1:EnlDeNAK0nFcM8MKU5lcDJZ/p/xGT2oDtzJ6kmn6RrA= -github.com/openziti/sdk-golang v0.16.69/go.mod h1:z83nTE+webbbRrgtvvEdr1sQWxaoC+jbeVmKW1c4JJI= +github.com/openziti/sdk-golang v0.16.70 h1:hF7Bk+48zkg4ZwWb9Xrky0eE8d6HwJ092a5XclXISMc= +github.com/openziti/sdk-golang v0.16.70/go.mod h1:QTR5a37mtyKRsl0r7NodmrmdYCrdqJv7zqShFwccoJs= github.com/openziti/storage v0.1.5 h1:Q13TaO7El1v9CJoGZjhLPdS/T/s897TGKegiWov3J4M= github.com/openziti/storage v0.1.5/go.mod h1:VvubFzlkqzxFJnQV+QawR++OhDQ1l283S7b2J8BPKmk= -github.com/openziti/transport/v2 v2.0.1 h1:zLE5o1nUJrz+dVHz+smdswtLQlwyJa0OzZ15+2sPwAk= -github.com/openziti/transport/v2 v2.0.1/go.mod h1:GeXnw3NDybPLKd8g3IMpXkYo8G8VXu+5+MT5g4BpmQY= +github.com/openziti/transport/v2 v2.0.2 h1:w01etEkf5V0tkgtd9Z0MOTGz+oH8yeEbXWMn38y/uP8= +github.com/openziti/transport/v2 v2.0.2/go.mod h1:DLW9bvW/QL7uCaGmy5s5rdQoKgFKfu/JJWPcc/syqSE= +github.com/openziti/x509-claims v1.0.2 h1:PSv/xRfejIAcPc16A902k08rSBs3R8bjtL4qq6WEwCI= +github.com/openziti/x509-claims v1.0.2/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw= github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= @@ -1003,8 +1005,9 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= From f3dfc0c4369254f149a8878e12ad3cf4c09e56eb Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Tue, 24 May 2022 09:56:08 -0400 Subject: [PATCH 3/6] updates change log --- CHANGELOG.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8546cbdd2..9e6e6125b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,9 @@ - Edge - N/A - Fabric - - Bug fixes -- Ziti CLI - N/A +- Ziti CLI + - CLI support for enrollments/authenticators/re-enrollment - SDK Golang - N/A @@ -24,8 +24,7 @@ The CLI has been augmented to support the following commands: - `ziti edge create enrollment ottca ...` - to create a new one-time-token enrollment for an existing identity for a 3rd party CA issued certificate - `ziti edge create enrollment updb ...` - to create a new updb (username/password) enrollment for an existing identity -These commands, specifically the enrollment related ones, can be used to re-enroll existing identities. See the 0.25.9 -changelog for details. For all arguments and options, please see their CLI related `-h`. +These commands, specifically the enrollment related ones, can be used to re-enroll existing identities. See the 0.25.9 changeFor all arguments and options, please see their CLI related `-h`. # Release 0.25.9 From 399907cdff610ac5f8d3bcd22ff037a88253c9df Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Tue, 24 May 2022 09:58:26 -0400 Subject: [PATCH 4/6] add ziti edge delete authenticator updb note --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6e6125b..f2bbbf024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ The CLI has been augmented to support the following commands: These commands, specifically the enrollment related ones, can be used to re-enroll existing identities. See the 0.25.9 changeFor all arguments and options, please see their CLI related `-h`. +Also note that the `ziti edge delete authenticator updb` command has been supplanted by `ziti edge edge authenticator ` + # Release 0.25.9 ## What's New From cd2b9729884988872635a7670b50ca0f2b31dec3 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 23 May 2022 14:15:44 -0400 Subject: [PATCH 5/6] Remove ziti-fabric install, fix ziti-prox-c install --- CHANGELOG.md | 12 +++ ziti/cmd/ziti/cmd/common_init.go | 1 - ziti/cmd/ziti/cmd/common_install.go | 2 - ziti/cmd/ziti/cmd/init.go | 2 - ziti/cmd/ziti/cmd/install.go | 1 - ziti/cmd/ziti/cmd/install_ziti_ALL.go | 5 -- ziti/cmd/ziti/cmd/install_ziti_fabric.go | 92 ---------------------- ziti/cmd/ziti/cmd/uninstall.go | 1 - ziti/cmd/ziti/cmd/uninstall_ziti_fabric.go | 77 ------------------ ziti/cmd/ziti/cmd/upgrade.go | 1 - ziti/cmd/ziti/cmd/upgrade_ziti_fabric.go | 90 --------------------- ziti/cmd/ziti/cmd/use.go | 4 - ziti/cmd/ziti/cmd/version.go | 13 --- ziti/cmd/ziti/constants/constants.go | 1 - ziti/cmd/ziti/util/rest.go | 14 +++- 15 files changed, 24 insertions(+), 292 deletions(-) delete mode 100644 ziti/cmd/ziti/cmd/install_ziti_fabric.go delete mode 100644 ziti/cmd/ziti/cmd/uninstall_ziti_fabric.go delete mode 100644 ziti/cmd/ziti/cmd/upgrade_ziti_fabric.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f2bbbf024..4002cd692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - N/A - Ziti CLI - CLI support for enrollments/authenticators/re-enrollment + - Fix prox-c download + - ziti-fabric cleanup - SDK Golang - N/A @@ -28,6 +30,16 @@ These commands, specifically the enrollment related ones, can be used to re-enro Also note that the `ziti edge delete authenticator updb` command has been supplanted by `ziti edge edge authenticator ` +### Fix prox-c download + +The prox-c releases on GitHub now include the architecture in the download URL. +`ziti install ziti-prox-c` has been updated to take this into account. + +### ziti-fabric cleanup + +Ziti CLI install/upgrade/remove commands related to `ziti-fabric` have been +removed since `ziti-fabric` was deprecated and is not being published anymore. + # Release 0.25.9 ## What's New diff --git a/ziti/cmd/ziti/cmd/common_init.go b/ziti/cmd/ziti/cmd/common_init.go index a7665ce07..865404edc 100644 --- a/ziti/cmd/ziti/cmd/common_init.go +++ b/ziti/cmd/ziti/cmd/common_init.go @@ -29,7 +29,6 @@ import ( var ZITI_COMPONENTS = []string{ c.ZITI, c.ZITI_CONTROLLER, - c.ZITI_FABRIC, c.ZITI_PROX_C, c.ZITI_ROUTER, c.ZITI_TUNNEL, diff --git a/ziti/cmd/ziti/cmd/common_install.go b/ziti/cmd/ziti/cmd/common_install.go index 7e95d3f72..0e21c1255 100644 --- a/ziti/cmd/ziti/cmd/common_install.go +++ b/ziti/cmd/ziti/cmd/common_install.go @@ -346,7 +346,6 @@ func (o *CommonOptions) installGitHubRelease(branch string, zitiApp string, ziti var latestVersion semver.Version if version != "" { - if strings.Contains(version, "*") { latestVersion, err = util.GetLatestGitHubReleaseVersion(o.Verbose, zitiAppGitHub) if err != nil { @@ -364,7 +363,6 @@ func (o *CommonOptions) installGitHubRelease(branch string, zitiApp string, ziti fullPath := filepath.Join(binDir, fileName) ext := ".zip" zipFile := fullPath + ext - releaseUrl, err := util.GetLatestGitHubReleaseAsset(o.Staging, zitiAppGitHub) if err != nil { return err diff --git a/ziti/cmd/ziti/cmd/init.go b/ziti/cmd/ziti/cmd/init.go index bb17f1fe4..e94383c7f 100644 --- a/ziti/cmd/ziti/cmd/init.go +++ b/ziti/cmd/ziti/cmd/init.go @@ -96,8 +96,6 @@ func (o *InitOptions) Run() error { err = o.createInitialControllerConfig() case c.ZITI_ROUTER: return nil - case c.ZITI_FABRIC: - return nil case c.ZITI: err = o.createInitialZitiConfig() default: diff --git a/ziti/cmd/ziti/cmd/install.go b/ziti/cmd/ziti/cmd/install.go index 39c0b810c..1174951c4 100644 --- a/ziti/cmd/ziti/cmd/install.go +++ b/ziti/cmd/ziti/cmd/install.go @@ -67,7 +67,6 @@ func NewCmdInstall(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(NewCmdInstallZitiALL(out, errOut)) cmd.AddCommand(NewCmdInstallZitiController(out, errOut)) - cmd.AddCommand(NewCmdInstallZitiFabric(out, errOut)) cmd.AddCommand(NewCmdInstallZitiRouter(out, errOut)) cmd.AddCommand(NewCmdInstallZitiTunnel(out, errOut)) cmd.AddCommand(NewCmdInstallZitiEdgeTunnel(out, errOut)) diff --git a/ziti/cmd/ziti/cmd/install_ziti_ALL.go b/ziti/cmd/ziti/cmd/install_ziti_ALL.go index c5bf2ac34..380065201 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_ALL.go +++ b/ziti/cmd/ziti/cmd/install_ziti_ALL.go @@ -98,11 +98,6 @@ func (o *InstallZitiALLOptions) Run() error { log.Errorf("Error: install failed %s \n", err.Error()) } - err = o.install(c.ZITI_FABRIC) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - err = o.install(c.ZITI_PROX_C) if err != nil { log.Errorf("Error: install failed %s \n", err.Error()) diff --git a/ziti/cmd/ziti/cmd/install_ziti_fabric.go b/ziti/cmd/ziti/cmd/install_ziti_fabric.go deleted file mode 100644 index 9831fb01c..000000000 --- a/ziti/cmd/ziti/cmd/install_ziti_fabric.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - 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. -*/ - -package cmd - -import ( - "io" - - "github.com/blang/semver" - "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/spf13/cobra" -) - -var ( - installZitiFabricLong = templates.LongDesc(` - Installs the Ziti Fabric app if it has not been installed already -`) - - installZitiFabricExample = templates.Examples(` - # Install the Ziti Fabric app - ziti install ziti-fabric - `) -) - -// InstallZitiFabricOptions the options for the upgrade ziti-fabric command -type InstallZitiFabricOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiFabric defines the command -func NewCmdInstallZitiFabric(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiFabricOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-fabric", - Short: "Installs the Ziti Fabric app - if it has not been installed already", - Aliases: []string{"fabric"}, - Long: installZitiFabricLong, - Example: installZitiFabricExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *InstallZitiFabricOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_FABRIC) - if err != nil { - return err - } - - if o.Version != "" { - newVersion, err = semver.Make(o.Version) - } - - log.Infoln("Attempting to install '" + c.ZITI_FABRIC + "' version: " + newVersion.String()) - - return o.installZitiApp(version.GetBranch(), c.ZITI_FABRIC, false, newVersion.String()) -} diff --git a/ziti/cmd/ziti/cmd/uninstall.go b/ziti/cmd/ziti/cmd/uninstall.go index 7aa4913df..ed3d1a201 100644 --- a/ziti/cmd/ziti/cmd/uninstall.go +++ b/ziti/cmd/ziti/cmd/uninstall.go @@ -65,7 +65,6 @@ func NewCmdUnInstall(out io.Writer, errOut io.Writer) *cobra.Command { } cmd.AddCommand(NewCmdUnInstallZitiController(out, errOut)) - cmd.AddCommand(NewCmdUnInstallZitiFabric(out, errOut)) cmd.AddCommand(NewCmdUnInstallZitiRouter(out, errOut)) cmd.AddCommand(NewCmdUnInstallZitiTunnel(out, errOut)) cmd.AddCommand(NewCmdUnInstallZitiEdgeTunnel(out, errOut)) diff --git a/ziti/cmd/ziti/cmd/uninstall_ziti_fabric.go b/ziti/cmd/ziti/cmd/uninstall_ziti_fabric.go deleted file mode 100644 index 1d9edc7cb..000000000 --- a/ziti/cmd/ziti/cmd/uninstall_ziti_fabric.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - 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. -*/ - -package cmd - -import ( - "io" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/spf13/cobra" -) - -var ( - uninstallZitiFabricLong = templates.LongDesc(` - UnInstalls the Ziti Fabric app if it has previously been installed -`) - - uninstallZitiFabricExample = templates.Examples(` - # UnInstall the Ziti Fabric app - ziti uninstall ziti-fabric - `) -) - -// UnInstallZitiFabricOptions the options for the upgrade ziti-fabric command -type UnInstallZitiFabricOptions struct { - UnInstallOptions - - Version string -} - -// NewCmdUnInstallZitiFabric defines the command -func NewCmdUnInstallZitiFabric(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallZitiFabricOptions{ - UnInstallOptions: UnInstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-fabric", - Short: "UnInstalls the Ziti Fabric app - if it has previously been installed", - Aliases: []string{"fabric"}, - Long: uninstallZitiFabricLong, - Example: uninstallZitiFabricExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - return cmd -} - -// Run implements the command -func (o *UnInstallZitiFabricOptions) Run() error { - o.deleteInstalledBinary(c.ZITI_FABRIC) - return nil -} diff --git a/ziti/cmd/ziti/cmd/upgrade.go b/ziti/cmd/ziti/cmd/upgrade.go index 437b7b33b..214e3f277 100644 --- a/ziti/cmd/ziti/cmd/upgrade.go +++ b/ziti/cmd/ziti/cmd/upgrade.go @@ -66,7 +66,6 @@ func NewCmdUpgrade(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(NewCmdUpgradeZiti(out, errOut)) cmd.AddCommand(NewCmdUpgradeZitiController(out, errOut)) - cmd.AddCommand(NewCmdUpgradeZitiFabric(out, errOut)) cmd.AddCommand(NewCmdUpgradeZitiRouter(out, errOut)) cmd.AddCommand(NewCmdUpgradeZitiTunnel(out, errOut)) cmd.AddCommand(NewCmdUpgradeZitiProxC(out, errOut)) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti_fabric.go b/ziti/cmd/ziti/cmd/upgrade_ziti_fabric.go deleted file mode 100644 index ad542c769..000000000 --- a/ziti/cmd/ziti/cmd/upgrade_ziti_fabric.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - 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. -*/ - -package cmd - -import ( - "io" - - "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/spf13/cobra" -) - -var ( - upgradeZitiFabricLong = templates.LongDesc(` - Upgrades the Ziti Fabric app if there is a newer release -`) - - upgradeZitiFabricExample = templates.Examples(` - # Upgrades the ziti-fabric app - ziti upgrade ziti-fabric - `) -) - -// UpgradeZitiFabricOptions the options for the upgrade ziti-fabric command -type UpgradeZitiFabricOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZitiFabric defines the command -func NewCmdUpgradeZitiFabric(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiFabricOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-fabric", - Short: "Upgrades the Ziti Fabric app - if there is a new version available", - Aliases: []string{"fabric", "fab"}, - Long: upgradeZitiFabricLong, - Example: upgradeZitiFabricExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiFabricOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_FABRIC) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI_FABRIC) - - return o.installZitiApp(version.GetBranch(), c.ZITI_FABRIC, true, newVersionStr) -} diff --git a/ziti/cmd/ziti/cmd/use.go b/ziti/cmd/ziti/cmd/use.go index 578b2d6e5..05f8adaac 100644 --- a/ziti/cmd/ziti/cmd/use.go +++ b/ziti/cmd/ziti/cmd/use.go @@ -130,10 +130,6 @@ func (o *UseOptions) Run() error { if err != nil { log.Errorf("Error: install failed %s \n", err.Error()) } - err = o.install(branch, c.ZITI_FABRIC) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } err = o.install(branch, c.ZITI_ROUTER) if err != nil { log.Errorf("Error: install failed %s \n", err.Error()) diff --git a/ziti/cmd/ziti/cmd/version.go b/ziti/cmd/ziti/cmd/version.go index 19f5a1946..3fc07d4ed 100644 --- a/ziti/cmd/ziti/cmd/version.go +++ b/ziti/cmd/ziti/cmd/version.go @@ -83,7 +83,6 @@ func (o *VersionOptions) Run() error { t.AddRow(c.ZITI, info(version.GetBuildMetadata(o.Verbose))) o.versionPrintZitiApp(c.ZITI_CONTROLLER, &t) - o.versionPrintZitiApp(c.ZITI_FABRIC, &t) o.versionPrintZitiApp(c.ZITI_PROX_C, &t) o.versionPrintZitiApp(c.ZITI_ROUTER, &t) o.versionPrintZitiApp(c.ZITI_TUNNEL, &t) @@ -129,7 +128,6 @@ func (o *VersionOptions) versionPrintZitiApp(zitiApp string, table *table.Table) func (o *VersionOptions) versionCheck() error { o.versionCheckZitiApp(c.ZITI) o.versionCheckZitiApp(c.ZITI_CONTROLLER) - o.versionCheckZitiApp(c.ZITI_FABRIC) o.versionCheckZitiApp(c.ZITI_PROX_C) o.versionCheckZitiApp(c.ZITI_ROUTER) o.versionCheckZitiApp(c.ZITI_TUNNEL) @@ -151,8 +149,6 @@ func (o *VersionOptions) versionCheckZitiApp(zitiApp string) error { newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI) case c.ZITI_CONTROLLER: newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) - case c.ZITI_FABRIC: - newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_FABRIC) case c.ZITI_PROX_C: newVersion, err = o.getLatestGitHubReleaseVersion(version.GetBranch(), c.ZITI_SDK_C_GITHUB) case c.ZITI_ROUTER: @@ -191,8 +187,6 @@ func (o *VersionOptions) versionCheckZitiApp(zitiApp string) error { err = o.upgradeZiti() case c.ZITI_CONTROLLER: err = o.upgradeZitiController() - case c.ZITI_FABRIC: - err = o.upgradeZitiFabric() case c.ZITI_PROX_C: err = o.upgradeZitiProxC() case c.ZITI_ROUTER: @@ -228,13 +222,6 @@ func (o *VersionOptions) upgradeZitiController() error { return options.Run() } -func (o *VersionOptions) upgradeZitiFabric() error { - options := &UpgradeZitiFabricOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} - func (o *VersionOptions) upgradeZitiProxC() error { options := &UpgradeZitiProxCOptions{ CommonOptions: o.CommonOptions, diff --git a/ziti/cmd/ziti/constants/constants.go b/ziti/cmd/ziti/constants/constants.go index b3111008d..8700168e5 100644 --- a/ziti/cmd/ziti/constants/constants.go +++ b/ziti/cmd/ziti/constants/constants.go @@ -21,7 +21,6 @@ import "time" const ( ZITI = "ziti" ZITI_CONTROLLER = "ziti-controller" - ZITI_FABRIC = "ziti-fabric" ZITI_ROUTER = "ziti-router" ZITI_TUNNEL = "ziti-tunnel" ZITI_EDGE_TUNNEL = "ziti-edge-tunnel" diff --git a/ziti/cmd/ziti/util/rest.go b/ziti/cmd/ziti/util/rest.go index 1c4baaeea..b0da8c00b 100644 --- a/ziti/cmd/ziti/util/rest.go +++ b/ziti/cmd/ziti/util/rest.go @@ -203,10 +203,20 @@ func GetLatestGitHubReleaseAsset(verbose bool, appName string) (string, error) { result := (*resp.Result().(*GitHubReleasesData)) - os := runtime.GOOS + arches := []string{runtime.GOARCH} + if strings.ToLower(runtime.GOARCH) == "amd64" { + arches = append(arches, "x86_64") + } for _, asset := range result.Assets { - ok := strings.Contains(strings.ToLower(asset.BrowserDownloadURL), os) + ok := false + for _, arch := range arches { + if strings.Contains(strings.ToLower(asset.BrowserDownloadURL), arch) { + ok = true + } + } + + ok = ok && strings.Contains(strings.ToLower(asset.BrowserDownloadURL), runtime.GOOS) if ok { return asset.BrowserDownloadURL, nil } From fe23443d52cffd6408f8a6f374faf2ef0baca3b3 Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Tue, 24 May 2022 14:53:54 -0400 Subject: [PATCH 6/6] edge > delete typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2bbbf024..c859f88e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ The CLI has been augmented to support the following commands: These commands, specifically the enrollment related ones, can be used to re-enroll existing identities. See the 0.25.9 changeFor all arguments and options, please see their CLI related `-h`. -Also note that the `ziti edge delete authenticator updb` command has been supplanted by `ziti edge edge authenticator ` +Also note that the `ziti edge delete authenticator updb` command has been supplanted by `ziti edge delete authenticator ` # Release 0.25.9