Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.15.1 #137

Merged
merged 21 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5a23eb2
fix error that should be info
dovholuknf Jun 26, 2020
7ac42ff
start the 0.15.1 release notes
dovholuknf Jun 27, 2020
90a76cf
closes #128 - add link
dovholuknf Jun 27, 2020
b3d6d7b
Merge pull request #128 from openziti/update-enroller-output
dovholuknf Jun 27, 2020
88ff3cb
fix for openziti/edge#191
andrewpmartinez Jun 29, 2020
684f175
deps and release notes
andrewpmartinez Jun 29, 2020
3600328
fixes #131 cli create identity issues
andrewpmartinez Jun 29, 2020
99b79e7
updates doc, adds ca identity role arg
andrewpmartinez Jun 29, 2020
bb565b2
Merge pull request #130 from openziti/fix.change.password
andrewpmartinez Jun 30, 2020
145f705
Merge branch 'release-0.15.1' into fix.cli.create.identity.pagniation…
andrewpmartinez Jun 30, 2020
caffc40
Merge pull request #132 from openziti/fix.cli.create.identity.pagniat…
andrewpmartinez Jun 30, 2020
2ee332b
fixes openziti/edge#231
andrewpmartinez Jul 7, 2020
9723e4a
go mod tidy
andrewpmartinez Jul 7, 2020
c2577f3
add fixes from other merges
andrewpmartinez Jul 7, 2020
fe4f4a2
Merge pull request #135 from openziti/update.deps.edge.231
andrewpmartinez Jul 8, 2020
ef9dcb0
Fix service lookup (#134)
plorenz Jul 9, 2020
4e7c670
update edge dep for openziti/edge#240
andrewpmartinez Jul 9, 2020
c4cb8da
update release notes
andrewpmartinez Jul 9, 2020
e47b9a9
Merge pull request #136 from openziti/update.deps.fix.edge.240.specs
andrewpmartinez Jul 9, 2020
be69424
random release note change to see if Travis CI will unbreak
andrewpmartinez Jul 9, 2020
7df55aa
Tweak release notes
andrewpmartinez Jul 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Bug fixes
* [#129](https://github.com/openziti/ziti/issues/129) - minor issue with `ziti-tunnel enroll` outputting the success message at ERROR level
* [#131](https://github.com/openziti/ziti/issues/131) - issues w/ creating identities, CAs and validating CAs
* [edge#191](https://github.com/openziti/edge/issues/191) - updating self password via CLI would error with 404 not found

# Release 0.15.0
Expand Down
3 changes: 3 additions & 0 deletions ziti/cmd/ziti/cmd/edge_controller/create_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type createCaOptions struct {
autoCaEnrollment bool
ottCaEnrollment bool
authEnabled bool
identityRoles []string
}

// newCreateCaCmd creates the 'edge controller create ca local' command for the given entity type
Expand Down Expand Up @@ -89,6 +90,7 @@ func newCreateCaCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.C
cmd.Flags().BoolVarP(&options.authEnabled, "auth", "e", false, "Whether the CA can be used for authentication or not")
cmd.Flags().BoolVarP(&options.ottCaEnrollment, "ottca", "o", false, "Whether the CA can be used for one-time-token CA enrollment")
cmd.Flags().BoolVarP(&options.autoCaEnrollment, "autoca", "u", false, "Whether the CA can be used for auto CA enrollment")
cmd.Flags().StringSliceVarP(&options.identityRoles, "role-attributes", "a", nil, "A csv string of role attributes enrolling identities receive")

return cmd
}
Expand All @@ -100,6 +102,7 @@ func runCreateCa(options *createCaOptions) (err error) {
setJSONValue(data, options.ottCaEnrollment, "isOttCaEnrollmentEnabled")
setJSONValue(data, options.authEnabled, "isAuthEnabled")
setJSONValue(data, string(options.caPemBytes), "certPem")
setJSONValue(data, options.identityRoles, "identityRoles")

result, err := createEntityOfType("cas", data.String(), &options.commonOptions)

Expand Down
12 changes: 2 additions & 10 deletions ziti/cmd/ziti/cmd/edge_controller/create_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,12 @@ func runCreateIdentity(idType string, o *createIdentityOptions) error {
}

func getIdentityJwt(o *createIdentityOptions, id string) error {
list, _, err := listEntitiesOfType("identities", nil, o.OutputJSONResponse, o.Out)

newIdentity, err := DetailEntityOfType("identities", id, o.OutputJSONResponse, o.Out)
if err != nil {
return err
}

var newIdentity *gabs.Container
for _, gw := range list {
gwId := gw.Path("id").Data().(string)
if gwId == id {
newIdentity = gw
break
}
}

if newIdentity == nil {
return fmt.Errorf("no error during identity creation, but identity with id %v not found... unable to extract JWT", id)
}
Expand Down
34 changes: 34 additions & 0 deletions ziti/cmd/ziti/cmd/edge_controller/detail.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
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_controller

import (
"github.com/Jeffail/gabs"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"io"
)

func DetailEntityOfType(entityType, entityId string, logJSON bool, out io.Writer) (*gabs.Container, error) {
jsonParsed, err := util.EdgeControllerDetailEntity(entityType, entityId, logJSON, out)

if err != nil {
return nil, err
}

entity := jsonParsed.S("data")
return entity, nil
}
43 changes: 42 additions & 1 deletion ziti/cmd/ziti/util/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,47 @@ func outputJson(out io.Writer, data []byte) {
}
}

func EdgeControllerDetailEntity(entityType, entityId string, logJSON bool, out io.Writer) (*gabs.Container, error) {
session := &Session{}
if err := session.Load(); err != nil {
return nil, err
}

client := newClient()

if session.GetCert() != "" {
client.SetRootCertificate(session.GetCert())
}

queryUrl := session.GetBaseUrl() + "/" + path.Join(entityType, entityId)

resp, err := client.R().
SetHeader("Content-Type", "application/json").
SetHeader(constants.ZitiSession, session.GetToken()).
Get(queryUrl)

if err != nil {
return nil, fmt.Errorf("unable to list entities at %v in Ziti Edge Controller at %v. Error: %v", queryUrl, session.GetBaseUrl(), err)
}

if resp.StatusCode() != http.StatusOK {
return nil, fmt.Errorf("error listing %v in Ziti Edge Controller. Status code: %v, Server returned: %v",
queryUrl, resp.Status(), resp.String())
}

if logJSON {
outputJson(out, resp.Body())
}

jsonParsed, err := gabs.ParseJSON(resp.Body())

if err != nil {
return nil, fmt.Errorf("unable to parse response from %v. Server returned: %v", queryUrl, resp.String())
}

return jsonParsed, nil
}

// EdgeControllerListSubEntities will list entities of the given type in the given Edge Controller
func EdgeControllerListSubEntities(entityType, subType, entityId string, filter string, logJSON bool, out io.Writer) (*gabs.Container, error) {
params := url.Values{}
Expand Down Expand Up @@ -636,7 +677,7 @@ func EdgeControllerVerify(entityType, id, body string, out io.Writer, logJSON bo
}
resp, err := client.
R().
SetHeader("Content-Type", "application/json").
SetHeader("Content-Type", "text/plain").
SetHeader(constants.ZitiSession, session.Token).
SetBody(body).
Post(session.Host + "/" + entityType + "/" + id + "/verify")
Expand Down