From 9e0bae07ee8cc9f2a993ac99f19626caeb8aa7c4 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 15 Nov 2022 16:16:12 -0500 Subject: [PATCH 1/6] Added port check to quickstart Added ability to set listener bind port Added tests for new port variable Fixed bug in quickstart test Fixed typo in quickstart test fixed bug in quickstart env file test closes #706 Signed-off-by: gberl002 --- CHANGELOG.md | 8 +++ go.mod | 11 ++++ go.sum | 24 ++++++++- quickstart/docker/image/Dockerfile | 2 +- quickstart/docker/image/run-with-ziti-cli.sh | 2 +- quickstart/docker/image/ziti-cli-functions.sh | 49 ++++++++++++++++- quickstart/test/quickstart_test.go | 22 ++++++-- ziti/cmd/ziti/cmd/config_templates/router.yml | 4 +- ziti/cmd/ziti/cmd/create_config.go | 17 +++--- .../cmd/ziti/cmd/create_config_environment.go | 3 ++ .../cmd/create_config_router_edge_test.go | 54 +++++++++++++++++-- .../cmd/create_config_router_fabric_test.go | 54 +++++++++++++++++-- ziti/cmd/ziti/cmd/create_config_test.go | 1 + ziti/cmd/ziti/cmd/helpers/env_helpers.go | 4 ++ ziti/cmd/ziti/constants/constants.go | 6 ++- 15 files changed, 235 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0562deef..3df694d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# Release 0.26.12 + +## What's New + +- Ziti CLI + - Enhancements: + - [Issue-706](https://github.com/openziti/ziti/issues/706) - Add port check to quickstart + # Release 0.26.11 ## What's New diff --git a/go.mod b/go.mod index 8a898bcc8..dfda598bc 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Jeffail/gabs/v2 v2.6.1 github.com/MakeNowJust/heredoc v1.0.0 github.com/blang/semver v3.5.1+incompatible + github.com/docker/docker v20.10.21+incompatible github.com/fatih/color v1.13.0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-acme/lego/v4 v4.2.0 @@ -56,6 +57,7 @@ require ( github.com/AppsFlyer/go-sundheit v0.5.0 // indirect github.com/MichaelMure/go-term-markdown v0.1.4 // indirect github.com/MichaelMure/go-term-text v0.3.1 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect @@ -66,11 +68,14 @@ require ( github.com/c-bata/go-prompt v0.2.6 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/coreos/go-iptables v0.6.0 // indirect + github.com/creack/pty v1.1.11 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 // indirect github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect github.com/disintegration/imaging v1.6.2 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/ef-ds/deque v1.0.4 // indirect github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect @@ -87,6 +92,7 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/validate v0.22.0 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c // indirect github.com/google/uuid v1.3.0 // indirect @@ -124,9 +130,13 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/netfoundry/secretstream v0.1.2 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.2 // indirect @@ -168,4 +178,5 @@ require ( google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect + gotest.tools/v3 v3.4.0 // indirect ) diff --git a/go.sum b/go.sum index 5e93949c0..efe5c09f9 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.5.0/go.mod h1:9HLKlQjVBH6U3oDfsXOeVc56THsLPw1L03yban4xThw= github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= @@ -75,6 +76,8 @@ github.com/MichaelMure/go-term-markdown v0.1.4 h1:Ir3kBXDUtOX7dEv0EaQV8CNPpH+T7A github.com/MichaelMure/go-term-markdown v0.1.4/go.mod h1:EhcA3+pKYnlUsxYKBJ5Sn1cTQmmBMjeNlpV8nRb+JxA= github.com/MichaelMure/go-term-text v0.3.1 h1:Kw9kZanyZWiCHOYu9v/8pWEgDQ6UVN9/ix2Vd2zzWf0= github.com/MichaelMure/go-term-text v0.3.1/go.mod h1:QgVjAEDUnRMlzpS6ky5CGblux7ebeiLnuy9dAaFZu8o= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -168,8 +171,9 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -190,6 +194,12 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= +github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -318,6 +328,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= @@ -631,11 +642,15 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c h1:RC8WMpjonrBfyAh6VN/POIPtYD5tRAq0qMqCRjQNK+g= +github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c/go.mod h1:9OcmHNQQUTbk4XCffrLgN1NEKc2mh5u++biHVrvHsSU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -667,6 +682,10 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= 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= @@ -1229,6 +1248,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1467,6 +1487,8 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/quickstart/docker/image/Dockerfile b/quickstart/docker/image/Dockerfile index a7cb29c30..609f6bd77 100644 --- a/quickstart/docker/image/Dockerfile +++ b/quickstart/docker/image/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:rolling RUN apt update && \ - apt install jq curl netcat-openbsd vim inetutils-ping net-tools -y + apt install jq curl netcat-openbsd vim inetutils-ping net-tools lsof -y RUN useradd -ms /bin/bash ziti && \ mkdir /openziti && chown ziti:ziti /openziti && \ diff --git a/quickstart/docker/image/run-with-ziti-cli.sh b/quickstart/docker/image/run-with-ziti-cli.sh index 301848917..13f83d232 100755 --- a/quickstart/docker/image/run-with-ziti-cli.sh +++ b/quickstart/docker/image/run-with-ziti-cli.sh @@ -29,7 +29,7 @@ if [[ -f "${initFile}" ]]; then fi # give the controller scripts time to start and create the ziti environment file if running in docker compose -until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 1; done +until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 2; done . "${ZITI_SCRIPTS}/ziti-cli-functions.sh" diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index e2e158f35..050e50ed3 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -279,6 +279,36 @@ function checkPrereqs { fi } +function _portCheck { + if [[ "${1-}" == "" ]] || [[ "${2-}" == "" ]]; then + echo -e "_portCheck Usage: _portCheck " + return 0 + fi + + envVar="${1-}" + if [[ -n "$ZSH_VERSION" ]]; then + envVarValue="${(P)envVar}" + elif [[ -n "$BASH_VERSION" ]]; then + envVarValue="${!envVar}" + else + echo -e "Unknown/Unsupported shell, cannot check port status" + return 1 + fi + + portCheckResult=$(lsof -w -i :"${envVarValue}" 2> /dev/null) + if [[ "${portCheckResult}" != "" ]]; then # Controller management plane + echo -e "$(RED " ")" + echo -e "$(RED "The intended ${2-} port (${envVarValue}) is currently being used, the process using this port should be closed or the port value should be changed.")" + echo -e "$(RED "To use a different port, set the port value in ${envVar}")" + echo -e "$(RED " ")" + echo -e "$(RED "Example:")" + echo -e "$(RED "export ${envVar}=1234")" + echo -e "$(RED " ")" + return 1 + fi + return 0 +} + function checkControllerName { if [[ "${ZITI_EDGE_CONTROLLER_HOSTNAME}" == *['!'@#\$%^\&*\(\)_+]* ]]; then echo -e "$(RED " - The provided Network name contains an invalid character: '!'@#\$%^\&*()_+")" @@ -359,6 +389,7 @@ function generateEnvFile { if [[ "${ZITI_CONTROLLER_RAWNAME-}" == "" ]]; then export ZITI_CONTROLLER_RAWNAME="${ZITI_NETWORK-}"; fi if [[ "${ZITI_CONTROLLER_HOSTNAME-}" == "" ]]; then export export ZITI_CONTROLLER_HOSTNAME="${ZITI_CONTROLLER_RAWNAME}"; fi if [[ "${ZITI_CTRL_PORT-}" == "" ]]; then export ZITI_CTRL_PORT="6262"; fi + if [[ "${ZITI_EDGE_ROUTER_PORT-}" == "" ]]; then export ZITI_EDGE_ROUTER_PORT="3022"; fi if [[ "${ZITI_EDGE_CONTROLLER_RAWNAME-}" == "" ]]; then export export ZITI_EDGE_CONTROLLER_RAWNAME="${ZITI_NETWORK-}"; fi if [[ "${ZITI_EDGE_CONTROLLER_HOSTNAME-}" == "" ]]; then export export ZITI_EDGE_CONTROLLER_HOSTNAME="${ZITI_EDGE_CONTROLLER_RAWNAME}"; fi @@ -468,6 +499,21 @@ function ziti_expressConfiguration { echo "Exiting as env file was not generated" return 1 fi + + # Check Ports + returnCnt=0 + _portCheck "ZITI_CTRL_PORT" "Controller" + returnCnt=$((returnCnt + $?)) + _portCheck "ZITI_EDGE_ROUTER_PORT" "Edge Router" + returnCnt=$((returnCnt + $?)) + _portCheck "ZITI_EDGE_CONTROLLER_PORT" "Edge Controller" + returnCnt=$((returnCnt + $?)) + _portcheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" + returnCnt=$((returnCnt + $?)) + _portcheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" + returnCnt=$((returnCnt + $?)) + if [[ "returnCnt" -gt "0" ]]; then return 1; fi + #checkHostsFile echo " " @@ -1039,7 +1085,8 @@ function ziti_createEnvFile { export ZITI_BIN_ROOT="${ZITI_HOME}/ziti-bin" - if [[ "${ZITI_CTRL_MGMT_HOST_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_HOST_PORT="${ZITI_CONTROLLER_HOSTNAME}:10000"; fi + if [[ "${ZITI_CTRL_MGMT_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_PORT="10000"; fi + if [[ "${ZITI_CTRL_MGMT_HOST_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_HOST_PORT="${ZITI_CONTROLLER_HOSTNAME}:${ZITI_CTRL_MGMT_PORT}"; fi if [[ "${ZITI_CTRL_IDENTITY_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-client.cert"; fi if [[ "${ZITI_CTRL_IDENTITY_SERVER_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-server.chain.pem"; fi if [[ "${ZITI_CTRL_IDENTITY_KEY-}" == "" ]]; then export ZITI_CTRL_IDENTITY_KEY="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/keys/${ZITI_CONTROLLER_HOSTNAME}-server.key"; fi diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index 1fe747c81..05bf77b5b 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -78,6 +78,7 @@ func buildDockerQuickstartTestImage() { defer tw.Close() dockerFile := "TestDockerfile" + imageNameAndTag := "openziti/quickstart:test" filePaths := iterateDir(dir) @@ -99,7 +100,7 @@ func buildDockerQuickstartTestImage() { Context: dockerFileTarReader, Dockerfile: dockerFile, Remove: true, - Tags: []string{"openziti/quickstart:test"}, + Tags: []string{imageNameAndTag}, }) if err != nil { fmt.Println(err) @@ -107,6 +108,20 @@ func buildDockerQuickstartTestImage() { } defer imageBuildResponse.Body.Close() + // Wait until the image finishes building (builds in a background thread) + for { + fmt.Println("Waiting for image build...") + output, err := exec.Command("docker", "images", "-q", imageNameAndTag).Output() + if err != nil { + fmt.Println(err) + } + if string(output) != "" { + fmt.Println("Build complete, continuing with test") + break + } + time.Sleep(5 * time.Second) + } + danglers := filters.NewArgs() danglers.Add("dangling", "true") results, err := cli.ImageList(ctx, types.ImageListOptions{ @@ -224,7 +239,7 @@ func TestQuickStartEnvFile(t *testing.T) { // Wait until it finishes for { - time.Sleep(1) + time.Sleep(1 * time.Second) output, _ := exec.Command("docker", "inspect", "-f", "{{.State.Running}}", containerId).Output() if string(output) == "false\n" { break @@ -299,6 +314,7 @@ func TestSimpleWebService(t *testing.T) { bindHostAddress := "web-test-blue" bindHostPort := 8000 serviceName := "basic.web.smoke.test.service" + wd, _ := os.Getwd() waitForController(ctrlAddress) // Give routers time to enroll themselves time.Sleep(5 * time.Second) @@ -376,7 +392,7 @@ func TestSimpleWebService(t *testing.T) { fmt.Println("Unable to detect a terminator for the edge router") } helloUrl := fmt.Sprintf("http://%s:%d", serviceName, dialPort) - httpClient := createZitifiedHttpClient("/Users/geoffberl/git/NetFoundry/ziti/quickstart/" + testerUsername + ".json") + httpClient := createZitifiedHttpClient(wd + "/" + testerUsername + ".json") resp, e := httpClient.Get(helloUrl) if e != nil { panic(e) diff --git a/ziti/cmd/ziti/cmd/config_templates/router.yml b/ziti/cmd/ziti/cmd/config_templates/router.yml index a487968a4..da216eba7 100644 --- a/ziti/cmd/ziti/cmd/config_templates/router.yml +++ b/ziti/cmd/ziti/cmd/config_templates/router.yml @@ -20,8 +20,8 @@ link: - binding: transport {{ if .Router.IsPrivate }}#{{ end }} listeners: {{ if .Router.IsPrivate }}#{{ end }} - binding: transport -{{ if .Router.IsPrivate }}#{{ end }} bind: tls:0.0.0.0:{{ .Router.Listener.BindPort }} -{{ if .Router.IsPrivate }}#{{ end }} advertise: tls:{{ .Router.Edge.AdvertisedHost }}:{{ .Router.Listener.BindPort }} +{{ if .Router.IsPrivate }}#{{ end }} bind: tls:0.0.0.0:{{ .Router.Edge.ListenerBindPort }} +{{ if .Router.IsPrivate }}#{{ end }} advertise: tls:{{ .Router.Edge.AdvertisedHost }}:{{ .Router.Edge.ListenerBindPort }} {{ if .Router.IsPrivate }}#{{ end }} options: {{ if .Router.IsPrivate }}#{{ end }} outQueueSize: {{ .Router.Listener.OutQueueSize }} diff --git a/ziti/cmd/ziti/cmd/create_config.go b/ziti/cmd/ziti/cmd/create_config.go index 77f0bda76..eb40ce014 100644 --- a/ziti/cmd/ziti/cmd/create_config.go +++ b/ziti/cmd/ziti/cmd/create_config.go @@ -132,11 +132,12 @@ type RouterTemplateValues struct { } type EdgeRouterTemplateValues struct { - Hostname string - Port string - IPOverride string - AdvertisedHost string - LanInterface string + Hostname string + Port string + IPOverride string + AdvertisedHost string + LanInterface string + ListenerBindPort string } type WSSRouterTemplateValues struct { @@ -162,7 +163,6 @@ type RouterForwarderTemplateValues struct { type RouterListenerTemplateValues struct { ConnectTimeout time.Duration GetSessionTimeout time.Duration - BindPort int OutQueueSize int } @@ -256,6 +256,9 @@ func (data *ConfigTemplateValues) populateEnvVars() { zitiEdgeRouterEnrollmentDuration, err := cmdhelper.GetZitiEdgeRouterEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeRouterEnrollmentDurationVarName) + zitiEdgeRouterListenerBindPort, err := cmdhelper.GetZitiEdgeRouterListenerBindPort() + handleVariableError(err, constants.ZitiEdgeRouterListenerBindPortVarName) + data.ZitiHome = zitiHome data.Hostname = hostname data.Controller.Name = zitiCtrlHostname @@ -265,6 +268,7 @@ func (data *ConfigTemplateValues) populateEnvVars() { data.Controller.Edge.ListenerHostPort = zitiEdgeCtrlListenerHostPort data.Controller.Edge.AdvertisedHostPort = zitiEdgeCtrlAdvertisedHostPort data.Router.Edge.Port = zitiEdgeRouterPort + data.Router.Edge.ListenerBindPort = zitiEdgeRouterListenerBindPort data.Controller.Edge.AdvertisedPort = zitiEdgeCtrlAdvertisedPort data.Controller.EdgeIdentityDuration = zitiEdgeIdentityEnrollmentDuration data.Controller.EdgeRouterDuration = zitiEdgeRouterEnrollmentDuration @@ -273,7 +277,6 @@ func (data *ConfigTemplateValues) populateEnvVars() { } func (data *ConfigTemplateValues) populateDefaults() { - data.Router.Listener.BindPort = constants.DefaultListenerBindPort data.Router.Listener.GetSessionTimeout = constants.DefaultGetSessionTimeout data.Controller.MinQueuedConnects = channel.MinQueuedConnects diff --git a/ziti/cmd/ziti/cmd/create_config_environment.go b/ziti/cmd/ziti/cmd/create_config_environment.go index d6a996d1d..9b0a65c5c 100644 --- a/ziti/cmd/ziti/cmd/create_config_environment.go +++ b/ziti/cmd/ziti/cmd/create_config_environment.go @@ -98,6 +98,7 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { {constants.ZitiCtrlPortVarName, constants.ZitiCtrlPortVarDescription, data.Controller.Port}, {constants.ZitiEdgeRouterRawNameVarName, constants.ZitiEdgeRouterRawNameVarDescription, data.Router.Edge.Hostname}, {constants.ZitiEdgeRouterPortVarName, constants.ZitiEdgeRouterPortVarDescription, data.Router.Edge.Port}, + {constants.ZitiEdgeRouterListenerBindPortVarName, constants.ZitiEdgeRouterListenerBindPortVarDescription, data.Router.Edge.ListenerBindPort}, {constants.ZitiEdgeCtrlIdentityCertVarName, constants.ZitiEdgeCtrlIdentityCertVarDescription, data.Controller.Edge.IdentityCert}, {constants.ZitiEdgeCtrlIdentityServerCertVarName, constants.ZitiEdgeCtrlIdentityServerCertVarDescription, data.Controller.Edge.IdentityServerCert}, {constants.ZitiEdgeCtrlIdentityKeyVarName, constants.ZitiEdgeCtrlIdentityKeyVarDescription, data.Controller.Edge.IdentityKey}, @@ -185,6 +186,7 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { "%-40s %-50s %s\n"+ "%-40s %-50s %s\n"+ "%-40s %-50s %s\n"+ + "%-40s %-50s %s\n"+ "%-40s %-50s %s", constants.ZitiHomeVarName, constants.ZitiHomeVarDescription, data.ZitiHome, constants.ZitiCtrlPortVarName, constants.ZitiCtrlPortVarDescription, data.Controller.Port, @@ -196,6 +198,7 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { constants.ZitiEdgeCtrlAdvertisedPortVarName, constants.ZitiEdgeCtrlAdvertisedPortVarDescription, data.Controller.Edge.AdvertisedPort, constants.ZitiEdgeRouterRawNameVarName, constants.ZitiEdgeRouterRawNameVarDescription, data.Router.Edge.Hostname, constants.ZitiEdgeRouterPortVarName, constants.ZitiEdgeRouterPortVarDescription, data.Router.Edge.Port, + constants.ZitiEdgeRouterListenerBindPortVarName, constants.ZitiEdgeRouterListenerBindPortVarDescription, data.Router.Edge.ListenerBindPort, constants.ZitiRouterIdentityCertVarName, constants.ZitiRouterIdentityCertVarDescription, data.Router.IdentityCert, constants.ZitiRouterIdentityServerCertVarName, constants.ZitiRouterIdentityServerCertVarDescription, data.Router.IdentityServerCert, constants.ZitiRouterIdentityKeyVarName, constants.ZitiRouterIdentityKeyVarDescription, data.Router.IdentityKey, diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go index bebf5d2a4..2340771ab 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go @@ -4,6 +4,7 @@ import ( "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/stretchr/testify/assert" "os" + "strings" "testing" "time" ) @@ -189,6 +190,51 @@ func TestBlankEdgeRouterNameBecomesHostname(t *testing.T) { } +func TestDefaultZitiEdgeRouterListenerBindPort(t *testing.T) { + expectedDefaultPort := "10080" + + // Make sure the related env vars are unset + _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") + + // Create and run the CLI command + config := createRouterConfig([]string{"edge", "--routerName", "testRouter"}) + + // Check that the template data has been updated as expected + assert.Equal(t, expectedDefaultPort, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} + +func TestSetZitiEdgeRouterListenerBindPort(t *testing.T) { + myPortValue := "1234" + + // Set the port manually + _ = os.Setenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT", myPortValue) + + // Create and run the CLI command + config := createRouterConfig([]string{"edge", "--routerName", "testRouter"}) + + assert.Equal(t, myPortValue, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} + func TestEdgeRouterCannotBeWSSAndPrivate(t *testing.T) { expectedErrorMsg := "Flags for private and wss configs are mutually exclusive. You must choose private or wss, not both" @@ -219,10 +265,10 @@ func TestEdgeRouterOutputPathDoesNotExist(t *testing.T) { func TestExecuteCreateConfigRouterEdgeHasNonBlankTemplateValues(t *testing.T) { routerName := "MyEdgeRouter" - expectedNonEmptyStringFields := []string{".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} - expectedNonEmptyStringValues := []*string{&data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} - expectedNonEmptyIntFields := []string{".Router.Listener.BindPort", ".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} - expectedNonEmptyIntValues := []*int{&data.Router.Listener.BindPort, &data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} + expectedNonEmptyStringFields := []string{".Router.Edge.ListenerBindPort", ".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} + expectedNonEmptyStringValues := []*string{&data.Router.Edge.ListenerBindPort, &data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} + expectedNonEmptyIntFields := []string{".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} + expectedNonEmptyIntValues := []*int{&data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} expectedNonEmptyTimeFields := []string{".Router.Listener.ConnectTimeout", "Router.Listener.GetSessionTimeout", ".Router.Wss.WriteTimeout", ".Router.Wss.ReadTimeout", ".Router.Wss.IdleTimeout", ".Router.Wss.PongTimeout", ".Router.Wss.PingInterval", ".Router.Wss.HandshakeTimeout", ".Router.Forwarder.LatencyProbeInterval"} expectedNonEmptyTimeValues := []*time.Duration{&data.Router.Listener.ConnectTimeout, &data.Router.Listener.GetSessionTimeout, &data.Router.Wss.WriteTimeout, &data.Router.Wss.ReadTimeout, &data.Router.Wss.IdleTimeout, &data.Router.Wss.PongTimeout, &data.Router.Wss.PingInterval, &data.Router.Wss.HandshakeTimeout, &data.Router.Forwarder.LatencyProbeInterval} diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go index 2b1e0cf8a..6f5fb47fb 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go @@ -4,16 +4,17 @@ import ( "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/stretchr/testify/assert" "os" + "strings" "testing" "time" ) func TestExecuteCreateConfigRouterFabricHasNonBlankTemplateValues(t *testing.T) { routerName := "MyFabricRouter" - expectedNonEmptyStringFields := []string{".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} - expectedNonEmptyStringValues := []*string{&data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} - expectedNonEmptyIntFields := []string{".Router.Listener.BindPort", ".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} - expectedNonEmptyIntValues := []*int{&data.Router.Listener.BindPort, &data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} + expectedNonEmptyStringFields := []string{".Router.Listener.BindPort", ".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} + expectedNonEmptyStringValues := []*string{&data.Router.Edge.ListenerBindPort, &data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} + expectedNonEmptyIntFields := []string{".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} + expectedNonEmptyIntValues := []*int{&data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} expectedNonEmptyTimeFields := []string{".Router.Listener.ConnectTimeout", "Router.Listener.GetSessionTimeout", ".Router.Wss.WriteTimeout", ".Router.Wss.ReadTimeout", ".Router.Wss.IdleTimeout", ".Router.Wss.PongTimeout", ".Router.Wss.PingInterval", ".Router.Wss.HandshakeTimeout", ".Router.Forwarder.LatencyProbeInterval"} expectedNonEmptyTimeValues := []*time.Duration{&data.Router.Listener.ConnectTimeout, &data.Router.Listener.GetSessionTimeout, &data.Router.Wss.WriteTimeout, &data.Router.Wss.ReadTimeout, &data.Router.Wss.IdleTimeout, &data.Router.Wss.PongTimeout, &data.Router.Wss.PingInterval, &data.Router.Wss.HandshakeTimeout, &data.Router.Forwarder.LatencyProbeInterval} @@ -109,3 +110,48 @@ func TestFabricRouterOutputPathDoesNotExist(t *testing.T) { assert.EqualError(t, err, expectedErrorMsg, "Error does not match, expected %s but got %s", expectedErrorMsg, err) } + +func TestDefaultZitiFabricRouterListenerBindPort(t *testing.T) { + expectedDefaultPort := "10080" + + // Make sure the related env vars are unset + _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") + + // Create and run the CLI command + config := createRouterConfig([]string{"fabric", "--routerName", "testRouter"}) + + // Check that the template data has been updated as expected + assert.Equal(t, expectedDefaultPort, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} + +func TestSetZitiFabricRouterListenerBindPort(t *testing.T) { + myPortValue := "1234" + + // Set the port manually + _ = os.Setenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT", myPortValue) + + // Create and run the CLI command + config := createRouterConfig([]string{"fabric", "--routerName", "testRouter"}) + + assert.Equal(t, myPortValue, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} diff --git a/ziti/cmd/ziti/cmd/create_config_test.go b/ziti/cmd/ziti/cmd/create_config_test.go index 59a8b002b..51ed0e9ed 100644 --- a/ziti/cmd/ziti/cmd/create_config_test.go +++ b/ziti/cmd/ziti/cmd/create_config_test.go @@ -40,6 +40,7 @@ func getZitiEnvironmentVariables() []string { "ZITI_EDGE_IDENTITY_ENROLLMENT_DURATION", "ZITI_EDGE_ROUTER_ENROLLMENT_DURATION", "ZITI_EDGE_ROUTER_ADVERTISED_HOST", + "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT", } } diff --git a/ziti/cmd/ziti/cmd/helpers/env_helpers.go b/ziti/cmd/ziti/cmd/helpers/env_helpers.go index 21ee4d8e1..13e93944a 100644 --- a/ziti/cmd/ziti/cmd/helpers/env_helpers.go +++ b/ziti/cmd/ziti/cmd/helpers/env_helpers.go @@ -105,6 +105,10 @@ func GetZitiEdgeRouterPort() (string, error) { return getValueOrSetAndGetDefault(constants.ZitiEdgeRouterPortVarName, constants.DefaultZitiEdgeRouterPort) } +func GetZitiEdgeRouterListenerBindPort() (string, error) { + return getValueOrSetAndGetDefault(constants.ZitiEdgeRouterListenerBindPortVarName, constants.DefaultZitiEdgeRouterListenerBindPort) +} + func GetZitiEdgeCtrlListenerHostPort() (string, error) { // Get the edge controller port to use as the default edgeCtrlPort, err := GetZitiEdgeCtrlAdvertisedPort() diff --git a/ziti/cmd/ziti/constants/constants.go b/ziti/cmd/ziti/constants/constants.go index b4efd27b3..3aacff84d 100644 --- a/ziti/cmd/ziti/constants/constants.go +++ b/ziti/cmd/ziti/constants/constants.go @@ -36,8 +36,8 @@ const ( // Config Template Constants const ( - DefaultListenerBindPort = 10080 - DefaultGetSessionTimeout = 60 * time.Second + DefaultZitiEdgeRouterListenerBindPort = "10080" + DefaultGetSessionTimeout = 60 * time.Second DefaultZitiEdgeRouterPort = "3022" @@ -107,4 +107,6 @@ const ( ZitiEdgeRouterIPOverrideVarDescription = "Override the default edge router IP with a custom IP, this IP will also be added to the PKI" ZitiEdgeRouterAdvertisedHostVarName = "ZITI_EDGE_ROUTER_ADVERTISED_HOST" ZitiEdgeRouterAdvertisedHostVarDescription = "The advertised host of the router" + ZitiEdgeRouterListenerBindPortVarName = "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" + ZitiEdgeRouterListenerBindPortVarDescription = "The port a public router will advertise on" ) From af1daff19087ea07a6214faf15881f495312f3fe Mon Sep 17 00:00:00 2001 From: gberl002 Date: Wed, 16 Nov 2022 17:25:26 -0500 Subject: [PATCH 2/6] Fixing typo in function call Signed-off-by: gberl002 --- quickstart/docker/image/ziti-cli-functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 050e50ed3..fd1e1692e 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -508,9 +508,9 @@ function ziti_expressConfiguration { returnCnt=$((returnCnt + $?)) _portCheck "ZITI_EDGE_CONTROLLER_PORT" "Edge Controller" returnCnt=$((returnCnt + $?)) - _portcheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" + _portCheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" returnCnt=$((returnCnt + $?)) - _portcheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" + _portCheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" returnCnt=$((returnCnt + $?)) if [[ "returnCnt" -gt "0" ]]; then return 1; fi From 3c583ddeb6d26f6641dc56263b19a9b88410d9bb Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 16 Nov 2022 11:45:49 -0500 Subject: [PATCH 3/6] Add create/delete transit-router CLI commands. Fixes #897 --- CHANGELOG.md | 2 + go.mod | 32 ++++--- go.sum | 64 +++++++++---- ziti/cmd/edge/create.go | 7 +- ziti/cmd/edge/create_edge_router.go | 9 +- ziti/cmd/edge/create_transit_router.go | 120 +++++++++++++++++++++++++ ziti/cmd/edge/delete.go | 3 +- 7 files changed, 199 insertions(+), 38 deletions(-) create mode 100644 ziti/cmd/edge/create_transit_router.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d652b9ff..0b9b823b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Ziti CLI * The CLI has been cleaned up and unused, unusable and underused components have been removed or hidden + * Add create/delete transit-router CLI commands ## Ziti CLI @@ -24,6 +25,7 @@ * The install, upgrade, use and version commands have been hidden and will be hidden once tests using them are updated or replaced * The demo and tutorial commands have been moved under the new learn subcommand * `ziti edge enroll` now has a verbose option for additional debugging +* The `ziti edge` CLI now support create/delete transit-router. This allows transit/fabric routers to be provisioned using an enrollment process, rather than requiring certs to be created externally. Note that this requires that the fabric router config file has a `csr` section. # Release 0.26.11 diff --git a/go.mod b/go.mod index cbc74e96d..22d5bb9ef 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Jeffail/gabs/v2 v2.6.1 github.com/MakeNowJust/heredoc v1.0.0 github.com/blang/semver v3.5.1+incompatible + github.com/docker/docker v20.10.21+incompatible github.com/fatih/color v1.13.0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-acme/lego/v4 v4.2.0 @@ -20,15 +21,15 @@ require ( github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.6.9 github.com/openziti/agent v1.0.5 - github.com/openziti/channel/v2 v2.0.12 + github.com/openziti/channel/v2 v2.0.15 github.com/openziti/edge v0.24.36 github.com/openziti/fabric v0.21.17 github.com/openziti/foundation/v2 v2.0.7 - github.com/openziti/identity v1.0.20 + github.com/openziti/identity v1.0.23 github.com/openziti/runzmd v1.0.3 - github.com/openziti/sdk-golang v0.16.146 + github.com/openziti/sdk-golang v0.18.1 github.com/openziti/storage v0.1.26 - github.com/openziti/transport/v2 v2.0.38 + github.com/openziti/transport/v2 v2.0.41 github.com/openziti/xweb/v2 v2.0.2 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pborman/uuid v1.2.0 @@ -56,6 +57,7 @@ require ( github.com/AppsFlyer/go-sundheit v0.5.0 // indirect github.com/MichaelMure/go-term-markdown v0.1.4 // indirect github.com/MichaelMure/go-term-text v0.3.1 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect @@ -64,13 +66,16 @@ require ( github.com/biogo/store v0.0.0-20200525035639-8c94ae1e7c9c // indirect github.com/boltdb/bolt v1.3.1 // indirect github.com/c-bata/go-prompt v0.2.6 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/coreos/go-iptables v0.6.0 // indirect + github.com/creack/pty v1.1.11 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 // indirect github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect github.com/disintegration/imaging v1.6.2 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/ef-ds/deque v1.0.4 // indirect github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect @@ -87,6 +92,7 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/validate v0.22.0 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c // indirect github.com/google/uuid v1.3.0 // indirect @@ -124,13 +130,17 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/netfoundry/secretstream v0.1.2 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.2 // indirect - github.com/openziti/metrics v1.1.5 // indirect + github.com/openziti/metrics v1.1.6 // indirect github.com/openziti/x509-claims v1.0.3 // indirect github.com/orcaman/concurrent-map/v2 v2.0.0 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect @@ -138,7 +148,7 @@ require ( github.com/pkg/term v1.2.0-beta.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect - github.com/rivo/uniseg v0.4.2 // indirect + github.com/rivo/uniseg v0.4.3 // indirect github.com/rodaine/table v1.0.1 // indirect github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect github.com/speps/go-hashids v2.0.0+incompatible // indirect @@ -157,15 +167,17 @@ require ( github.com/yusufpapurcu/wmi v1.2.2 // indirect go.mongodb.org/mongo-driver v1.10.0 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect - golang.org/x/crypto v0.2.0 // indirect + golang.org/x/crypto v0.3.0 // indirect + golang.org/x/exp v0.0.0-20221114191408-850992195362 // indirect golang.org/x/image v0.1.0 // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/mod v0.6.0 // indirect golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect golang.org/x/sys v0.2.0 // indirect golang.org/x/term v0.2.0 // indirect golang.org/x/text v0.4.0 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/tools v0.2.0 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect + gotest.tools/v3 v3.4.0 // indirect ) diff --git a/go.sum b/go.sum index 8752aa719..bab64a661 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.5.0/go.mod h1:9HLKlQjVBH6U3oDfsXOeVc56THsLPw1L03yban4xThw= github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= @@ -75,6 +76,8 @@ github.com/MichaelMure/go-term-markdown v0.1.4 h1:Ir3kBXDUtOX7dEv0EaQV8CNPpH+T7A github.com/MichaelMure/go-term-markdown v0.1.4/go.mod h1:EhcA3+pKYnlUsxYKBJ5Sn1cTQmmBMjeNlpV8nRb+JxA= github.com/MichaelMure/go-term-text v0.3.1 h1:Kw9kZanyZWiCHOYu9v/8pWEgDQ6UVN9/ix2Vd2zzWf0= github.com/MichaelMure/go-term-text v0.3.1/go.mod h1:QgVjAEDUnRMlzpS6ky5CGblux7ebeiLnuy9dAaFZu8o= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -132,8 +135,8 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7 github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI= github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY= github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -168,8 +171,9 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -190,6 +194,12 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= +github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -318,6 +328,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= @@ -631,11 +642,15 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU= +github.com/moby/term v0.0.0-20221120202655-abb19827d345/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -667,14 +682,18 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= 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/agent v1.0.5 h1:wZUcMYqvwspOjDSaejMtczSXnJoqK0edI9HcEIFsTIs= github.com/openziti/agent v1.0.5/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= -github.com/openziti/channel/v2 v2.0.12 h1:0/qQ3qCSt70gpUuxQk8MRD3+iGKqS4wuYZpbcOzS+tc= -github.com/openziti/channel/v2 v2.0.12/go.mod h1:mESOWBphvr2/P6j3FDIiQF+Z6z3E3Vjv6GaCoGWY6eM= +github.com/openziti/channel/v2 v2.0.15 h1:y1YwewnZTPTPtE3YVjaVpOWGoqJ3+I8+7KqQB4D3poQ= +github.com/openziti/channel/v2 v2.0.15/go.mod h1:LdoKRnefknW4WllUyHJtvKDtKK716lYdHqApKbBy3rk= 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.24.36 h1:3ywHRL5XXYtA4+y12WptofLhkndshePuy/MyKT3A2xo= @@ -683,20 +702,20 @@ github.com/openziti/fabric v0.21.17 h1:oT32L0Lu64Jd7CkHrQZdOwG0Mew8bMBEUowtRyhER github.com/openziti/fabric v0.21.17/go.mod h1:VsRUi2wdA3k4bOXxfrohaoUuhcjf8ZdpPPN0NzD8my4= github.com/openziti/foundation/v2 v2.0.7 h1:QtpP0ntUhr/7uLR1iM7eEkrusQ2b2ZqTblgdq8cac9Y= github.com/openziti/foundation/v2 v2.0.7/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= -github.com/openziti/identity v1.0.20 h1:8nsQFHpqKS1ByD8QuPDxQWfS8CQEidyn5jFXWnXguX0= -github.com/openziti/identity v1.0.20/go.mod h1:X0WLWEgnM1iL8asNbuu7vUW0kZq8nnWKepMW214C9Mk= +github.com/openziti/identity v1.0.23 h1:SJ2UN3qCiUKwuwFc0dr3nuHyKvhOr5aN5bEJa2wY9Sw= +github.com/openziti/identity v1.0.23/go.mod h1:uVqZEC4Lr7pEud9b5g0h/cH0Ir5K0egCjUrEVup4ERc= github.com/openziti/jwks v1.0.2 h1:32BGXIAnefS+v7uXKPb1x8/cQ7srek6Ai06dsrMTY4E= github.com/openziti/jwks v1.0.2/go.mod h1:KwO0x9FBG0aoJS5f6nH5xeHoplyR1H143SMI9kF0mC8= -github.com/openziti/metrics v1.1.5 h1:qhsGsYWdp7LxPCYi9WMGHGbjiHvsT1DtjM44JNHLZWk= -github.com/openziti/metrics v1.1.5/go.mod h1:B6RCuVRTpI3kEIhQlCvsHj3Pqi6bSnqFmRPgfgv9ico= +github.com/openziti/metrics v1.1.6 h1:fc4t5JEuYYr4gr+tF3qNpbvQ55QhoLyeOG+hiDfKLF8= +github.com/openziti/metrics v1.1.6/go.mod h1:07aMMS1VNzZvz0246fX73SFfuuoRz2nKcvDJumrVlZ0= github.com/openziti/runzmd v1.0.3 h1:g+JyJS66ykMIidLTzroKBLwbsSF9S1hDvolj2PpD8lE= github.com/openziti/runzmd v1.0.3/go.mod h1:2YuoQl5zZ6edfb+k1MjglW2cwfZvXwug2WldvBIUNrU= -github.com/openziti/sdk-golang v0.16.146 h1:5R7ZOSh+Q0pmZdzEv3l2Q03KQgiUrpaj3ymD8DjBT5k= -github.com/openziti/sdk-golang v0.16.146/go.mod h1:yOgsofdEd82pph97N4DX0xYlfgjJ2LCgC/mHkMw+5hU= +github.com/openziti/sdk-golang v0.18.1 h1:/Ge1PiTvGG99Qm1Ry5T50ay7QCMuy5Rz7HbqMP2mcEQ= +github.com/openziti/sdk-golang v0.18.1/go.mod h1:k/QRh6WA2zFsALuWC6X6+exmzbC/ddXFpRcx5FRDvQM= github.com/openziti/storage v0.1.26 h1:1tV4czY/TNmzX3raUZjbR8jVl5L92pdD0SjmdzCzUmE= github.com/openziti/storage v0.1.26/go.mod h1:Zkm+4d2gckkIbuuCw/sKFWKKhPROZak3gLFzdII0KWQ= -github.com/openziti/transport/v2 v2.0.38 h1:9+EtBF052TtGvT5isuPj/SUTXNHg8RbkGBcEKfiUPd8= -github.com/openziti/transport/v2 v2.0.38/go.mod h1:FB/pqmA8RdUsoWtpTc6E/it6lLdA7GOugy9no3JDU/4= +github.com/openziti/transport/v2 v2.0.41 h1:T9RPXsJ0wbDgIx6mjKY1YDOg6ncRDmLPq8xU52B0mvU= +github.com/openziti/transport/v2 v2.0.41/go.mod h1:YM4hnHjHK1gQZuWgmDoPGSDP+8l7uT8kT8oBGM1u6nk= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.0.2 h1:XYlVFriTq/U1wcUrc+XPnWJGhXh9NJPhtQ7+r3aC0cU= @@ -773,8 +792,8 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8= -github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= +github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rodaine/table v1.0.1 h1:U/VwCnUxlVYxw8+NJiLIuCxA/xa6jL38MY3FYysVWWQ= github.com/rodaine/table v1.0.1/go.mod h1:UVEtfBsflpeEcD56nF4F5AocNFta0ZuolpSVdPtlmP4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -985,8 +1004,8 @@ golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE= -golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -997,6 +1016,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ= +golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1027,8 +1048,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1230,6 +1252,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1293,8 +1316,9 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1468,6 +1492,8 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ziti/cmd/edge/create.go b/ziti/cmd/edge/create.go index 55f3b376b..9c59834cc 100644 --- a/ziti/cmd/edge/create.go +++ b/ziti/cmd/edge/create.go @@ -43,13 +43,14 @@ func newCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(newCreateConfigTypeCmd(out, errOut)) cmd.AddCommand(newCreateEdgeRouterCmd(out, errOut)) cmd.AddCommand(newCreateEdgeRouterPolicyCmd(out, errOut)) - cmd.AddCommand(newCreateTerminatorCmd(out, errOut)) + cmd.AddCommand(newCreateEnrollmentCmd(out, errOut)) cmd.AddCommand(newCreateIdentityCmd(out, errOut)) + cmd.AddCommand(newCreatePostureCheckCmd(out, errOut)) cmd.AddCommand(newCreateServiceCmd(out, errOut)) cmd.AddCommand(newCreateServiceEdgeRouterPolicyCmd(out, errOut)) cmd.AddCommand(newCreateServicePolicyCmd(out, errOut)) - cmd.AddCommand(newCreatePostureCheckCmd(out, errOut)) - cmd.AddCommand(newCreateEnrollmentCmd(out, errOut)) + cmd.AddCommand(newCreateTerminatorCmd(out, errOut)) + cmd.AddCommand(newCreateTransitRouterCmd(out, errOut)) return cmd } diff --git a/ziti/cmd/edge/create_edge_router.go b/ziti/cmd/edge/create_edge_router.go index 3b7922ef5..e325484bf 100644 --- a/ziti/cmd/edge/create_edge_router.go +++ b/ziti/cmd/edge/create_edge_router.go @@ -18,14 +18,13 @@ package edge import ( "fmt" + "github.com/Jeffail/gabs" "github.com/openziti/ziti/ziti/cmd/api" "github.com/openziti/ziti/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "io" - "io/ioutil" - - "github.com/Jeffail/gabs" "github.com/spf13/cobra" + "io" + "os" ) type createEdgeRouterOptions struct { @@ -116,7 +115,7 @@ func getEdgeRouterJwt(o *createEdgeRouterOptions, id string) error { return fmt.Errorf("enrollment JWT not present for new edge router") } - if err := ioutil.WriteFile(o.jwtOutputFile, []byte(jwt), 0600); err != nil { + if err := os.WriteFile(o.jwtOutputFile, []byte(jwt), 0600); err != nil { fmt.Printf("Failed to write JWT to file(%v)\n", o.jwtOutputFile) return err } diff --git a/ziti/cmd/edge/create_transit_router.go b/ziti/cmd/edge/create_transit_router.go new file mode 100644 index 000000000..39ff7163a --- /dev/null +++ b/ziti/cmd/edge/create_transit_router.go @@ -0,0 +1,120 @@ +/* + 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 ( + "fmt" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "io" + "os" + + "github.com/Jeffail/gabs" + "github.com/spf13/cobra" +) + +type createTransitRouterOptions struct { + api.Options + jwtOutputFile string + tags map[string]string + cost uint16 + noTraversal bool +} + +func newCreateTransitRouterCmd(out io.Writer, errOut io.Writer) *cobra.Command { + options := &createTransitRouterOptions{ + Options: api.Options{ + CommonOptions: common.CommonOptions{Out: out, Err: errOut}, + }, + } + + cmd := &cobra.Command{ + Use: "transit-router ", + Short: "creates a transit router managed by the Ziti Edge Controller", + Long: "creates a transit router managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := runCreateTransitRouter(options) + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{}, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + cmd.Flags().StringVarP(&options.jwtOutputFile, "jwt-output-file", "o", "", "File to which to output the JWT used for enrolling the edge router") + cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags") + cmd.Flags().Uint16Var(&options.cost, "cost", 0, "Specifies the router cost. Default 0.") + cmd.Flags().BoolVar(&options.noTraversal, "no-traversal", false, "Disallow traversal for this edge router. Default to allowed(false).") + + options.AddCommonFlags(cmd) + + return cmd +} + +// runCreateTransitRouter implements the command to create a gateway on the edge controller +func runCreateTransitRouter(o *createTransitRouterOptions) error { + entityData := gabs.New() + api.SetJSONValue(entityData, o.Args[0], "name") + api.SetJSONValue(entityData, o.tags, "tags") + api.SetJSONValue(entityData, o.cost, "cost") + api.SetJSONValue(entityData, o.noTraversal, "noTraversal") + + result, err := CreateEntityOfType("transit-routers", entityData.String(), &o.Options) + if err := o.LogCreateResult("transit router", result, err); err != nil { + return err + } + + if o.jwtOutputFile != "" { + id := result.S("data", "id").Data().(string) + if err := getTransitRouterJwt(o, id); err != nil { + return err + } + } + return nil +} + +func getTransitRouterJwt(o *createTransitRouterOptions, id string) error { + newRouter, err := DetailEntityOfType("transit-routers", id, o.OutputJSONResponse, o.Out, o.Options.Timeout, o.Options.Verbose) + if err != nil { + return err + } + + if newRouter == nil { + return fmt.Errorf("no error during transit router creation, but edge router with id %v not found... unable to extract JWT", id) + } + + jwt := newRouter.Path("enrollmentJwt").Data().(string) + if jwt == "" { + return fmt.Errorf("enrollment JWT not present for new transit router") + } + + if err := os.WriteFile(o.jwtOutputFile, []byte(jwt), 0600); err != nil { + fmt.Printf("Failed to write JWT to file(%v)\n", o.jwtOutputFile) + return err + } + + jwtExpiration := newRouter.Path("enrollmentExpiresAt").Data().(string) + if jwtExpiration != "" { + fmt.Printf("Enrollment expires at %v\n", jwtExpiration) + } + + return err +} diff --git a/ziti/cmd/edge/delete.go b/ziti/cmd/edge/delete.go index 7908be24b..faa3b8022 100644 --- a/ziti/cmd/edge/delete.go +++ b/ziti/cmd/edge/delete.go @@ -60,12 +60,13 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command { 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("posture-check", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("service", 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())) + cmd.AddCommand(newDeleteCmdForEntityType("transit-router", newOptions())) return cmd } From 004fc0cc0272dab054c6f0d5d96239a9814ca4db Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 16 Nov 2022 16:11:51 -0500 Subject: [PATCH 4/6] Fix some linter warnings --- ziti/cmd/edge/policy_advisor.go | 6 ++---- ziti/util/identities.go | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ziti/cmd/edge/policy_advisor.go b/ziti/cmd/edge/policy_advisor.go index 6cabe3759..892b4e945 100644 --- a/ziti/cmd/edge/policy_advisor.go +++ b/ziti/cmd/edge/policy_advisor.go @@ -265,8 +265,7 @@ func runPolicyAdvisorForIdentity(identityId string, o *policyAdvisorOptions) err skip := 0 done := false for !done { - filter := "true limit 2" - filter = fmt.Sprintf(`true skip %v limit 2`, skip) + filter := fmt.Sprintf(`true skip %v limit 2`, skip) children, _, err := filterSubEntitiesOfType("identities", "services", identityId, filter, &o.Options) if err != nil { return err @@ -300,8 +299,7 @@ func runPolicyAdvisorForService(serviceId string, o *policyAdvisorOptions) error skip := 0 done := false for !done { - filter := "true limit 2" - filter = fmt.Sprintf(`true skip %v limit 2`, skip) + filter := fmt.Sprintf(`true skip %v limit 2`, skip) children, _, err := filterSubEntitiesOfType("services", "identities", serviceId, filter, &o.Options) if err != nil { return err diff --git a/ziti/util/identities.go b/ziti/util/identities.go index f56b4ad29..57f594a5b 100644 --- a/ziti/util/identities.go +++ b/ziti/util/identities.go @@ -13,7 +13,7 @@ import ( "github.com/openziti/ziti/ziti/cmd/common" "github.com/pkg/errors" "gopkg.in/resty.v1" - "io/ioutil" + "io" "net" "net/http" "net/url" @@ -81,7 +81,7 @@ func (self *RestClientEdgeIdentity) IsReadOnly() bool { func (self *RestClientEdgeIdentity) NewTlsClientConfig() (*tls.Config, error) { rootCaPool := x509.NewCertPool() - rootPemData, err := ioutil.ReadFile(self.CaCert) + rootPemData, err := os.ReadFile(self.CaCert) if err != nil { return nil, errors.Errorf("could not read session certificates [%s]: %v", self.CaCert, err) } @@ -255,7 +255,7 @@ func LoadRestClientConfig() (*RestClientConfig, string, error) { } return nil, "", errors.Wrapf(err, "error while statting config file %v", configFile) } - result, err := ioutil.ReadFile(configFile) + result, err := os.ReadFile(configFile) if err != nil { return nil, "", errors.Wrapf(err, "error while reading config file %v", configFile) } @@ -295,7 +295,7 @@ func PersistRestClientConfig(config *RestClientConfig) error { return errors.Wrap(err, "error while marshalling config to JSON") } - err = ioutil.WriteFile(configFile, data, 0600) + err = os.WriteFile(configFile, data, 0600) if err != nil { return errors.Wrapf(err, "error while writing config file %v", configFile) } @@ -379,8 +379,8 @@ func newRestClientResponseF(clientOpts ClientOpts) func(*http.Response, error) { return } - resp.Body = ioutil.NopCloser(resp.Body) - bodyContent, err := ioutil.ReadAll(resp.Body) + resp.Body = io.NopCloser(resp.Body) + bodyContent, err := io.ReadAll(resp.Body) if err != nil { _, _ = fmt.Fprintf(clientOpts.ErrOutputWriter(), "could not read response body: %v", err) return @@ -407,7 +407,7 @@ func newRestClientRequestF(clientOpts ClientOpts, readOnly bool) func(*http.Requ _, _ = fmt.Fprintf(clientOpts.ErrOutputWriter(), "could not copy request body: %v", err) return nil } - bodyContent, err := ioutil.ReadAll(body) + bodyContent, err := io.ReadAll(body) if err != nil { bodyStr := string(bodyContent) _, _ = fmt.Fprint(clientOpts.OutputWriter(), bodyStr, "\n") From bd74580f722564885c3d905de2db409ffe7d8b6f Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 29 Nov 2022 16:39:30 -0500 Subject: [PATCH 5/6] Addressing PR concerns Signed-off-by: gberl002 --- quickstart/docker/image/run-with-ziti-cli.sh | 5 ++++- quickstart/docker/image/ziti-cli-functions.sh | 12 ++++++++---- ziti/cmd/ziti/cmd/create_config_router_edge_test.go | 2 +- .../cmd/ziti/cmd/create_config_router_fabric_test.go | 4 +++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/quickstart/docker/image/run-with-ziti-cli.sh b/quickstart/docker/image/run-with-ziti-cli.sh index 13f83d232..e231c9ee5 100755 --- a/quickstart/docker/image/run-with-ziti-cli.sh +++ b/quickstart/docker/image/run-with-ziti-cli.sh @@ -29,7 +29,10 @@ if [[ -f "${initFile}" ]]; then fi # give the controller scripts time to start and create the ziti environment file if running in docker compose -until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 2; done +until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 1; done + +# Pause shortly to avoid the intermittent error of reading the file before it's completely done being written to. +sleep 1 . "${ZITI_SCRIPTS}/ziti-cli-functions.sh" diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index fd1e1692e..d8f4ac73e 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -291,10 +291,11 @@ function _portCheck { elif [[ -n "$BASH_VERSION" ]]; then envVarValue="${!envVar}" else - echo -e "Unknown/Unsupported shell, cannot check port status" - return 1 + echo -e "$(YELLOW "Unknown/Unsupported shell, cannot verify availability of ${2-}'s intended port, proceed with caution")" + return 0 fi + echo -e "Checking if ${2-}'s port (${envVarValue}) is available" portCheckResult=$(lsof -w -i :"${envVarValue}" 2> /dev/null) if [[ "${portCheckResult}" != "" ]]; then # Controller management plane echo -e "$(RED " ")" @@ -510,8 +511,11 @@ function ziti_expressConfiguration { returnCnt=$((returnCnt + $?)) _portCheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" returnCnt=$((returnCnt + $?)) - _portCheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" - returnCnt=$((returnCnt + $?)) + if [[ "${ZITI_EDGE_ROUTER_LISTENER_BIND_PORT-}" != "" ]]; then + # This port can be explicitly set but is not always, only check if set + _portCheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" + returnCnt=$((returnCnt + $?)) + fi if [[ "returnCnt" -gt "0" ]]; then return 1; fi #checkHostsFile diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go index 2340771ab..98dc1eda2 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go @@ -191,7 +191,7 @@ func TestBlankEdgeRouterNameBecomesHostname(t *testing.T) { } func TestDefaultZitiEdgeRouterListenerBindPort(t *testing.T) { - expectedDefaultPort := "10080" + expectedDefaultPort := TEST_ROUTER_LISTENER_PORT // Make sure the related env vars are unset _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go index 6f5fb47fb..5b7805092 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go @@ -9,6 +9,8 @@ import ( "time" ) +var TEST_ROUTER_LISTENER_PORT = 10080 + func TestExecuteCreateConfigRouterFabricHasNonBlankTemplateValues(t *testing.T) { routerName := "MyFabricRouter" expectedNonEmptyStringFields := []string{".Router.Listener.BindPort", ".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} @@ -112,7 +114,7 @@ func TestFabricRouterOutputPathDoesNotExist(t *testing.T) { } func TestDefaultZitiFabricRouterListenerBindPort(t *testing.T) { - expectedDefaultPort := "10080" + expectedDefaultPort := TEST_ROUTER_LISTENER_PORT // Make sure the related env vars are unset _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") From 705abf598a564df14669c3158888af164eb1f6a2 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 29 Nov 2022 17:40:48 -0500 Subject: [PATCH 6/6] Fixing a misnamed dependency Signed-off-by: gberl002 --- ziti/cmd/create_config.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ziti/cmd/create_config.go b/ziti/cmd/create_config.go index 432172f6f..2dd5635fd 100644 --- a/ziti/cmd/create_config.go +++ b/ziti/cmd/create_config.go @@ -18,7 +18,7 @@ package cmd import ( "github.com/openziti/ziti/ziti/cmd/common" - helpers2 "github.com/openziti/ziti/ziti/cmd/helpers" + cmdHelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/constants" "os" "time" @@ -179,7 +179,7 @@ func init() { } } - workingDir = helpers2.NormalizePath(zh) + workingDir = cmdHelper.NormalizePath(zh) } // NewCmdCreateConfig creates a command object for the "config" command @@ -189,7 +189,7 @@ func NewCmdCreateConfig() *cobra.Command { Short: "Creates a config file for specified Ziti component using environment variables", Aliases: []string{"cfg"}, Run: func(cmd *cobra.Command, args []string) { - helpers2.CheckErr(cmd.Help()) + cmdHelper.CheckErr(cmd.Help()) }, } @@ -213,50 +213,50 @@ func (data *ConfigTemplateValues) populateEnvVars() { handleVariableError(err, "hostname") // Get and add ziti home to the params - zitiHome, err := helpers2.GetZitiHome() + zitiHome, err := cmdHelper.GetZitiHome() handleVariableError(err, constants.ZitiHomeVarName) // Get Ziti Controller Name - zitiCtrlHostname, err := helpers2.GetZitiCtrlName() + zitiCtrlHostname, err := cmdHelper.GetZitiCtrlName() handleVariableError(err, constants.ZitiCtrlNameVarName) // Get Ziti Edge Router Port - zitiEdgeRouterPort, err := helpers2.GetZitiEdgeRouterPort() + zitiEdgeRouterPort, err := cmdHelper.GetZitiEdgeRouterPort() handleVariableError(err, constants.ZitiEdgeRouterPortVarName) // Get Ziti Controller Listener Address - zitiCtrlListenerAddress, err := helpers2.GetZitiCtrlListenerAddress() + zitiCtrlListenerAddress, err := cmdHelper.GetZitiCtrlListenerAddress() handleVariableError(err, constants.ZitiCtrlListenerAddressVarName) // Get Ziti Controller Advertised Address - zitiCtrlAdvertisedAddress, err := helpers2.GetZitiCtrlAdvertisedAddress() + zitiCtrlAdvertisedAddress, err := cmdHelper.GetZitiCtrlAdvertisedAddress() handleVariableError(err, constants.ZitiCtrlAdvertisedAddressVarName) // Get Ziti Controller Port - zitiCtrlPort, err := helpers2.GetZitiCtrlPort() + zitiCtrlPort, err := cmdHelper.GetZitiCtrlPort() handleVariableError(err, constants.ZitiCtrlPortVarName) // Get Ziti Edge Controller Listener Host and Port - zitiEdgeCtrlListenerHostPort, err := helpers2.GetZitiEdgeCtrlListenerHostPort() + zitiEdgeCtrlListenerHostPort, err := cmdHelper.GetZitiEdgeCtrlListenerHostPort() handleVariableError(err, constants.ZitiEdgeCtrlListenerHostPortVarName) // Get Ziti Edge Controller Advertised Host and Port - zitiEdgeCtrlAdvertisedHostPort, err := helpers2.GetZitiEdgeCtrlAdvertisedHostPort() + zitiEdgeCtrlAdvertisedHostPort, err := cmdHelper.GetZitiEdgeCtrlAdvertisedHostPort() handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedHostPortVarName) // Get Ziti Edge Controller Advertised Port - zitiEdgeCtrlAdvertisedPort, err := helpers2.GetZitiEdgeCtrlAdvertisedPort() + zitiEdgeCtrlAdvertisedPort, err := cmdHelper.GetZitiEdgeCtrlAdvertisedPort() handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedPortVarName) // Get Ziti edge Identity enrollment duration - zitiEdgeIdentityEnrollmentDuration, err := helpers2.GetZitiEdgeIdentityEnrollmentDuration() + zitiEdgeIdentityEnrollmentDuration, err := cmdHelper.GetZitiEdgeIdentityEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeIdentityEnrollmentDurationVarName) // Get Ziti edge Router enrollment duration - zitiEdgeRouterEnrollmentDuration, err := helpers2.GetZitiEdgeRouterEnrollmentDuration() + zitiEdgeRouterEnrollmentDuration, err := cmdHelper.GetZitiEdgeRouterEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeRouterEnrollmentDurationVarName) - zitiEdgeRouterListenerBindPort, err := cmdhelper.GetZitiEdgeRouterListenerBindPort() + zitiEdgeRouterListenerBindPort, err := cmdHelper.GetZitiEdgeRouterListenerBindPort() handleVariableError(err, constants.ZitiEdgeRouterListenerBindPortVarName) data.ZitiHome = zitiHome