Merge pull request #1243 from openziti/release-next

Release 0.30.0
This commit is contained in:
Paul Lorenz
2023-08-10 13:17:44 -04:00
committed by GitHub
101 changed files with 1289 additions and 2339 deletions
+44
View File
@@ -0,0 +1,44 @@
name: golangci-lint
on:
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20.x'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.53.3
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
args: --build-tags apitests
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
+14
View File
@@ -270,6 +270,20 @@ jobs:
name: windows-release-${{ github.run_id }}
path: release/
- name: List downloaded release artifacts
run: |
ls -lAhR release/
- name: Restore execute filemode on macOS and Linux release artifacts before publishing
run: |
find ./release \
-type f \
-print0 \
-path "./release/*/darwin/ziti" \
-o \
-path "./release/*/linux/ziti" \
| xargs -0 chmod -c +x
- name: Install Jfrog CLI
uses: jfrog/setup-jfrog-cli@v3
with:
+4
View File
@@ -0,0 +1,4 @@
run:
deadline: 8m
skip-files:
- ziti/cmd/edge/verify_ca.go
+196
View File
@@ -1,3 +1,199 @@
# Release 0.30.0
## What's New
* Link management is now delegated to routers
* Controller and routers can operate with a single listening port
## Link Management Updates
Previously, the controller would do its best to determine where links needed to be established.
It would send messages to the routers, telling them which addresses to dial on other routes.
The routers would in turn let the controller know if link establishment was successful or
if the router already had a link to the given endpoint.
With this release, the controller will only let routers know which routers exist, whether they
are currently connected to the controller, and what link listeners they are advertising. The
routers will now decide which links to make and let the controllers know as links are created
and broken.
### Link Groups
Both dialers and listeners can now specify a set of groups. If no groups are specified, the
dialer or listener will be placed in the `default` group. Dialers will only attempt to dial
listeners who have at least one group in common with them.
### Failed Links
Previously when a link failed, the controller would show it in the link list as failed for a time
before removing it. Now failed links are removed immediately. There are existing link events for
link creation and link failure which can be used for forensics.
### Duplicate Links
There is a new link status `Duplicate` used when a router receives a link request and determines
that it's a duplicate of an existing link. This happens when two routers both have listeners
and dialers. They will often dial each other at the same time, resulting in a duplicate link.
### Compatibility
If you use a 0.30+ controller with older routers, the controller will still do link calculation
and send dial messages, as long as the `enableLegacyLinkMgmt` setting is set to true.
If you use a pre 0.30.0 controller with newer routers, the new routers will still accept the
dial messages.
### New Configuration
#### Controller
The controller has three new options:
```
network:
routerMessaging:
queueSize: 100
maxWorkers: 100
enableLegacyLinkMgmt: true
```
When a router connects or disconnects from the controller, we send two sets of updates.
1. If a router has connected we send it the the state of the other routers
1. We send all the other routers the updated state of the connecting/disconnecting router
These messages are sent using a worker pool. The size of the queue feeding the worker pool is controlled with
`routerMessaging.queueSize`. The max size of the worker pool is controlled used the `routerMessaging.maxWorkers`
option.
* queueSize
* Min value: 0
* Max value: 1,000,000
* Default: 100
* maxWorkers
* Min value: 1
* Max value: 10,000
* Default: 100
If you have routers older than 0.30.0, the controller will calculate which links to dial. This can be disabled
by setting `enableLegacyLinkMgmt` to false. This setting currently defaults to true, but will default to false
in a future release. In a subsequent release this functionality will be removed all together.
#### Router
The router has new configuration options for link dialing.
```
link:
dialers:
- binding: transport
groups:
- public
- vpc1234
healthyDialBackoff:
retryBackoffFactor: 1.5
minRetryInterval: 5s
maxRetryInterval: 5m
unhealthyDialBackoff:
retryBackoffFactor: 10
minRetryInterval: 1m
maxRetryInterval: 1h
listeners:
- binding: transport
groups: vpc1234
```
**Groups**
See above for a description of link groups work.
Default value: `default`
**Dial Back-off**
Dialers can be configured with custom back-off behavior. Each dialer has a back-off policy for dialing
healthy routers (those that are connected to a controller) and a separate policy for unhealthy routers.
The back-off policies have the following attributes:
* minRetryInterval - duration specifying the minimum time between dial attempts
* Min value: 10ms
* Max value: 24h
* Default: 5s for healthy, 1m for unhealthy
* Format: Golang Durations, see: https://pkg.go.dev/maze.io/x/duration#ParseDuration
* maxRetryInterval - duration specifying the maximum time between dial attempts
* Min value: 10ms
* Max value: 24h
* Default: 5m for healthy, 1h for unhealthy
* Format: Golang duration, see: https://pkg.go.dev/maze.io/x/duration#ParseDuration
* retryBackoffFactor - factor by which to increase the retry interval between failed dial attempts
* Min value: 1
* Max value: 100
* Default: 1.5 for healthy, 100 for unhealthy
## Single Sort Changes
Ziti Controller and Routers can operate with a single open port. In order to implement this feature we use
ALPN ([Application Layer Protocol Negotiation](https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation))
TLS extension. It allows TLS client to request and TLS server to select appropriate application protocol handler during
TLS handshake.
### Protocol Details
The following protocol identifiers are defined:
| id | purpose |
| --------- | ------- |
| ziti-ctrl | Control plane connections |
| ziti-link | Fabric link connections |
| ziti-edge | Client SDK connection to Edge Routers |
Standard HTTP protocol identifiers (`h2`, `http/1.1`) are used for Controller REST API and Websocket listeners.
### Backward Compatibility
This feature is designed to be backward compatible with SDK clients: older client will still be able to connect without
requesting `ziti-edge` protocol.
**Breaking**
Older routers won't be able to establish control channel or fabric links with updated network.
However, newer Edge Routers should be able to join older network in some circumstances -- only outbound links from new Routers would work.
## Component Updates and Bug Fixes
* github.com/openziti/agent: [v1.0.14 -> v1.0.15](https://github.com/openziti/agent/compare/v1.0.14...v1.0.15)
* github.com/openziti/channel/v2: [v2.0.84 -> v2.0.91](https://github.com/openziti/channel/compare/v2.0.84...v2.0.91)
* [Issue #108](https://github.com/openziti/channel/issues/108) - Reconnecting underlay not returning headers from hello message
* github.com/openziti/edge: [v0.24.364 -> v0.24.381](https://github.com/openziti/edge/compare/v0.24.364...v0.24.381)
* [Issue #1548](https://github.com/openziti/edge/issues/1548) - Panic in edge@v0.24.326/controller/sync_strats/sync_instant.go:194
* github.com/openziti/edge-api: [v0.25.30 -> v0.25.31](https://github.com/openziti/edge-api/compare/v0.25.30...v0.25.31)
* github.com/openziti/fabric: [v0.23.45 -> v0.24.2](https://github.com/openziti/fabric/compare/v0.23.45...v0.24.2)
* [Issue #766](https://github.com/openziti/fabric/issues/766) - Lookup of terminators with same instance id isn't filtering by instance id
* [Issue #692](https://github.com/openziti/fabric/issues/692) - Add ability to control link formation between devices more granularly
* [Issue #749](https://github.com/openziti/fabric/issues/749) - Move link control to router
* [Issue #343](https://github.com/openziti/fabric/issues/343) - Link state Failed on startup
* github.com/openziti/foundation/v2: [v2.0.28 -> v2.0.29](https://github.com/openziti/foundation/compare/v2.0.28...v2.0.29)
* github.com/openziti/identity: [v1.0.59 -> v1.0.60](https://github.com/openziti/identity/compare/v1.0.59...v1.0.60)
* github.com/openziti/runzmd: [v1.0.28 -> v1.0.29](https://github.com/openziti/runzmd/compare/v1.0.28...v1.0.29)
* github.com/openziti/sdk-golang: [v0.20.78 -> v0.20.90](https://github.com/openziti/sdk-golang/compare/v0.20.78...v0.20.90)
* github.com/openziti/storage: [v0.2.11 -> v0.2.12](https://github.com/openziti/storage/compare/v0.2.11...v0.2.12)
* github.com/openziti/transport/v2: [v2.0.93 -> v2.0.99](https://github.com/openziti/transport/compare/v2.0.93...v2.0.99)
* github.com/openziti/xweb/v2: [v2.0.2 -> v2.1.0](https://github.com/openziti/xweb/compare/v2.0.2...v2.1.0)
* github.com/openziti/ziti-db-explorer: [v1.1.1 -> v1.1.3](https://github.com/openziti/ziti-db-explorer/compare/v1.1.1...v1.1.3)
* [Issue #4](https://github.com/openziti/ziti-db-explorer/issues/4) - db explore timeout error is uninformative
* github.com/openziti/metrics: [v1.2.30 -> v1.2.31](https://github.com/openziti/metrics/compare/v1.2.30...v1.2.31)
* github.com/openziti/ziti: [v0.29.0 -> v0.30.0](https://github.com/openziti/ziti/compare/v0.29.0...v0.30.0)
* [Issue #1199](https://github.com/openziti/ziti/issues/1199) - ziti edge list enrollments - CLI gets 404
* [Issue #1135](https://github.com/openziti/ziti/issues/1135) - Edge Router: Support multiple protocols on the same listener port
* [Issue #65](https://github.com/openziti/ziti/issues/65) - Add ECDSA support to PKI subcmd
* [Issue #1212](https://github.com/openziti/ziti/issues/1212) - getZiti fails on Mac OS
* [Issue #1220](https://github.com/openziti/ziti/issues/1220) - Fixed getZiti function not respecting user input for custom path
# Release 0.29.0
## What's New
+46
View File
@@ -0,0 +1,46 @@
# Smoketest
The ziti project uses a fablab based environment to run smoketests. These tests are run
in github, but can be run locally as well.
## Running smoketests locally
First you must have an AWS account with permissions to create VPCs, setup security groups
and run EC2 instances. If you are able to the run the AWS CLI using an access key and
secret token, the smoketest should work as well.
The following steps assume you are starting at the root of a cloned `ziti` repository.
```
$ cd zititest
$ go install ./...
$ simple-transfer create
$ ZITI_VERSION=0.0.0 simple-transfer up
$ go test -v ./tests/...
$ simple-transfer dispose
```
## Debugging smoketests
When a smoketest runs in Github, the fablab instance data is uploaded to s3. This includes
everything need to work with the instance. If the smoketest run fails, the teardown will
be delayed by half of an hour. In that half of an hour the instance data can be downloaded
and the instance can be investigated. If you wish to prevent the instance from being
torn down by the workflow, you can delete the instance data out of S3 and take responsiblility
for cleaning it up yourself.
The instance data is encrypted and requires a passphrase to decrypt. Here's an example
script which can import a GH actions workflow instance into your local environment.
```
aws s3 cp s3://ziti-smoketest-fablab-instances/simple-transfer-$1.tar.gz.gpg ${HOME}/Downloads/simple-transfer-$1.tar.gz.gpg
FABLAB_PASSPHRASE=<passphrase goes here> simple-transfer import ${HOME}/Downloads/simple-transfer-$1.tar.gz.gpg
rm ${HOME}/Downloads/simple-transfer-$1.tar.gz.gpg
```
You would pass the workflow run number into the script. If you need the GPG passphrase, please ask.
To delete the instance data out of S3, you would run:
```
aws s3 rm s3://ziti-smoketest-fablab-instances/simple-transfer-$1.tar.gz.gpg
```
+5 -5
View File
@@ -22,7 +22,6 @@ import (
"github.com/openziti/identity/engines"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/ziti/ziti/cmd/common"
"io/ioutil"
"os"
"strings"
@@ -36,7 +35,6 @@ import (
// global state used by all subcommands are located here for easy discovery
const verboseDesc = "Enable verbose logging."
const outpathDesc = "Output configuration file."
const jwtpathDesc = "Enrollment token (JWT file). Required"
const certDesc = "The certificate to present when establishing a connection."
@@ -113,10 +111,12 @@ func NewEnrollCommand(p common.OptionsProvider) *cobra.Command {
enrollSubCmd.Flags().BoolVar(&action.RemoveJwt, "rm", false, "Remove the JWT on success")
enrollSubCmd.Flags().BoolVarP(&action.Verbose, "verbose", "v", false, "Enable verbose logging")
action.KeyAlg.Set("RSA") // set default
if err := action.KeyAlg.Set("RSA"); err != nil { // set default
panic(err)
}
enrollSubCmd.Flags().VarP(&action.KeyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key")
var keyDesc = ""
var keyDesc string
certEngines := engines.ListEngines()
if len(certEngines) > 0 {
keyDesc = fmt.Sprintf("The key to use with the certificate. Optionally specify the engine to use. supported engines: %v", certEngines)
@@ -153,7 +153,7 @@ func (e *EnrollAction) Run() error {
return fmt.Errorf("the output path must not be the same as the jwt path")
}
tokenStr, _ := ioutil.ReadFile(e.JwtPath)
tokenStr, _ := os.ReadFile(e.JwtPath)
pfxlog.Logger().Debugf("jwt to parse: %s", tokenStr)
tkn, _, err := enroll.ParseToken(string(tokenStr))
+2 -1
View File
@@ -129,7 +129,8 @@ func GetLatestGitHubReleaseAsset(appName string, appGitHub string, version strin
version = "tags/" + version
}
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancelF := context.WithTimeout(context.Background(), 10*time.Second)
defer cancelF()
resp, err := getRequest(verbose).
SetContext(ctx).
+2 -2
View File
@@ -89,8 +89,8 @@ You should now have a three node cluster running. You can log into each controll
You could then create some model data on any controller:
```
ziti learn demo setup echo client
ziti learn demo setup echo single-sdk-hosted
ziti demo setup echo client
ziti demo setup echo single-sdk-hosted
```
Any view the results on any controller
+7 -4
View File
@@ -66,13 +66,16 @@ There are now three new agent commands specific to the controller.
```shell
# Adding Members
ziti agent controller raft-join <other controller raft address>
ziti agent cluster add <other controller raft address>
# Listing Members
ziti agent controller raft-list
ziti agent cluster list
# Removing Members
ziti agent controller raft-remove <controller id>
ziti agent cluster remove <controller id>
# Transfer Leadership
ziti agent cluster transfer-leadership [new leader id]
```
#### Edge Admin Initialization
@@ -281,4 +284,4 @@ get more robust and distributed over time.
### Api Sessions, Sessions, Posture Data
API Sessions and Sessions are moving to bearer tokens. Posture Data is TBD.
API Sessions and Sessions are moving to bearer tokens. Posture Data is TBD.
+37 -42
View File
@@ -7,43 +7,41 @@ require (
github.com/Jeffail/gabs/v2 v2.7.0
github.com/MakeNowJust/heredoc v1.0.0
github.com/blang/semver v3.5.1+incompatible
github.com/docker/docker v20.10.24+incompatible
github.com/fatih/color v1.15.0
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa
github.com/go-acme/lego/v4 v4.2.0
github.com/go-openapi/runtime v0.26.0
github.com/go-openapi/strfmt v0.21.7
github.com/go-resty/resty/v2 v2.7.0
github.com/golang/protobuf v1.5.3
github.com/google/go-cmp v0.5.9
github.com/gorilla/websocket v1.5.0
github.com/jedib0t/go-pretty/v6 v6.4.0
github.com/michaelquigley/pfxlog v0.6.10
github.com/openziti/agent v1.0.14
github.com/openziti/channel/v2 v2.0.84
github.com/openziti/edge v0.24.364
github.com/openziti/edge-api v0.25.30
github.com/openziti/fabric v0.23.45
github.com/openziti/foundation/v2 v2.0.28
github.com/openziti/identity v1.0.59
github.com/openziti/runzmd v1.0.28
github.com/openziti/sdk-golang v0.20.78
github.com/openziti/storage v0.2.11
github.com/openziti/transport/v2 v2.0.93
github.com/openziti/xweb/v2 v2.0.2
github.com/openziti/ziti-db-explorer v1.1.1
github.com/openziti/agent v1.0.15
github.com/openziti/channel/v2 v2.0.91
github.com/openziti/edge v0.24.381
github.com/openziti/edge-api v0.25.31
github.com/openziti/fabric v0.24.2
github.com/openziti/foundation/v2 v2.0.29
github.com/openziti/identity v1.0.60
github.com/openziti/runzmd v1.0.29
github.com/openziti/sdk-golang v0.20.90
github.com/openziti/storage v0.2.12
github.com/openziti/transport/v2 v2.0.99
github.com/openziti/xweb/v2 v2.1.0
github.com/openziti/ziti-db-explorer v1.1.3
github.com/pkg/errors v0.9.1
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/russross/blackfriday v1.5.2
github.com/shirou/gopsutil/v3 v3.23.6
github.com/shirou/gopsutil/v3 v3.23.7
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.10.0
github.com/stretchr/testify v1.8.4
go.etcd.io/bbolt v1.3.7
golang.org/x/net v0.12.0
google.golang.org/grpc v1.56.2
golang.org/x/net v0.14.0
golang.org/x/text v0.12.0
google.golang.org/protobuf v1.31.0
gopkg.in/AlecAivazis/survey.v1 v1.8.7
gopkg.in/resty.v1 v1.12.0
@@ -56,7 +54,6 @@ 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.5 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect
@@ -73,8 +70,6 @@ require (
github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ef-ds/deque v1.0.4 // indirect
github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect
@@ -86,18 +81,20 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/errors v0.20.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/spec v0.20.9 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-openapi/validate v0.22.1 // 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-20230322041520-c84983bdbf2a // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/schema v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
@@ -123,7 +120,7 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
@@ -132,16 +129,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-20221120202655-abb19827d345 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/muhlemmer/gu v0.3.1 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // 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.3 // indirect
github.com/openziti/metrics v1.2.30 // indirect
github.com/openziti/metrics v1.2.31 // indirect
github.com/openziti/secretstream v0.1.10 // indirect
github.com/openziti/x509-claims v1.0.3 // indirect
github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect
@@ -153,6 +147,7 @@ require (
github.com/rabbitmq/amqp091-go v1.8.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rodaine/table v1.0.1 // indirect
github.com/rs/cors v1.9.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/speps/go-hashids v2.0.0+incompatible // indirect
@@ -161,7 +156,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
@@ -169,23 +164,23 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.mongodb.org/mongo-driver v1.12.0 // indirect
github.com/zitadel/oidc/v2 v2.7.0 // indirect
go.mongodb.org/mongo-driver v1.12.1 // indirect
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/image v0.9.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/image v0.11.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/appengine v1.6.7 // 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
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
+74 -81
View File
@@ -48,7 +48,6 @@ 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=
@@ -76,8 +75,6 @@ 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=
@@ -189,12 +186,6 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k
github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0=
github.com/dlclark/regexp2 v1.10.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.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE=
github.com/docker/docker v20.10.24+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.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -270,8 +261,9 @@ github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWL
github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
@@ -345,11 +337,10 @@ 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=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -365,6 +356,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -388,8 +380,8 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a h1:AWZzzFrqyjYlRloN6edwTLTUbKxf5flLXNuTBDm3Ews=
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 h1:uK3X/2mt4tbSGoHvbLBHUny7CKiuwUip3MArtukol4E=
github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -443,6 +435,10 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
@@ -554,8 +550,8 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI=
@@ -627,8 +623,8 @@ github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI=
github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0=
@@ -665,8 +661,6 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/mitchellh/mapstructure v1.4.1/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 h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -674,8 +668,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
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/muhlemmer/gu v0.3.1 h1:7EAqmFrW7n3hETvuAdmFmn4hS8W+z3LgKtrnow+YzNM=
github.com/muhlemmer/gu v0.3.1/go.mod h1:YHtHR+gxM+bKEIIs7Hmi9sPT3ZDUvTN/i88wQpZkrdM=
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=
@@ -705,50 +699,46 @@ 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.14 h1:OTYhj2HeIlFwaFNcVT5BlYf7s4xa0TNmhnjmBpN8Afg=
github.com/openziti/agent v1.0.14/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4=
github.com/openziti/channel/v2 v2.0.84 h1:bIdg2Z2SZan0HqSz2sbtY6Ibo33BH9Ir+qbuzyt9Rhs=
github.com/openziti/channel/v2 v2.0.84/go.mod h1:njjvl7YH6TfbJPbYxz6Y7+7uhv4Ea2GdLEJIcQOZMU8=
github.com/openziti/agent v1.0.15 h1:NW4egpS3Mw1RQBZWfUEvrmBh9kn/SU/dU5fndsyyhZ4=
github.com/openziti/agent v1.0.15/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4=
github.com/openziti/channel/v2 v2.0.91 h1:HKD7uniGOfiQfbzaP1AJ0JGvls7oejC+fMj6gLJOlW8=
github.com/openziti/channel/v2 v2.0.91/go.mod h1:2uJzEV3pX4soPPl07l8ScONNGuSQTQzUqAYkgATA3Rk=
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.364 h1:58X9C0CcmoEpAWkutxe49vW+Xf46h8iRlfVKXDaoDp0=
github.com/openziti/edge v0.24.364/go.mod h1:tKl9mG3dko3QQc1FQ1YUSF1B2KTW8MUcHMRezjbGiaU=
github.com/openziti/edge-api v0.25.30 h1:40pAcd3Y2yT8hYYHTJTkSTLA0pvbDCw4prt72JdQMuI=
github.com/openziti/edge-api v0.25.30/go.mod h1:ODMG0fB9Dj1pL0UqDC8jzSUAlUZy8aYhzF3xHPg6Xm0=
github.com/openziti/fabric v0.23.45 h1:TnPtN215KX5SBrWLzTVZLS1+xalVkpa+9kb+6U3YNl8=
github.com/openziti/fabric v0.23.45/go.mod h1:GijkTVVj4gUXlez2l+mdedCV15qP91YzX0EdM3tCSA8=
github.com/openziti/foundation/v2 v2.0.28 h1:AAdHhtUj1tCIXollSpbDlKwPKRasNAgADpTZAF1WCOQ=
github.com/openziti/foundation/v2 v2.0.28/go.mod h1:psKxxQw/zRo5+oKN7AR+MKYaeR3mbBPhb65qq8rqB0U=
github.com/openziti/identity v1.0.59 h1:YShXqxa9nTbCnPtIAji10hx7BG1nQukg4ddUJExNXa8=
github.com/openziti/identity v1.0.59/go.mod h1:9vQjDHH2Z3kFmkwmHsVKfI9EdcXjUiwAiR8Sc6Qzmbk=
github.com/openziti/edge v0.24.381 h1:8Uklh0w9+EFMhBkzDC7kFm0c09NAZbUHuLuWZekZY0M=
github.com/openziti/edge v0.24.381/go.mod h1:sFJbZLfBU2kFsc70LkzUW4eizZye9ejVMOtu8iI8pq8=
github.com/openziti/edge-api v0.25.31 h1:KiM4pQVIqy/0CN/FW2AgoN7PcejB+y8FdgjN86Jn83Q=
github.com/openziti/edge-api v0.25.31/go.mod h1:7fyXLqNcyC5IG29GuI8danhhppAaxRV6HiCLwN1Kk64=
github.com/openziti/fabric v0.24.2 h1:fb7fE/d3it6OrwhJqfr0RKQ41VUV9VKFsOOl98zdoRY=
github.com/openziti/fabric v0.24.2/go.mod h1:rXhb73v5rgoUV1AbRDXF8gAcbualabJU9YyLMkiB0yw=
github.com/openziti/foundation/v2 v2.0.29 h1:E63p5/esqOJ/OSMePR3fKYHb3Wq2BR4PLkDFynESij8=
github.com/openziti/foundation/v2 v2.0.29/go.mod h1:MpXSCSn4MABvtIXzfTBFqhK5pNsNXHWnR8xxVrfxn0g=
github.com/openziti/identity v1.0.60 h1:6gvBXY9J6F7SbuksdxsUA1t1WmtsFfY61Oqm/00ijGU=
github.com/openziti/identity v1.0.60/go.mod h1:pUfQ1Rf6TJvpBULXKPAO4014Qd6g+uf6V/vqjUscipU=
github.com/openziti/jwks v1.0.3 h1:hf8wkb+Cg4nH/HM0KROFd7u+C3DkRVcFZJ7tDV+4icc=
github.com/openziti/jwks v1.0.3/go.mod h1:t4xxq8vlXGsPn29kiQVnZBBDDnEoOFqtJoHibkJunQQ=
github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqkIQ=
github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ=
github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk=
github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw=
github.com/openziti/sdk-golang v0.20.78 h1:ts1AXB9rtja/pfnzsaUzojVUNtEDmtHrNLCrokbpBHQ=
github.com/openziti/sdk-golang v0.20.78/go.mod h1:t97RrYAaFq0mGHc08T5OVCnuNvqO4/ERDfXpUvDgN7U=
github.com/openziti/metrics v1.2.31 h1:nEO9FAqCnpfuvxGYfy9/W46p2SaEcZ6vlRyz4fcipoY=
github.com/openziti/metrics v1.2.31/go.mod h1:SU2w3WW36O+ocVy+ka2UHA0cweTg3T8CQiqz4ZT4Umc=
github.com/openziti/runzmd v1.0.29 h1:skS9Ea8TIYZ28V4yEz3KoWafnto4RAOwv8M2Z4bM8Wo=
github.com/openziti/runzmd v1.0.29/go.mod h1:rAvUIRGlIWYsHtWRX7lbV8LZPUjsifjZd72xUEfEuTw=
github.com/openziti/sdk-golang v0.20.90 h1:QXWa1Ti1Sky9D2uv3kAxmybwicZLJH6hgyDpXkdZcYc=
github.com/openziti/sdk-golang v0.20.90/go.mod h1:IorK7wik0unGAGBuYjdb9ZPFX7ENACtxFpWuTBPOT9Q=
github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04=
github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY=
github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE=
github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ=
github.com/openziti/transport/v2 v2.0.93 h1:CCADtZQki2gMtTYuGuNpxIVuWofxFIWmGbeRZp2MNTY=
github.com/openziti/transport/v2 v2.0.93/go.mod h1:a39vnp7P/ldeSegyRLwYLM+UrK1PjI6pryG3N+lKx6o=
github.com/openziti/storage v0.2.12 h1:ghQkt3SCLwRuiTeRLOUWgNL69XQNp9Gx8K3eVw0QTQY=
github.com/openziti/storage v0.2.12/go.mod h1:RxWIe9FyQg9LZQFZ4FuUROf0lhnfUW2XeWfTbHAMGeY=
github.com/openziti/transport/v2 v2.0.99 h1:+/DYNzaUrzSSaoKEBNFumXJsXMDEUNiWbWZfX48Z2vc=
github.com/openziti/transport/v2 v2.0.99/go.mod h1:bV9XKtxnmqW8crReZB2z+cJhSNLl6EsyoouTkyUY8mk=
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=
github.com/openziti/xweb/v2 v2.0.2/go.mod h1:KQOOlnJk08EZT3TWkvDj/pbIUEVbgG0IrrNzl8gsi40=
github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw=
github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4=
github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4=
github.com/openziti/xweb/v2 v2.1.0/go.mod h1:wPkjm5y45RYCV8AafjcAXP/ZM4DBOofXhRwSGgjF8w8=
github.com/openziti/ziti-db-explorer v1.1.3 h1:9JER16MJzagtYPdGEhgDcw2p/BXNCVbf9IgA/sMB52w=
github.com/openziti/ziti-db-explorer v1.1.3/go.mod h1:pMIMNJoTRSTbkO2e7cZWiBokA3jMdeiGAILP3QhU+v8=
github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c=
github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM=
@@ -828,6 +818,9 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE=
github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -836,8 +829,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb
github.com/sacloud/libsacloud v1.36.2/go.mod h1:P7YAOVmnIn3DKHqCZcUKYUXmSwGBm3yS7IBEjKVSrjg=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08=
github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU=
github.com/shirou/gopsutil/v3 v3.23.7 h1:C+fHO8hfIppoJ1WdsVm1RoI0RwXoNdfTK7yWXV0wVj4=
github.com/shirou/gopsutil/v3 v3.23.7/go.mod h1:c4gnmoRC0hQuaLqvxnx1//VXQ0Ms/X9UnJF8pddY5z4=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
@@ -934,8 +927,9 @@ github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cb
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 h1:3SNcvBmEPE1YlB1JpVZouslJpI3GBNoiqW7+wb0Rz7w=
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
@@ -980,6 +974,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/zitadel/oidc/v2 v2.7.0 h1:IGX4EDk6tegTjUSsZDWeTfLseFU0BdJ/Glf1tgys2lU=
github.com/zitadel/oidc/v2 v2.7.0/go.mod h1:zkUkVJS0sDVy9m0UA9RgO3f8i/C0rtjvXU36UJj7T+0=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
@@ -989,8 +985,8 @@ go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsX
go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg=
go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng=
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak=
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk=
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
@@ -1047,8 +1043,8 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh
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.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
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=
@@ -1059,14 +1055,14 @@ 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-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
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=
golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g=
golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0=
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -1151,8 +1147,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -1167,6 +1163,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8=
golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI=
golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -1273,15 +1271,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1294,13 +1292,12 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
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=
@@ -1404,6 +1401,7 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
@@ -1450,8 +1448,6 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
@@ -1476,8 +1472,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1517,8 +1511,9 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL
gopkg.in/ns1/ns1-go.v2 v2.4.2/go.mod h1:GMnKY+ZuoJ+lVLL+78uSTjwTz2jMazq6AfGKQOYhsPk=
gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=
gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
@@ -1538,8 +1533,6 @@ 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=
+1
View File
@@ -1 +1,2 @@
ziti-bin
test/gotester.json
+2 -2
View File
@@ -9,8 +9,8 @@ ZITI_PWD=
# controller name, address/port information
ZITI_CTRL_NAME=ziti-controller
#ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=ziti-edge-controller
#ZITI_CTRL_ADVERTISED_ADDRESS=ziti-controller
ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=ziti-edge-controller
ZITI_CTRL_ADVERTISED_ADDRESS=ziti-controller
#ZITI_CTRL_EDGE_IP_OVERRIDE=10.10.10.10
#ZITI_CTRL_EDGE_ADVERTISED_PORT=8441
#ZITI_CTRL_ADVERTISED_PORT=8440
+9 -9
View File
@@ -2,14 +2,8 @@
. "${ZITI_SCRIPTS}/ziti-cli-functions.sh"
# wait for the controller to come online
_wait_for_controller
# after coming online, give the controller just a second to ramp up in case running via docker compose
sleep 1
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="ziti-edge-controller"; fi
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="3022"; fi
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="1280"; fi
if [[ "${ZITI_ROUTER_PORT-}" == "" ]]; then export ZITI_ROUTER_PORT="3022"; fi
if [[ "${ZITI_ROUTER_ROLES}" == "" ]]; then export ZITI_ROUTER_ROLES="${ZITI_ROUTER_NAME}"; fi
@@ -20,6 +14,12 @@ fi
. ${ZITI_HOME}/ziti.env
# wait for the controller to come online
_wait_for_controller
# after coming online, give the controller just a second to ramp up in case running via docker compose
sleep 1
if [[ "${_ZITI_ROUTER_NAME}" != "" ]]; then
export ZITI_ROUTER_NAME="${_ZITI_ROUTER_NAME}"
echo "ZITI_ROUTER_NAME set to: ${ZITI_ROUTER_NAME}"
@@ -27,9 +27,9 @@ fi
_UNIQUE_NAME="${ZITI_HOME}/${ZITI_ROUTER_NAME}-${HOSTNAME}.init"
if [ ! -f "${_UNIQUE_NAME}" ]; then
echo "system has not been initialized. initializing..."
ziti edge login ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}:${ZITI_CTRL_EDGE_ADVERTISED_PORT} -u $ZITI_USER -p $ZITI_PWD -y
"${ZITI_BIN_DIR-}/ziti" edge login ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}:${ZITI_CTRL_EDGE_ADVERTISED_PORT} -u $ZITI_USER -p $ZITI_PWD -y
echo "---------- Creating edge-router ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}...."
echo "---------- Creating edge-router ${ZITI_ROUTER_NAME}...."
if [[ "$1" == "edge" ]]; then
echo "CREATING EDGE ROUTER CONFIG: ${ZITI_ROUTER_NAME}"
+104 -25
View File
@@ -317,19 +317,20 @@ function setupEnvironment {
# Controller Values
if [[ "${ZITI_CTRL_NAME-}" == "" ]]; then export ZITI_CTRL_NAME="${ZITI_NETWORK}"; else echo "ZITI_CTRL_NAME overridden: ${ZITI_CTRL_NAME}"; fi
if [[ "${ZITI_CTRL_EDGE_NAME-}" == "" ]]; then export ZITI_CTRL_EDGE_NAME="${ZITI_NETWORK}-edge-controller"; else echo "ZITI_CTRL_EDGE_NAME overridden: ${ZITI_CTRL_EDGE_NAME}"; fi
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="1280"; else echo "ZITI_CTRL_EDGE_ADVERTISED_PORT overridden: ${ZITI_CTRL_EDGE_ADVERTISED_PORT}"; fi
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"; fi
if [[ "${ZITI_CTRL_BIND_ADDRESS-}" != "" ]]; then echo "ZITI_CTRL_BIND_ADDRESS overridden: ${ZITI_CTRL_BIND_ADDRESS}"; fi
if [[ "${ZITI_CTRL_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_ADVERTISED_ADDRESS}"; fi
if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi
if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi
if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi
if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_NAME}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_NAME}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi
if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi
if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi
if [[ "${ZITI_PKI_CTRL_CA-}" == "" ]]; then export ZITI_PKI_CTRL_CA="${ZITI_PKI}/cas.pem"; else echo "ZITI_PKI_CTRL_CA overridden: ${ZITI_PKI_CTRL_CA}"; fi
if [[ "${ZITI_PKI_CTRL_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-client.cert"; else echo "ZITI_PKI_CTRL_CERT overridden: ${ZITI_PKI_CTRL_CERT}"; fi
if [[ "${ZITI_PKI_CTRL_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-client.cert"; else echo "ZITI_PKI_CTRL_CERT overridden: ${ZITI_PKI_CTRL_CERT}"; fi
if [[ "${ZITI_PKI_EDGE_CERT-}" == "" ]]; then export ZITI_PKI_EDGE_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-client.cert"; else echo "ZITI_PKI_EDGE_CERT overridden: ${ZITI_PKI_EDGE_CERT}"; fi
if [[ "${ZITI_PKI_EDGE_SERVER_CERT}" == "" ]]; then export ZITI_PKI_EDGE_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_EDGE_SERVER_CERT overridden: ${ZITI_PKI_EDGE_SERVER_CERT}"; fi
if [[ "${ZITI_PKI_EDGE_KEY}" == "" ]]; then export ZITI_PKI_EDGE_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_EDGE_KEY overridden: ${ZITI_PKI_EDGE_KEY}"; fi
@@ -338,7 +339,7 @@ function setupEnvironment {
# Router Values
if [[ "${ZITI_ROUTER_NAME-}" == "" ]]; then export ZITI_ROUTER_NAME="${ZITI_NETWORK}-edge-router"; else echo "ZITI_ROUTER_NAME overridden: ${ZITI_ROUTER_NAME}"; fi
if [[ "${ZITI_ROUTER_PORT-}" == "" ]]; then export ZITI_ROUTER_PORT="3022"; else echo "ZITI_ROUTER_PORT overridden: ${ZITI_ROUTER_PORT}"; fi
if [[ "${ZITI_ROUTER_LISTENER_BIND_PORT-}" == "" ]]; then export ZITI_ROUTER_LISTENER_BIND_PORT="8444"; else echo "ZITI_ROUTER_LISTENER_BIND_PORT overridden: ${ZITI_ROUTER_LISTENER_BIND_PORT}"; fi
if [[ "${ZITI_ROUTER_LISTENER_BIND_PORT-}" == "" ]]; then export ZITI_ROUTER_LISTENER_BIND_PORT="10080"; else echo "ZITI_ROUTER_LISTENER_BIND_PORT overridden: ${ZITI_ROUTER_LISTENER_BIND_PORT}"; fi
if [[ "${EXTERNAL_DNS-}" != "" ]]; then export ZITI_ROUTER_ADVERTISED_HOST="${EXTERNAL_DNS}"; fi
# Set up directories
@@ -601,11 +602,11 @@ function getZiti {
default_path="${ZITI_HOME}/ziti-bin/ziti-${ZITI_BINARIES_VERSION}"
echo -en "The path for ziti binaries has not been set, use the default (${default_path})? (Y/n) "
read -r reply
if [[ -z "${reply}" || ${reply} =~ [yY]* ]]; then
if [[ -z "${reply}" || ${reply} =~ [yY] ]]; then
echo "INFO: using the default path ${default_path}"
ZITI_BIN_DIR="${default_path}"
else
echo -en "Enter the preferred path and press <enter> (the path will be created if necessary) "
echo -en "Enter the preferred fully qualified path and press <enter> (the path will be created if necessary) "
read -r ZITI_BIN_DIR
fi
fi
@@ -649,7 +650,7 @@ function getZiti {
echo -e "ziti found in ZITI_BIN_DIR ($(BLUE "${ZITI_BIN_DIR}"))"
# Get the current version and compare with latest
local currentVersion
currentVersion="$("${ZITI_BIN_DIR}"/ziti --version) "
currentVersion="$("${ZITI_BIN_DIR}"/ziti --version)"
if [[ "${ZITI_BINARIES_VERSION}" != "${currentVersion}" ]]; then
# Prompt user for new download
echo -en "There is a newer version of OpenZiti, would you like to download it? (Y/n) "
@@ -695,11 +696,6 @@ function getZiti {
# Unzip the files
tar -xf "${ziti_binaries_file_abspath}" --directory "${ZITI_BIN_DIR}"
# Files unzip to a /ziti subdirectory, move them into ZITI_BIN_DIR
# Have to rename the directory first since 'ziti' matches the filename for the 'ziti' binary
mv "${ZITI_BIN_DIR}/ziti" "${ZITI_BIN_DIR}/ziti-extract"
mv "${ZITI_BIN_DIR}/ziti-extract"/* "${ZITI_BIN_DIR}"
# Cleanup
rm "${ziti_binaries_file_abspath}" # Remove zip
rm -rf "${ZITI_BIN_DIR}/ziti-extract" # Remove extract folder
@@ -733,15 +729,15 @@ function createPki {
_pki_create_intermediate "${ZITI_PKI_SIGNER_ROOTCA_NAME}" "${ZITI_SPURIOUS_INTERMEDIATE}" 2
_pki_create_intermediate "${ZITI_SPURIOUS_INTERMEDIATE}" "${ZITI_PKI_SIGNER_INTERMEDIATE_NAME}" 1
pki_allow_list_dns="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}"
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}" != "" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"; fi
if [[ "${EXTERNAL_DNS}" != "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${EXTERNAL_DNS}"; fi
echo " "
pki_allow_list="${ZITI_CTRL_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}"
pki_allow_list_ip="127.0.0.1"
if [[ "${ZITI_CTRL_EDGE_IP_OVERRIDE}" != "" ]]; then pki_allow_list_ip="${pki_allow_list_ip},${ZITI_EDGE_CONTROLLER_IP_OVERRIDE}"; fi
if [[ "${EXTERNAL_IP}" != "" ]]; then pki_allow_list_ip="${pki_allow_list_ip},${EXTERNAL_IP}"; fi
_pki_client_server "${pki_allow_list}" "${ZITI_PKI_CTRL_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_ADVERTISED_ADDRESS}"
pki_allow_list="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}"
pki_allow_list_ip="127.0.0.1"
_pki_client_server "${pki_allow_list}" "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"
pki_allow_list_dns="${pki_allow_list_dns},${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}"
_pki_client_server "${pki_allow_list_dns}" "${ZITI_PKI_CTRL_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"
echo -e "$(GREEN "PKI generated successfully")"
echo -e ""
}
@@ -1051,8 +1047,8 @@ function getLatestZitiVersion {
_detect_architecture
ziti_latest=$(curl -s https://${GITHUB_TOKEN:+${GITHUB_TOKEN}@}api.github.com/repos/openziti/ziti/releases/latest)
ZITI_BINARIES_FILE=$(echo "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.assets[] | select(.name | startswith("'"ziti-${ZITI_OSTYPE}-${ZITI_ARCH}-"'")) | .name')
ZITI_BINARIES_VERSION=$(echo "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.tag_name')
ZITI_BINARIES_FILE=$(printf "%s" "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.assets[] | select(.name | startswith("'"ziti-${ZITI_OSTYPE}-${ZITI_ARCH}-"'")) | .name')
ZITI_BINARIES_VERSION=$(printf "%s" "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.tag_name')
}
function createControllerSystemdFile {
@@ -1157,6 +1153,51 @@ HeredocForSystemd
echo -e "Router systemd file written to: $(BLUE "${output_file}")"
}
function createBrowZerSystemdFile {
local retVal output_file node_bin
_check_env_variable ZITI_HOME
retVal=$?
if [[ "${retVal}" != 0 ]]; then
return 1
fi
output_file="${ZITI_HOME}/browzer-bootstrapper.service"
if which node >/dev/null; then
# store the absolute path to the node executable because it's required by systemd on Amazon Linux, at least
node_bin=$(readlink -f "$(which node)")
else
echo "ERROR: missing executable 'node'" >&2
return 1
fi
_get_file_overwrite_permission "${output_file}"
retVal=$?
if [[ "${retVal}" != 0 ]]; then
return 1
fi
cat > "${output_file}" << HeredocForSystemd
[Unit]
Description=A systemd unit file for the Ziti BrowZer Bootstrapper
After=network.target
[Service]
User=root
EnvironmentFile=${ZITI_HOME}/browzer.env
WorkingDirectory=${ZITI_HOME}/ziti-http-agent
ExecStart=${node_bin} "${ZITI_HOME}/ziti-http-agent/index.js"
Restart=always
RestartSec=2
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
HeredocForSystemd
echo -e "Ziti BrowZer Bootstrapper systemd file written to: $(BLUE "${output_file}")"
}
function createControllerLaunchdFile {
local controller_name retVal output_file
# Allow controller name to be passed in as arg
@@ -1503,4 +1544,42 @@ function waitForController {
_wait_for_controller
}
function printUsage() {
echo "Usage: ${1-} [cert to test] [ca pool to use]"
}
function verifyCertAgainstPool() {
if [[ "" == "${1-}" ]]
then
printUsage "verifyCertAgainstPool"
return 1
fi
if [[ "" == "$2" ]]
then
printUsage "verifyCertAgainstPool"
return 1
fi
echo " Verifying that this certificate:"
echo " - ${1-}"
echo " is valid for this ca pool:"
echo " - $2"
echo ""
openssl verify -partial_chain -CAfile "$2" "${1-}"
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
echo ""
echo "============ SUCCESS! ============"
else
echo ""
echo "============ FAILED TO VALIDATE ============"
fi
}
function showIssuerAndSubjectForPEM() {
echo "Displaying Issuer and Subject for cert pool:"
echo " ${1-}"
openssl crl2pkcs7 -nocrl -certfile "${1-}" | openssl pkcs7 -print_certs -text -noout | grep -E "(Subject|Issuer)"
}
set +uo pipefail
+22 -133
View File
@@ -1,99 +1,35 @@
//go:build manual
package test
import (
"archive/tar"
"context"
"crypto/tls"
"crypto/x509"
"encoding/json"
"fmt"
"github.com/openziti/edge-api/rest_management_api_client"
api_client_config "github.com/openziti/edge-api/rest_management_api_client/config"
"github.com/openziti/edge-api/rest_management_api_client/edge_router"
"github.com/openziti/edge-api/rest_management_api_client/edge_router_policy"
"github.com/openziti/edge-api/rest_management_api_client/identity"
"github.com/openziti/edge-api/rest_management_api_client/service"
"github.com/openziti/edge-api/rest_management_api_client/service_edge_router_policy"
"github.com/openziti/edge-api/rest_management_api_client/service_policy"
"github.com/openziti/edge-api/rest_management_api_client/terminator"
"github.com/openziti/edge-api/rest_model"
"github.com/openziti/edge-api/rest_util"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/sdk-golang/ziti/enroll"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"io"
"net"
"net/http"
"os"
"strconv"
"strings"
"testing"
"time"
)
func iterateDir(dirPath string) []string {
dir, err := os.Open(dirPath)
if err != nil {
fmt.Println(err)
log.Fatal("Failed to parse ziti.ignore")
}
defer dir.Close()
fis, err := dir.Readdir(0)
if err != nil {
fmt.Println(err)
log.Fatal("Failed to read directory")
}
var filePaths []string
for _, fi := range fis {
curPath := dirPath + "/" + fi.Name()
if fi.IsDir() {
//TarGzWrite( curPath, tw, fi )
filePaths = append(filePaths, iterateDir(curPath)...)
} else {
filePaths = append(filePaths, curPath)
//err = addToTar(tw, curPath)
if err != nil {
fmt.Println(err)
log.Fatal("Failed add " + curPath)
}
//TarGzWrite( curPath, tw, fi )
}
}
return filePaths
}
func addFileToTarWriter(filePath string, tarWriter *tar.Writer) error {
file, err := os.Open(filePath)
if err != nil {
return errors.New(fmt.Sprintf("Could not open file '%s', got error '%s'", filePath, err.Error()))
}
defer file.Close()
stat, err := file.Stat()
if err != nil {
return errors.New(fmt.Sprintf("Could not get stat for file '%s', got error '%s'", filePath, err.Error()))
}
header := &tar.Header{
Name: filePath,
Size: stat.Size(),
Mode: int64(stat.Mode()),
ModTime: stat.ModTime(),
}
err = tarWriter.WriteHeader(header)
if err != nil {
return errors.New(fmt.Sprintf("Could not write header for file '%s', got error '%s'", filePath, err.Error()))
}
_, err = io.Copy(tarWriter, file)
if err != nil {
return errors.New(fmt.Sprintf("Could not copy the file '%s' data to the tarball, got error '%s'", filePath, err.Error()))
}
return nil
}
/*
This is a manually run test that will, with the default values except the admin password, confirm the docker-compose
ziti network is running as expected. The values can be edited to confirm other ziti networks but will require an http
@@ -119,13 +55,19 @@ func TestSimpleWebService(t *testing.T) {
if advPort == "" {
advPort = "1280"
}
ctrlAddress := "https://" + advAddy + ":" + advPort
erName := os.Getenv("ZITI_ROUTER_NAME")
if erName == "" {
erName = "ziti-edge-router"
}
hostingRouterName := "ziti-edge-router"
ctrlAddress := "https://" + advAddy + ":" + advPort
//bindHostAddress := os.Getenv("ZITI_QUICKSTART_TEST_ADDRESS")
//if bindHostAddress == "" {
// bindHostAddress = ctrlAddress
//}
hostingRouterName := erName
dialAddress := "simple.web.smoke.test"
dialPort := 80
bindHostAddress := "web-test-blue"
bindHostPort := 8000
serviceName := "basic.web.smoke.test.service"
wd, _ := os.Getwd()
@@ -178,13 +120,15 @@ func TestSimpleWebService(t *testing.T) {
defer func() { _ = deleteServiceConfigByID(client, dialSvcConfig.ID) }()
// Provide host config for the hostname
bindSvcConfig := createHostV1ServiceConfig(client, "basic.smoke.bind", "tcp", bindHostAddress, bindHostPort)
bindPort, _ := strconv.Atoi(advPort)
bindSvcConfig := createHostV1ServiceConfig(client, "basic.smoke.bind", "tcp", advAddy, bindPort)
defer func() { _ = deleteServiceConfigByID(client, bindSvcConfig.ID) }()
// Create a service that "links" the dial and bind configs
createService(client, serviceName, []string{bindSvcConfig.ID, dialSvcConfig.ID})
// Create a service policy to allow the router to host the web test service
fmt.Println("finding hostingRouterName: ", hostingRouterName)
hostRouterIdent := getIdentityByName(client, hostingRouterName)
webTestService := getServiceByName(client, serviceName)
defer func() { _ = deleteServiceByID(client, *webTestService.ID) }()
@@ -192,6 +136,7 @@ func TestSimpleWebService(t *testing.T) {
defer func() { _ = deleteServicePolicyByID(client, bindSP.ID) }()
// Create a service policy to allow tester to dial the service
fmt.Println("finding testerUsername: ", testerUsername)
testerIdent := getIdentityByName(client, testerUsername)
dialSP := createServicePolicy(client, "basic.web.smoke.test.service.dial", rest_model.DialBindDial, rest_model.Roles{"@" + *testerIdent.ID}, rest_model.Roles{"@" + *webTestService.ID})
defer func() { _ = deleteServicePolicyByID(client, dialSP.ID) }()
@@ -202,9 +147,10 @@ func TestSimpleWebService(t *testing.T) {
if !termCntReached {
fmt.Println("Unable to detect a terminator for the edge router")
}
helloUrl := fmt.Sprintf("http://%s:%d", serviceName, dialPort)
helloUrl := fmt.Sprintf("https://%s:%d", serviceName, dialPort)
log.Infof("created url: %s", helloUrl)
httpClient := createZitifiedHttpClient(wd + "/" + testerUsername + ".json")
resp, e := httpClient.Get(helloUrl)
if e != nil {
panic(e)
@@ -265,6 +211,7 @@ func createZitifiedHttpClient(idFile string) http.Client {
}
zitiTransport := http.DefaultTransport.(*http.Transport).Clone() // copy default transport
zitiTransport.DialContext = Dial //zitiDialContext.Dial
zitiTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
return http.Client{Transport: zitiTransport}
}
@@ -335,6 +282,7 @@ func getIdentityByName(client *rest_management_api_client.ZitiEdgeManagement, na
log.Fatalf("Could not obtain an ID for the identity named %s", name)
fmt.Println(err)
}
return resp.GetPayload().Data[0]
}
@@ -353,41 +301,6 @@ func getServiceByName(client *rest_management_api_client.ZitiEdgeManagement, nam
return resp.GetPayload().Data[0]
}
func getEdgeRouterByName(client *rest_management_api_client.ZitiEdgeManagement, name string) rest_model.EdgeRouterDetail {
filterValues := "name=\"" + name + "\""
listParams := &edge_router.ListEdgeRoutersParams{
Filter: &filterValues,
}
listParams.SetTimeout(30 * time.Second)
resp, err := client.EdgeRouter.ListEdgeRouters(listParams, nil)
if err != nil {
fmt.Println(err)
log.Fatal("Could not get edge router filtered by name")
}
return *resp.GetPayload().Data[0]
}
func createEdgeRouterPolicy(client *rest_management_api_client.ZitiEdgeManagement, name string, roles rest_model.Roles) service_edge_router_policy.CreateServiceEdgeRouterPolicyCreated {
defaultSemantic := rest_model.SemanticAllOf
serp := &rest_model.ServiceEdgeRouterPolicyCreate{
EdgeRouterRoles: roles,
Name: &name,
Semantic: &defaultSemantic,
ServiceRoles: roles,
}
serpParams := &service_edge_router_policy.CreateServiceEdgeRouterPolicyParams{
Policy: serp,
Context: context.Background(),
}
serpParams.SetTimeout(30 * time.Second)
resp, err := client.ServiceEdgeRouterPolicy.CreateServiceEdgeRouterPolicy(serpParams, nil)
if err != nil {
fmt.Println(err)
log.Fatal("Could not create service edge router policy")
}
return *resp
}
func createInterceptV1ServiceConfig(client *rest_management_api_client.ZitiEdgeManagement, name string, protocols []string, addresses []string, portRangeLow int, portRangeHigh int) rest_model.CreateLocation {
configTypeID := *getConfigTypeByName(client, "intercept.v1").ID
interceptData := map[string]interface{}{
@@ -517,30 +430,6 @@ func waitForTerminatorCountByRouterName(client *rest_management_api_client.ZitiE
return false
}
func deleteEdgeRouterPolicyByID(client *rest_management_api_client.ZitiEdgeManagement, id string) *edge_router_policy.DeleteEdgeRouterPolicyOK {
deleteParams := &edge_router_policy.DeleteEdgeRouterPolicyParams{
ID: id,
}
deleteParams.SetTimeout(30 * time.Second)
resp, err := client.EdgeRouterPolicy.DeleteEdgeRouterPolicy(deleteParams, nil)
if err != nil {
fmt.Println(err)
}
return resp
}
func deleteServiceEdgeRouterPolicyByID(client *rest_management_api_client.ZitiEdgeManagement, id string) *service_edge_router_policy.DeleteServiceEdgeRouterPolicyOK {
deleteParams := &service_edge_router_policy.DeleteServiceEdgeRouterPolicyParams{
ID: id,
}
deleteParams.SetTimeout(30 * time.Second)
resp, err := client.ServiceEdgeRouterPolicy.DeleteServiceEdgeRouterPolicy(deleteParams, nil)
if err != nil {
fmt.Println(err)
}
return resp
}
func deleteServiceConfigByID(client *rest_management_api_client.ZitiEdgeManagement, id string) *api_client_config.DeleteConfigOK {
deleteParams := &api_client_config.DeleteConfigParams{
ID: id,
-138
View File
@@ -1,138 +0,0 @@
// +build utils
/*
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 main
import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/sdk-golang/ziti"
"github.com/sirupsen/logrus"
"io"
"log"
"os"
"unicode"
)
func main() {
service := "data-maker"
pfxlog.Logger().Infof("args %v", os.Args)
if len(os.Args) > 1 {
service = os.Args[1]
}
pfxlog.Logger().Infof("Attempting to host service %v", service)
logrus.SetLevel(logrus.DebugLevel)
ztContext := ziti.NewContext()
listener, err := ztContext.Listen(service)
if err != nil {
log.Fatalf("failed to host service '%v': %v", service, err)
}
for {
conn, err := listener.Accept()
if err != nil {
panic(err)
}
fmt.Println("Connection received")
go respond(conn)
}
}
func respond(conn io.ReadWriteCloser) {
defer func() {
if err := conn.Close(); err != nil {
fmt.Printf("Error while closing connection: %v\n", err)
}
fmt.Println("Connection closed")
}()
for {
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Printf("Error while reading: %v\n", err)
break
}
fmt.Printf("Read %v bytes\n", n)
size := 0
sizeUnits := 'b'
cmd := string(buf[:n])
for _, ch := range cmd {
if unicode.IsDigit(ch) {
num := (int)(ch - '0')
size = size*10 + num
} else {
sizeUnits = ch
break
}
}
var writeBuf []byte
if size == 0 {
writeBuf = []byte("Did not understand input, please try again\n")
} else {
switch sizeUnits {
case 'b':
// already there
case 'k':
size = size * 1024
case 'm':
size = size * 1024 * 1024
default:
size = 0
writeBuf = []byte("Did not understand input, please use format <size><unit>. Ex: 1b or 10k or 2m\n")
}
}
if size > 0 {
writeBuf = make([]byte, size)
fill(writeBuf)
fmt.Printf("sending back %v.\n.Data length: %v\n", string(writeBuf), len(writeBuf))
}
if _, err := conn.Write(writeBuf); err != nil {
fmt.Printf("Error while writing: %v\n", err)
break
}
summaryBuf := []byte(fmt.Sprintf("\nWrote %v bytes\n", len(writeBuf)))
if _, err := conn.Write(summaryBuf); err != nil {
fmt.Printf("Error while writing: %v\n", err)
break
}
fmt.Printf("Wrote %v bytes\n", n)
}
}
func fill(buf []byte) {
for i := 0; i < len(buf); i++ {
if (i+1)%1024 == 0 {
k := (i + 1) / 1024
kBuf := []byte(fmt.Sprintf("%vk", k))
for j := 0; j < len(kBuf); j++ {
buf[i-j] = kBuf[len(kBuf)-(j+1)]
}
} else {
buf[i] = '.'
}
}
}
-69
View File
@@ -1,69 +0,0 @@
/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package test
import (
"github.com/openziti/identity"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"math/big"
"time"
)
const (
Hostname = "localhost"
)
func mkCert(cn string, dns []string) (*rsa.PrivateKey, *x509.Certificate) {
// key, _ := ecdsa.GenerateKey(elliptic.P224(), rand.Reader)
key, _ := rsa.GenerateKey(rand.Reader, 2048)
cert := &x509.Certificate{
SerialNumber: big.NewInt(169),
SignatureAlgorithm: x509.SHA256WithRSA,
DNSNames: dns,
NotBefore: time.Now().Add(-time.Hour),
NotAfter: time.Now().Add(time.Hour),
BasicConstraintsValid: true,
}
return key, cert
}
func CreateTestIdentity() (identity.Identity, error) {
// setup
key, cert := mkCert("Test Name", []string{Hostname})
certDER, err := x509.CreateCertificate(rand.Reader, cert, cert, key.Public(), key)
if err != nil {
return nil, err
}
keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)})
certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certDER})
cfg := identity.Config{
Key: "pem:" + string(keyPEM),
Cert: "pem:" + string(certPEM),
ServerCert: "pem:" + string(certPEM),
CA: "pem:" + string(certPEM),
}
return identity.LoadIdentity(cfg)
}
-150
View File
@@ -1,150 +0,0 @@
// +build utils
/*
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 main
import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/debugz"
"github.com/openziti/sdk-golang/ziti"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"io"
"math/rand"
"net"
"sync"
"sync/atomic"
)
func init() {
pfxlog.Global(logrus.InfoLevel)
pfxlog.SetPrefix("github.com/openziti/")
pfxlog.SetDefaultNoColor()
}
func init() {
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
root.PersistentFlags().Uint32VarP(&connCount, "connections", "c", 2, "Number of concurrent connections")
root.PersistentFlags().Uint32VarP(&iterations, "iterations", "i", 10, "Number of iterations")
root.Flags().SetInterspersed(true)
}
var root = &cobra.Command{
Use: "multi-conn-test <service>",
Short: "Multiplexed connection tester Ziti Application",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
switch logFormatter {
case "pfxlog":
logrus.SetFormatter(pfxlog.NewFormatterStartingToday())
case "json":
logrus.SetFormatter(&logrus.JSONFormatter{})
case "text":
logrus.SetFormatter(&logrus.TextFormatter{})
default:
// let logrus do its own thing
}
},
Args: cobra.RangeArgs(0, 1),
Run: runFunc,
}
var verbose bool
var logFormatter string
var connCount uint32
var iterations uint32
var iterCount uint32
var service = "echo"
var ztContext ziti.Context
var waitGroup sync.WaitGroup
func main() {
debugz.AddStackDumpHandler()
if err := root.Execute(); err != nil {
fmt.Printf("error: %s", err)
}
}
func runFunc(_ *cobra.Command, args []string) {
ztContext = ziti.NewContext()
if len(args) > 0 {
service = args[0]
}
var conns []net.Conn
waitGroup.Add(int(iterations))
for i := uint32(0); i < connCount; i++ {
conn, err := ztContext.Dial(service)
if err != nil {
panic(err)
}
conns = append(conns, conn)
}
for _, conn := range conns {
iteration := atomic.AddUint32(&iterCount, 1)
go runIteration(iteration, conn)
}
waitGroup.Wait()
}
func runIteration(iteration uint32, conn net.Conn) {
defer waitGroup.Done()
log := pfxlog.Logger()
log.Infof("Starting iteration %v", iteration)
bufferSize := 10 + rand.Int31n(1024)
writeBuf := make([]byte, bufferSize)
readBuf := make([]byte, bufferSize)
for i := 0; i < 10; i++ {
_, _ = rand.Read(writeBuf)
if _, err := conn.Write(writeBuf); err != nil {
panic(err)
}
if _, err := io.ReadFull(conn, readBuf); err != nil {
panic(err)
}
}
nextIteration()
}
func nextIteration() {
iteration := atomic.AddUint32(&iterCount, 1)
if iteration <= iterations {
conn, err := ztContext.Dial(service)
if err != nil {
panic(err)
}
runIteration(iteration, conn)
} else {
log := pfxlog.Logger()
log.Infof("Reached max iteration count, exiting")
}
}
-128
View File
@@ -1,128 +0,0 @@
// +build utils
/*
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 main
import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/debugz"
"github.com/openziti/sdk-golang/ziti"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"io"
)
func init() {
pfxlog.Global(logrus.InfoLevel)
pfxlog.SetPrefix("github.com/openziti/")
pfxlog.SetDefaultNoColor()
}
func init() {
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
root.Flags().SetInterspersed(true)
}
var root = &cobra.Command{
Use: "sdk-echo-server <service>",
Short: "Echos incoming data",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
switch logFormatter {
case "pfxlog":
logrus.SetFormatter(pfxlog.NewFormatterStartingToday())
case "json":
logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
case "text":
logrus.SetFormatter(&logrus.TextFormatter{})
default:
// let logrus do its own thing
}
},
Args: cobra.RangeArgs(0, 1),
Run: runFunc,
}
var verbose bool
var logFormatter string
func main() {
debugz.AddStackDumpHandler()
if err := root.Execute(); err != nil {
fmt.Printf("error: %s", err)
}
}
func runFunc(_ *cobra.Command, args []string) {
log := pfxlog.Logger()
ztContext := ziti.NewContext()
service := "echo"
if len(args) > 0 {
service = args[0]
log.Infof("Using service %v", service)
} else {
log.Infof("No service provided, using service %v: ", service)
}
listener, err := ztContext.Listen(service)
if err != nil {
log.Fatalf("failed to host service %v: %v", service, err)
}
for {
conn, err := listener.Accept()
if err != nil {
panic(err)
}
log.Infof("Connection received: %v", conn)
go echo(conn)
}
}
func echo(conn io.ReadWriteCloser) {
log := pfxlog.Logger().WithField("conn", conn)
defer func() {
if err := conn.Close(); err != nil {
log.WithError(err).Error("Error while closing connection")
}
log.Info("Connection closed")
}()
for {
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
log.WithError(err).Error("Error while reading")
break
}
log.Infof("Read %v bytes\n", n)
writeBuf := buf[:n]
if _, err := conn.Write(writeBuf); err != nil {
log.WithError(err).Error("Error while writing")
break
}
log.Infof("Wrote %v bytes\n", n)
}
}
-1
View File
@@ -1 +0,0 @@
Copied from https://github.com/fortio/fortio/tree/master/fgrpc under Apache License 2.0 https://github.com/fortio/fortio/blob/master/LICENSE
-119
View File
@@ -1,119 +0,0 @@
// +build utils
/*
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.
*/
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: ping.proto
package main
import proto "google.golang.org/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type PingMessage struct {
Seq int64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"`
Ts int64 `protobuf:"varint,2,opt,name=ts,proto3" json:"ts,omitempty"`
Payload string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
DelayNanos int64 `protobuf:"varint,4,opt,name=delayNanos,proto3" json:"delayNanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PingMessage) Reset() { *m = PingMessage{} }
func (m *PingMessage) String() string { return proto.CompactTextString(m) }
func (*PingMessage) ProtoMessage() {}
func (*PingMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_ping_ba7bbf995167e761, []int{0}
}
func (m *PingMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PingMessage.Unmarshal(m, b)
}
func (m *PingMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PingMessage.Marshal(b, m, deterministic)
}
func (dst *PingMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_PingMessage.Merge(dst, src)
}
func (m *PingMessage) XXX_Size() int {
return xxx_messageInfo_PingMessage.Size(m)
}
func (m *PingMessage) XXX_DiscardUnknown() {
xxx_messageInfo_PingMessage.DiscardUnknown(m)
}
var xxx_messageInfo_PingMessage proto.InternalMessageInfo
func (m *PingMessage) GetSeq() int64 {
if m != nil {
return m.Seq
}
return 0
}
func (m *PingMessage) GetTs() int64 {
if m != nil {
return m.Ts
}
return 0
}
func (m *PingMessage) GetPayload() string {
if m != nil {
return m.Payload
}
return ""
}
func (m *PingMessage) GetDelayNanos() int64 {
if m != nil {
return m.DelayNanos
}
return 0
}
func init() {
proto.RegisterType((*PingMessage)(nil), "fgrpc.PingMessage")
}
func init() { proto.RegisterFile("ping.proto", fileDescriptor_ping_ba7bbf995167e761) }
var fileDescriptor_ping_ba7bbf995167e761 = []byte{
// 160 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xc8, 0xcc, 0x4b,
0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4d, 0x4b, 0x2f, 0x2a, 0x48, 0x56, 0xca, 0xe4,
0xe2, 0x0e, 0x00, 0x0a, 0xfa, 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x09, 0x70, 0x31, 0x17,
0xa7, 0x16, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x81, 0x98, 0x42, 0x7c, 0x5c, 0x4c, 0x25,
0xc5, 0x12, 0x4c, 0x60, 0x01, 0x20, 0x4b, 0x48, 0x82, 0x8b, 0xbd, 0x20, 0xb1, 0x32, 0x27, 0x3f,
0x31, 0x45, 0x82, 0x19, 0x28, 0xc8, 0x19, 0x04, 0xe3, 0x0a, 0xc9, 0x71, 0x71, 0xa5, 0xa4, 0xe6,
0x24, 0x56, 0xfa, 0x25, 0xe6, 0xe5, 0x17, 0x4b, 0xb0, 0x80, 0x75, 0x20, 0x89, 0x18, 0xd9, 0x71,
0x71, 0x81, 0xac, 0x0a, 0x4e, 0x2d, 0x2a, 0x4b, 0x2d, 0x12, 0x32, 0xe0, 0x62, 0x01, 0xf1, 0x84,
0x84, 0xf4, 0xc0, 0x0e, 0xd1, 0x43, 0x72, 0x85, 0x14, 0x16, 0x31, 0x25, 0x86, 0x24, 0x36, 0xb0,
0xc3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x54, 0x22, 0xa0, 0xfe, 0xc6, 0x00, 0x00, 0x00,
}
-15
View File
@@ -1,15 +0,0 @@
// regenerate the .pb.go file after any change using
// protoc ping.proto --go_out=plugins=grpc:.
syntax = "proto3";
package fgrpc;
message PingMessage {
int64 seq = 1; // sequence number
int64 ts = 2; // src send ts / dest receive ts
string payload = 3; // extra packet data
int64 delayNanos = 4; // delay the response by x nanoseconds
}
service PingServer {
rpc Ping (PingMessage) returns (PingMessage) {}
}
@@ -1,169 +0,0 @@
// +build utils
/*
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 main
import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/debugz"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/sdk-golang/ziti/edge"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/reflection"
"time"
)
func init() {
pfxlog.Global(logrus.InfoLevel)
pfxlog.SetPrefix("github.com/openziti/")
pfxlog.SetDefaultNoColor()
}
func init() {
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
root.Flags().SetInterspersed(true)
}
var root = &cobra.Command{
Use: "zapp-fortio-grpc-server <service>",
Short: "Fortio GRPC Ping Server Ziti Application",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
switch logFormatter {
case "pfxlog":
logrus.SetFormatter(pfxlog.NewFormatterStartingToday())
case "json":
logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
case "text":
logrus.SetFormatter(&logrus.TextFormatter{})
default:
// let logrus do its own thing
}
},
Args: cobra.RangeArgs(0, 1),
Run: runFunc,
}
var verbose bool
var logFormatter string
func main() {
debugz.AddStackDumpHandler()
if err := root.Execute(); err != nil {
fmt.Printf("error: %s", err)
}
}
func runFunc(_ *cobra.Command, args []string) {
log := pfxlog.Logger()
ztContext := ziti.NewContext()
service := "fortio-grpc"
if len(args) > 0 {
service = args[0]
}
listener, err := ztContext.Listen(service)
if err != nil {
log.WithError(err).Fatalf("failed to host %v service", service)
}
grpcServer := grpc.NewServer()
reflection.Register(grpcServer)
grpcServer.RegisterService(&_PingServer_serviceDesc, &pingSrv{})
err = grpcServer.Serve(listener)
if err != nil {
log.WithError(err).Fatal("failed to start fortio grpc server")
}
}
type pingSrv struct {
}
type PingServerServer interface {
Ping(context.Context, *PingMessage) (*PingMessage, error)
}
var _PingServer_serviceDesc = grpc.ServiceDesc{
ServiceName: "fgrpc.PingServer",
HandlerType: (*PingServerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _PingServer_Ping_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ping.proto",
}
func _PingServer_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PingMessage)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PingServerServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/fgrpc.PingServer/Ping",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PingServerServer).Ping(ctx, req.(*PingMessage))
}
return interceptor(ctx, in, info, handler)
}
func (s *pingSrv) Ping(c context.Context, in *PingMessage) (*PingMessage, error) {
log := pfxlog.Logger()
var connId uint32
if p, ok := peer.FromContext(c); ok {
var msgChanIf interface{}
msgChanIf = p.Addr
if msgChan, ok := msgChanIf.(edge.Identifiable); ok {
connId = msgChan.Id()
} else {
log.Error("Unable to cast peer address to edge.MsgChannel")
}
} else {
log.Error("Unable to get peer from context")
}
log.WithField("connId", connId).Infof("Ping called %+v (ctx %+v)", *in, c)
out := *in // copy the input including the payload etc
out.Ts = time.Now().UnixNano()
if in.DelayNanos > 0 {
s := time.Duration(in.DelayNanos)
log.Debugf("GRPC ping: sleeping for %v", s)
time.Sleep(s)
}
return &out, nil
}
+1 -1
View File
@@ -1 +1 @@
0.29
0.30
+3 -3
View File
@@ -22,12 +22,12 @@ import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/fabric/router/xgress_transport"
"github.com/openziti/identity/dotziti"
"github.com/openziti/identity"
"github.com/openziti/identity/dotziti"
"github.com/openziti/transport/v2"
"github.com/openziti/ziti/ziti-fabric-test/subcmd"
"github.com/spf13/cobra"
"io/ioutil"
"io"
"net"
"net/http"
)
@@ -83,7 +83,7 @@ func doHttp(cmd *cobra.Command, args []string) {
request.Host = httpCmdHost
}
if response, err := c.Do(request); err == nil {
body, err := ioutil.ReadAll(response.Body)
body, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
+18 -20
View File
@@ -17,16 +17,16 @@
package loop2
import (
"github.com/openziti/ziti/ziti-fabric-test/subcmd/loop2/pb"
"github.com/openziti/foundation/v2/info"
"bytes"
"crypto/sha512"
"encoding/binary"
"encoding/hex"
"fmt"
"google.golang.org/protobuf/proto"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/info"
"github.com/openziti/ziti/ziti-fabric-test/subcmd/loop2/pb"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"io"
"math/rand"
"time"
@@ -89,29 +89,27 @@ func (p *protocol) txer(done chan bool) {
defer log.Debug("complete")
for p.txCount < p.test.TxRequests {
select {
case block := <-p.txGenerator.blocks:
if block != nil {
if err := p.txBlock(block); err == nil {
p.txCount++
block := <-p.txGenerator.blocks
if block != nil {
if err := p.txBlock(block); err == nil {
p.txCount++
if p.test.TxPacing > 0 {
jitter := 0
if p.test.TxMaxJitter > 0 {
jitter = rand.Intn(int(p.test.TxMaxJitter))
}
time.Sleep(time.Duration(int(p.test.TxPacing)+jitter) * time.Millisecond)
if p.test.TxPacing > 0 {
jitter := 0
if p.test.TxMaxJitter > 0 {
jitter = rand.Intn(int(p.test.TxMaxJitter))
}
} else {
log.Errorf("error sending block (%s)", err)
p.errors <- err
return
time.Sleep(time.Duration(int(p.test.TxPacing)+jitter) * time.Millisecond)
}
} else {
log.Errorf("tx blocks chan closed")
log.Errorf("error sending block (%s)", err)
p.errors <- err
return
}
} else {
log.Errorf("tx blocks chan closed")
return
}
}
+2 -2
View File
@@ -18,7 +18,7 @@ package loop2
import (
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
)
type Scenario struct {
@@ -43,7 +43,7 @@ type Test struct {
}
func LoadScenario(path string) (*Scenario, error) {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
+1 -1
View File
@@ -202,7 +202,7 @@ func (cmd *dialerCmd) connect() net.Conn {
}
}
ConnectionTime.Update(time.Now().Sub(start))
ConnectionTime.Update(time.Since(start))
return conn
}
+3 -3
View File
@@ -89,8 +89,8 @@ func (r *Result) Rx(p *protocol) error {
const (
BlockTypePlain byte = 1
BlockTypeLatencyRequest = 2
BlockTypeLatencyResponse = 3
BlockTypeLatencyRequest byte = 2
BlockTypeLatencyResponse byte = 3
)
type Block interface {
@@ -233,7 +233,7 @@ func (block *RandHashedBlock) Rx(p *protocol) error {
BytesRxRate.Mark(int64(8 + length))
if block.Type == BlockTypeLatencyResponse {
elapsed := time.Now().Sub(block.Timestamp)
elapsed := time.Since(block.Timestamp)
MsgLatency.Update(elapsed)
}
@@ -2,11 +2,11 @@ package loop3
import (
"bytes"
"crypto/rand"
"crypto/sha512"
"github.com/google/go-cmp/cmp"
loop3_pb "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop3/pb"
"github.com/stretchr/testify/require"
"math/rand"
"reflect"
"testing"
)
@@ -22,7 +22,8 @@ func (t *testPeer) Close() error {
func Test_MessageSerDeser(t *testing.T) {
req := require.New(t)
data := make([]byte, 4192)
rand.Read(data)
_, err := rand.Read(data)
req.NoError(err)
hash := sha512.Sum512(data)
@@ -50,7 +51,9 @@ func Test_MessageSerDeser(t *testing.T) {
req.True(reflect.DeepEqual(block, readBlock), cmp.Diff(block, readBlock))
data = make([]byte, 4192)
rand.Read(data)
_, err = rand.Read(data)
req.NoError(err)
hash = sha512.Sum512(data)
block = &RandHashedBlock{
+22 -24
View File
@@ -20,11 +20,11 @@ import (
"bytes"
"encoding/binary"
"fmt"
"google.golang.org/protobuf/proto"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/foundation/v2/info"
"github.com/openziti/ziti/ziti-fabric-test/subcmd/loop3/pb"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"io"
"math/rand"
"sync/atomic"
@@ -144,36 +144,34 @@ func (p *protocol) txer(done chan bool) {
time.Sleep(p.txPauseFor)
lastPause = time.Now()
}
select {
case block := <-p.blocks:
if block != nil {
if p.txPacing > 0 {
jitter := time.Duration(0)
if p.txMaxJitter > 0 {
jitter = time.Duration(rand.Intn(int(p.txMaxJitter)))
}
nextSend := lastSend.Add(p.txPacing + jitter)
if nextSend.After(now) {
time.Sleep(nextSend.Sub(now))
lastSend = nextSend
} else {
lastSend = now
}
block := <-p.blocks
if block != nil {
if p.txPacing > 0 {
jitter := time.Duration(0)
if p.txMaxJitter > 0 {
jitter = time.Duration(rand.Intn(int(p.txMaxJitter)))
}
block.PrepForSend(p)
if err := block.Tx(p); err == nil {
atomic.AddInt32(&p.txCount, 1)
nextSend := lastSend.Add(p.txPacing + jitter)
if nextSend.After(now) {
time.Sleep(nextSend.Sub(now))
lastSend = nextSend
} else {
log.Errorf("error sending block (%s)", err)
p.errors <- err
return
lastSend = now
}
}
block.PrepForSend(p)
if err := block.Tx(p); err == nil {
atomic.AddInt32(&p.txCount, 1)
} else {
log.Errorf("tx blocks chan closed")
log.Errorf("error sending block (%s)", err)
p.errors <- err
return
}
} else {
log.Errorf("tx blocks chan closed")
return
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ package loop3
import (
loop3_pb "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop3/pb"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"time"
)
@@ -108,7 +108,7 @@ type Metrics struct {
}
func LoadScenario(path string) (*Scenario, error) {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
+1 -1
View File
@@ -18,8 +18,8 @@ package agentcli
import (
"fmt"
"google.golang.org/protobuf/proto"
"github.com/golang/protobuf/proto"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/openziti/channel/v2"
"github.com/openziti/fabric/pb/mgmt_pb"
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"fmt"
"github.com/openziti/channel/v2"
"github.com/openziti/channel/v2/protobufs"
"github.com/openziti/edge/pb/edge_mgmt_pb"
"github.com/openziti/edge/common/pb/edge_mgmt_pb"
"github.com/openziti/ziti/ziti/cmd/common"
"github.com/spf13/cobra"
)
+4 -1
View File
@@ -105,7 +105,9 @@ func (self *AgentPsAction) Run() error {
fmt.Fprint(buf, p.Path)
fmt.Fprintln(buf)
buf.WriteTo(os.Stdout)
if _, err := buf.WriteTo(os.Stdout); err != nil {
return err
}
}
return nil
@@ -169,6 +171,7 @@ func FindAll() []P {
path, version, agent, ok, err := isGo(pr)
if err != nil {
// TODO(jbd): Return a list of errors.
return
}
if !ok {
return
-1
View File
@@ -76,7 +76,6 @@ func exitWithError(err error) {
// Execute is ...
func Execute() {
goflag.CommandLine.Parse([]string{})
if err := rootCommand.cobraCommand.Execute(); err != nil {
exitWithError(err)
}
-99
View File
@@ -1,99 +0,0 @@
/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package color
import (
"github.com/fatih/color"
"github.com/openziti/ziti/ziti/util"
"sort"
)
var colorMap = map[string]color.Attribute{
// formatting
"bold": color.Bold,
"faint": color.Faint,
"italic": color.Italic,
"underline": color.Underline,
"blinkslow": color.BlinkSlow,
"blinkrapid": color.BlinkRapid,
"reversevideo": color.ReverseVideo,
"concealed": color.Concealed,
"crossedout": color.CrossedOut,
// Foreground text colors
"black": color.FgBlack,
"red": color.FgRed,
"green": color.FgGreen,
"yellow": color.FgYellow,
"blue": color.FgBlue,
"magenta": color.FgMagenta,
"cyan": color.FgCyan,
"white": color.FgWhite,
// Foreground Hi-Intensity text colors
"hiblack": color.FgHiBlack,
"hired": color.FgHiRed,
"higreen": color.FgHiGreen,
"hiyellow": color.FgHiYellow,
"hiblue": color.FgHiBlue,
"himagenta": color.FgHiMagenta,
"hicyan": color.FgHiCyan,
"hiwhite": color.FgHiWhite,
// Background text colors
"bgblack": color.BgBlack,
"bgred": color.BgRed,
"bggreen": color.BgGreen,
"bgyellow": color.BgYellow,
"BgBlue": color.BgBlue,
"bgmagenta": color.BgMagenta,
"bgcyan": color.BgCyan,
"bgwhite": color.BgWhite,
// Background Hi-Intensity text colors
"bghiblack": color.BgHiBlack,
"bghired": color.BgHiRed,
"bghigreen": color.BgHiGreen,
"bghiyellow": color.BgHiYellow,
"bghiblue": color.BgHiBlue,
"bghimagenta": color.BgHiMagenta,
"bghicyan": color.BgHiCyan,
"bghiwhite": color.BgHiWhite,
}
// GetColor returns the color for the list of colour names and option name
func GetColor(optionName string, colorNames []string) (*color.Color, error) {
attributes := []color.Attribute{}
for _, colorName := range colorNames {
a := colorMap[colorName]
if a == color.Attribute(0) {
return nil, util.InvalidOption(optionName, colorName, ColorNameValues())
}
attributes = append(attributes, a)
}
return color.New(attributes...), nil
}
// ColorNameValues returns all the color names sorted
func ColorNameValues() []string {
answer := []string{}
for k, _ := range colorMap {
answer = append(answer, k)
}
sort.Strings(answer)
return answer
}
+6
View File
@@ -42,3 +42,9 @@ func (options *CommonOptions) AddCommonFlags(cmd *cobra.Command) {
cmd.Flags().IntVarP(&options.Timeout, "timeout", "t", 5, "Timeout for REST operations (specified in seconds)")
options.Cmd = cmd
}
func (options *CommonOptions) panicOnErr(err error) {
if err != nil {
panic(err)
}
}
+2 -3
View File
@@ -76,9 +76,8 @@ func (options *CommonOptions) GetFilter() *string {
return nil
}
func (options *CommonOptions) GetContext() context.Context {
ctx, _ := context.WithTimeout(context.Background(), time.Second*time.Duration(options.Timeout))
return ctx
func (options *CommonOptions) GetContext() (context.Context, func()) {
return context.WithTimeout(context.Background(), time.Second*time.Duration(options.Timeout))
}
func (options *CommonOptions) Printf(format string, args ...interface{}) {
-161
View File
@@ -1,161 +0,0 @@
/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"fmt"
"github.com/openziti/ziti/ziti/internal/log"
"github.com/openziti/ziti/ziti/util"
"io/ioutil"
"os"
"os/exec"
"strings"
)
var cliAgentEnabled bool
func (o *CommonOptions) startCommandFromDir(dir, name string, args ...string) error {
if cliAgentEnabled {
args = append(args, "--cliagent")
}
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
e.Stdout = o.Out
e.Stderr = o.Err
os.Setenv("PATH", util.PathWithBinary())
err := e.Start()
if err != nil {
log.Errorf("Error: Command failed %s/%s %s\n", dir, name, strings.Join(args, " "))
}
return err
}
func (o *CommonOptions) runCommandFromDir(dir, name string, args ...string) error {
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
e.Stdout = o.Out
e.Stderr = o.Err
os.Setenv("PATH", util.PathWithBinary())
err := e.Run()
if err != nil {
log.Errorf("Error: Command failed %s/%s %s\n", dir, name, strings.Join(args, " "))
}
return err
}
func (o *CommonOptions) runCommand(name string, args ...string) error {
e := exec.Command(name, args...)
if o.Verbose {
e.Stdout = o.Out
e.Stderr = o.Err
}
os.Setenv("PATH", util.PathWithBinary())
err := e.Run()
if err != nil {
log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " "))
}
return err
}
func (o *CommonOptions) runCommandVerbose(name string, args ...string) error {
e := exec.Command(name, args...)
e.Stdout = o.Out
e.Stderr = o.Err
os.Setenv("PATH", util.PathWithBinary())
err := e.Run()
if err != nil {
log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " "))
}
return err
}
func (o *CommonOptions) runCommandVerboseAt(dir string, name string, args ...string) error {
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
e.Stdout = o.Out
e.Stderr = o.Err
os.Setenv("PATH", util.PathWithBinary())
err := e.Run()
if err != nil {
log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " "))
}
return err
}
func (o *CommonOptions) runCommandQuietly(name string, args ...string) error {
e := exec.Command(name, args...)
e.Stdout = ioutil.Discard
e.Stderr = ioutil.Discard
os.Setenv("PATH", util.PathWithBinary())
return e.Run()
}
func (o *CommonOptions) runCommandInteractive(interactive bool, name string, args ...string) error {
e := exec.Command(name, args...)
e.Stdout = o.Out
e.Stderr = o.Err
if interactive {
e.Stdin = os.Stdin
}
os.Setenv("PATH", util.PathWithBinary())
err := e.Run()
if err != nil {
log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " "))
}
return err
}
func (o *CommonOptions) runCommandInteractiveInDir(interactive bool, dir string, name string, args ...string) error {
e := exec.Command(name, args...)
e.Stdout = o.Out
e.Stderr = o.Err
if interactive {
e.Stdin = os.Stdin
}
if dir != "" {
e.Dir = dir
}
os.Setenv("PATH", util.PathWithBinary())
err := e.Run()
if err != nil {
log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " "))
}
return err
}
// getCommandOutput evaluates the given command and returns the trimmed output
func (o *CommonOptions) getCommandOutput(dir string, name string, args ...string) (string, error) {
os.Setenv("PATH", util.PathWithBinary())
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
data, err := e.CombinedOutput()
text := string(data)
text = strings.TrimSpace(text)
if err != nil {
return "", fmt.Errorf("command failed '%s %s': %s %s", name, strings.Join(args, " "), text, err)
}
return text, err
}
-167
View File
@@ -1,167 +0,0 @@
/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"fmt"
c "github.com/openziti/ziti/ziti/constants"
"github.com/openziti/ziti/ziti/util"
"github.com/spf13/viper"
"gopkg.in/AlecAivazis/survey.v1"
"os"
"path/filepath"
)
var ZITI_COMPONENTS = []string{
c.ZITI,
c.ZITI_CONTROLLER,
c.ZITI_PROX_C,
c.ZITI_ROUTER,
c.ZITI_TUNNEL,
c.ZITI_EDGE_TUNNEL,
}
func (o *CommonOptions) GetZitiComponent(p string) (string, error) {
if p == "" {
prompt := &survey.Select{
Message: "Ziti Component",
Options: ZITI_COMPONENTS,
Default: c.ZITI,
Help: "Choose the Ziti component for which you want to do config initialization",
}
survey.AskOne(prompt, &p, nil)
}
return p, nil
}
func (o *CommonOptions) createInitialZitiConfig() error {
zitiConfigDir, err := util.ZitiAppConfigDir(c.ZITI)
if err != nil {
return err
}
_, err = util.EnvironmentsDir()
if err != nil {
return err
}
fileName := filepath.Join(zitiConfigDir, c.CONFIGFILENAME) + ".json"
_, err = os.Stat(fileName)
if err == nil {
return fmt.Errorf("config file (%s) already exists", fileName)
}
cfgfile, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644)
if err != nil {
return err
}
if err := cfgfile.Close(); err != nil {
return err
}
viper.SetConfigType("json")
viper.SetConfigName(c.CONFIGFILENAME)
viper.AddConfigPath(zitiConfigDir)
// Set some default values
viper.SetDefault("bin", util.HomeDir()+"/Repos/nf/ziti/bin")
// Capture AWS creds
awsAccessKey, err := util.PickPassword("AWS_ACCESS_KEY_ID:")
if err != nil {
return err
}
viper.SetDefault("AWS_ACCESS_KEY_ID", awsAccessKey)
awsSecretAccessKey, err := util.PickPassword("AWS_SECRET_ACCESS_KEY:")
if err != nil {
return err
}
viper.SetDefault("AWS_SECRET_ACCESS_KEY", awsSecretAccessKey)
err = viper.WriteConfig()
if err != nil {
return err
}
return nil
}
func (o *CommonOptions) createInitialControllerConfig() error {
configDir, err := util.ConfigDir()
if err != nil {
return err
}
controllerConfigDir, err := util.ZitiAppConfigDir(c.ZITI_CONTROLLER)
if err != nil {
return err
}
fileName := filepath.Join(controllerConfigDir, c.CONFIGFILENAME) + ".json"
_, err = os.Stat(fileName)
if err == nil {
return fmt.Errorf("config file (%s) already exists", fileName)
}
cfgfile, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644)
if err != nil {
return err
}
if err := cfgfile.Close(); err != nil {
return err
}
viper.SetConfigType("json")
viper.SetConfigName(c.CONFIGFILENAME)
viper.AddConfigPath(controllerConfigDir)
/*
{
"identity": {
"cert": "etc/ca/intermediate/certs/ctrl-client.cert.pem",
"server_cert": "etc/ca/intermediate/certs/ctrl-server.cert.pem",
"key": "etc/ca/intermediate/private/ctrl.key.pem",
"ca": "etc/ca/intermediate/certs/ca-chain.cert.pem"
},
"ctrlListener": "quic:0.0.0.0:6262",
"mgmtListener": "tls:0.0.0.0:10000",
"dbPath": "bin/ctrl.db"
}
*/
// Set some default values
viper.SetDefault("identity.cert", configDir+"/etc/ca/intermediate/certs/ctrl-client.cert.pem")
viper.SetDefault("identity.server_cert", configDir+"/etc/ca/intermediate/certs/ctrl-server.cert.pem")
viper.SetDefault("identity.key", configDir+"/etc/ca/intermediate/private/ctrl.key.pem")
viper.SetDefault("identity.ca", configDir+"/etc/ca/intermediate/certs/ca-chain.cert.pem")
viper.SetDefault("ctrlListener", "quic:0.0.0.0:6262")
viper.SetDefault("mgmtListener", "tls:0.0.0.0:10000")
viper.SetDefault("dbPath", "ctrl.db")
err = viper.WriteConfig()
if err != nil {
return err
}
return nil
}
-1
View File
@@ -69,7 +69,6 @@ var environmentOptions *CreateConfigEnvironmentOptions
type CreateConfigEnvironmentOptions struct {
CreateConfigOptions
EnvVariableTemplateData
output string
}
// NewCmdCreateConfigEnvironment creates a command object for the "environment" command
+11 -11
View File
@@ -82,17 +82,17 @@ type Transport struct {
}
type Ws struct {
writeTimeout int `yaml:"writeTimeout"`
readTimeout int `yaml:"readTimeout"`
idleTimeout int `yaml:"idleTimeout"`
pongTimeout int `yaml:"pongTimeout"`
pingInterval int `yaml:"pingInterval"`
handshakeTimeout int `yaml:"handshakeTimeout"`
readBufferSize int `yaml:"readBufferSize"`
writeBufferSize int `yaml:"writeBufferSize"`
enableCompression string `yaml:"enableCompression"`
server_cert string `yaml:"server_Cert"`
key string `yaml:"key"`
WriteTimeout int `yaml:"writeTimeout"`
ReadTimeout int `yaml:"readTimeout"`
IdleTimeout int `yaml:"idleTimeout"`
PongTimeout int `yaml:"pongTimeout"`
PingInterval int `yaml:"pingInterval"`
HandshakeTimeout int `yaml:"handshakeTimeout"`
ReadBufferSize int `yaml:"readBufferSize"`
WriteBufferSize int `yaml:"writeBufferSize"`
EnableCompression string `yaml:"enableCompression"`
Server_cert string `yaml:"server_Cert"`
Key string `yaml:"key"`
}
type Forwarder struct {
-19
View File
@@ -21,7 +21,6 @@ import (
"github.com/openziti/storage/boltz"
"github.com/spf13/cobra"
"go.etcd.io/bbolt"
"strings"
)
type DiskUsageAction struct {
@@ -114,12 +113,6 @@ func (self *sizeVisitor) VisitKeyValue(path string, key, value []byte) bool {
return true
}
func (self *sizeVisitor) getParent(path string) *sizeNode {
parentPath := self.getParentPath(path)
fmt.Printf("%v has parent %v\n", path, parentPath)
return self.getNode(parentPath)
}
func (self *sizeVisitor) getNode(path string) *sizeNode {
if path == "" {
return self.getNode("/")
@@ -133,15 +126,3 @@ func (self *sizeVisitor) getNode(path string) *sizeNode {
}
return node
}
func (self *sizeVisitor) getParentPath(path string) string {
idx := strings.LastIndexByte(path, '/')
if idx < 0 {
return path
}
parent := path[0:idx]
if parent == "" {
return "/"
}
return parent
}
-11
View File
@@ -17,7 +17,6 @@
package demo
import (
"bufio"
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/agent"
@@ -343,13 +342,3 @@ func (self *echoServer) SendOpResult(request *channel.Message, ch channel.Channe
log.WithError(err).Error("failed to send result")
}
}
func (self *echoServer) handleResult(err error, bconn *bufio.ReadWriter) error {
if err != nil {
return err
}
if _, err = bconn.WriteString("OK"); err != nil {
return err
}
return bconn.Flush()
}
+3 -4
View File
@@ -21,10 +21,9 @@ import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/api"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"github.com/pkg/errors"
"io"
"os"
"github.com/Jeffail/gabs"
"github.com/spf13/cobra"
@@ -76,7 +75,7 @@ func runCreateConfig(o *createConfigOptions) error {
return errors.New("config json specified both in file and on command line. please pick one")
}
var err error
if jsonBytes, err = ioutil.ReadFile(o.jsonFile); err != nil {
if jsonBytes, err = os.ReadFile(o.jsonFile); err != nil {
return fmt.Errorf("failed to read config json file %v: %w", o.jsonFile, err)
}
}
+3 -4
View File
@@ -21,10 +21,9 @@ import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/api"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"github.com/pkg/errors"
"io"
"os"
"github.com/Jeffail/gabs"
"github.com/spf13/cobra"
@@ -78,7 +77,7 @@ func runCreateConfigType(o *createConfigTypeOptions) error {
return errors.New("schema specified both in file and on command line. please pick one")
}
var err error
if schemaBytes, err = ioutil.ReadFile(o.schemaFile); err != nil {
if schemaBytes, err = os.ReadFile(o.schemaFile); err != nil {
return fmt.Errorf("failed to read schema file %v: %w", o.schemaFile, err)
}
}
-1
View File
@@ -45,7 +45,6 @@ func newCreateEnrollmentCmd(out io.Writer, errOut io.Writer) *cobra.Command {
type createEnrollmentOptions struct {
api.Options
name string
duration int64
}
+4 -1
View File
@@ -21,6 +21,8 @@ import (
"github.com/openziti/ziti/ziti/cmd/api"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/pkg/errors"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"io"
"math"
"os"
@@ -104,7 +106,8 @@ func newCreateIdentityOfTypeCmd(idType string, options *createIdentityOptions) *
func runCreateIdentity(idType string, o *createIdentityOptions) error {
entityData := gabs.New()
api.SetJSONValue(entityData, o.Args[0], "name")
api.SetJSONValue(entityData, strings.Title(idType), "type")
idType = cases.Title(language.English).String(idType)
api.SetJSONValue(entityData, idType, "type")
o.username = strings.TrimSpace(o.username)
if o.username != "" {
-1
View File
@@ -48,7 +48,6 @@ func newCreatePostureCheckCmd(out io.Writer, errOut io.Writer) *cobra.Command {
type createPostureCheckOptions struct {
api.EntityOptions
name string
roleAttributes []string
}
+3 -2
View File
@@ -29,7 +29,6 @@ type createServiceOptions struct {
terminatorStrategy string
roleAttributes []string
configs []string
requireEncryption bool
encryption encryptionVar
}
@@ -58,7 +57,9 @@ func newCreateServiceCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Role attributes of the new service")
cmd.Flags().StringSliceVarP(&options.configs, "configs", "c", nil, "Configuration id or names to be associated with the new service")
cmd.Flags().StringVar(&options.terminatorStrategy, "terminator-strategy", "", "Specifies the terminator strategy for the service")
options.encryption.Set("ON")
if err := options.encryption.Set("ON"); err != nil {
panic(err)
}
cmd.Flags().VarP(&options.encryption, "encryption", "e", "Controls end-to-end encryption for the service")
options.AddCommonFlags(cmd)
-4
View File
@@ -173,7 +173,3 @@ func getPlural(entityType string) string {
}
return entityType + "s"
}
func deleteEntityOfType(entityType string, id string, options *api.Options) error {
return util.ControllerDelete("edge", entityType, id, "", options.Out, options.OutputJSONRequest, options.OutputJSONResponse, options.Timeout, options.Verbose)
}
+1 -1
View File
@@ -31,7 +31,7 @@ func (f *encryptionVar) String() string {
func (f *encryptionVar) Set(value string) error {
value = strings.ToUpper(value)
if value != "ON" && value != "OFF" && value != "TRUE" && value != "FALSE" {
return errors.New("Invalid option -- must specify either 'ON' or 'OFF'")
return errors.New("invalid option -- must specify either 'ON' or 'OFF'")
}
*f = encryptionVar(value)
return nil
+1 -25
View File
@@ -684,37 +684,13 @@ func outputEnrollments(o *api.Options, children []*gabs.Container, pagingInfo *a
}
func runListEnrollments(o *api.Options) error {
children, pagingInfo, err := listEntitiesWithOptions("ext-jwt-signers", o)
children, pagingInfo, err := listEntitiesWithOptions("enrollments", o)
if err != nil {
return err
}
return outputEnrollments(o, children, pagingInfo)
}
func outputExtJwtSigners(o *api.Options, children []*gabs.Container, pagingInfo *api.Paging) error {
if o.OutputJSONResponse {
return nil
}
t := table.NewWriter()
t.SetStyle(table.StyleRounded)
t.AppendHeader(table.Row{"ID", "Method", "Identity Id", "Identity Name", "Expires At", "Token", "JWT"})
for _, entity := range children {
id, _ := entity.Path("id").Data().(string)
method := entity.Path("method").Data().(string)
identityId := entity.Path("identityId").Data().(string)
identityName := entity.Path("identity.name").Data().(string)
expiresAt := entity.Path("expiresAt").Data().(string)
token := entity.Path("token").Data().(string)
jwt := "See json"
t.AppendRow(table.Row{id, method, identityId, identityName, expiresAt, token, jwt})
}
api.RenderTable(o, t, pagingInfo)
return nil
}
func runListTerminators(o *api.Options) error {
children, pagingInfo, err := listEntitiesWithOptions("terminators", o)
if err != nil {
+3 -4
View File
@@ -21,10 +21,9 @@ import (
"fmt"
"github.com/openziti/ziti/ziti/cmd/api"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"github.com/pkg/errors"
"io"
"os"
"github.com/Jeffail/gabs"
"github.com/spf13/cobra"
@@ -93,7 +92,7 @@ func runUpdateConfig(o *updateConfigOptions) error {
return errors.New("only one of --data and --json-file is allowed")
}
var err error
if jsonBytes, err = ioutil.ReadFile(o.jsonFile); err != nil {
if jsonBytes, err = os.ReadFile(o.jsonFile); err != nil {
return fmt.Errorf("failed to read config json file %v: %w", o.jsonFile, err)
}
}
+3 -1
View File
@@ -62,7 +62,9 @@ func newUpdateServiceCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().StringVar(&options.terminatorStrategy, "terminator-strategy", "", "Specifies the terminator strategy for the service")
cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil,
"Set role attributes of the service. Use --role-attributes '' to set an empty list")
options.encryption.Set("ON")
if err := options.encryption.Set("ON"); err != nil {
panic(err)
}
cmd.Flags().VarP(&options.encryption, "encryption", "e", "Controls end-to-end encryption for the service")
cmd.Flags().StringSliceVarP(&options.configs, "configs", "c", nil, "Configuration id or names to be associated with the new service")
-7
View File
@@ -17,9 +17,7 @@
package edge
import (
"github.com/openziti/ziti/ziti/cmd/api"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/util"
"io"
"github.com/spf13/cobra"
@@ -41,8 +39,3 @@ func newVerifyCmd(out io.Writer, errOut io.Writer) *cobra.Command {
return cmd
}
// createEntityOfType create an entity of the given type on the Ziti Edge Controller
func verifyEntityOfType(entityType, body, id string, options *api.Options) error {
return util.EdgeControllerVerify(entityType, id, body, options.Out, options.OutputJSONResponse, options.Timeout, options.Verbose)
}
+28 -12
View File
@@ -21,6 +21,7 @@ import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
@@ -35,8 +36,8 @@ import (
"github.com/spf13/cobra"
"gopkg.in/resty.v1"
"io"
"io/ioutil"
"math/big"
"os"
"time"
)
@@ -85,7 +86,7 @@ func newVerifyCaCmd(out io.Writer, errOut io.Writer) *cobra.Command {
if options.certPath != "" {
var err error
options.certPemBytes, err = ioutil.ReadFile(options.certPath)
options.certPemBytes, err = os.ReadFile(options.certPath)
if err != nil {
return fmt.Errorf("could not read --cert file (%s): %v", options.certPath, err)
@@ -93,13 +94,13 @@ func newVerifyCaCmd(out io.Writer, errOut io.Writer) *cobra.Command {
options.isGenerateCert = false
} else if options.caCertPath != "" && options.caKeyPath != "" {
var err error
options.caKeyPemBytes, err = ioutil.ReadFile(options.caKeyPath)
options.caKeyPemBytes, err = os.ReadFile(options.caKeyPath)
if err != nil {
return fmt.Errorf("could not read --cakey file (%s): %v", options.caKeyPath, err)
}
options.caCertPemBytes, err = ioutil.ReadFile(options.caCertPath)
options.caCertPemBytes, err = os.ReadFile(options.caCertPath)
if err != nil {
return fmt.Errorf("could not read --cacert file (%s): %v", options.caCertPath, err)
@@ -165,7 +166,7 @@ func runValidateCa(options *verifyCaOptions) error {
func generateCert(options *verifyCaOptions, token string) ([]byte, crypto.Signer, error) {
certBlocks := nfpem.PemToX509(string(options.caCertPemBytes))
certBlocks := nfpem.PemStringToCertificates(string(options.caCertPemBytes))
if len(certBlocks) == 0 {
return nil, nil, errors.New("could not parse cert file, 0 PEM blocks detected1")
@@ -199,19 +200,34 @@ func generateCert(options *verifyCaOptions, token string) ([]byte, crypto.Signer
}
}
var signerInterface crypto.Signer
if caPrivateKeyBlock.Type == "EC PRIVATE KEY" {
signerInterface, err = x509.ParseECPrivateKey(caPrivateKeyBlock.Bytes)
} else {
signerInterface, err = x509.ParsePKCS1PrivateKey(caPrivateKeyBlock.Bytes)
var caKey crypto.Signer
switch caPrivateKeyBlock.Type {
case "EC PRIVATE KEY":
caKey, err = x509.ParseECPrivateKey(caPrivateKeyBlock.Bytes)
case "RSA PRIVATE KEY":
caKey, err = x509.ParsePKCS1PrivateKey(caPrivateKeyBlock.Bytes)
case "PRIVATE KEY":
key, err := x509.ParsePKCS8PrivateKey(caPrivateKeyBlock.Bytes)
if err != nil {
return nil, nil, fmt.Errorf("could not parse PKCS8 key file (%s)", err)
}
switch typedKey := key.(type) {
case *rsa.PrivateKey:
caKey = typedKey
case *ecdsa.PrivateKey:
caKey = typedKey
default:
return nil, nil, fmt.Errorf("unsupported private key parsed from PKCS8 %T", typedKey)
}
}
if err != nil {
return nil, nil, fmt.Errorf("could not parse key file (%s)", err)
}
caKey := signerInterface.(crypto.Signer)
if caKey == nil {
return nil, nil, fmt.Errorf("key was not of correct type, could not be used as signer")
}
+1 -1
View File
@@ -127,7 +127,7 @@ func (self *InspectAction) inspect(appRegex string, requestValues ...string) err
if idx > 0 {
fmt.Println()
}
fmt.Printf(color.New(color.FgGreen, color.Bold).Sprintf("%v.%v\n", appId, name))
fmt.Print(color.New(color.FgGreen, color.Bold).Sprintf("%v.%v\n", appId, name))
out = os.Stdout
}
if err = self.prettyPrint(out, value.Value, 0); err != nil {
+18 -5
View File
@@ -89,9 +89,11 @@ func newListCmdForEntityType(entityType string, command listCommandRunner, optio
func runListCircuits(o *api.Options) error {
return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error {
ctx, cancelF := o.GetContext()
defer cancelF()
result, err := client.Circuit.ListCircuits(&circuit.ListCircuitsParams{
//Filter: o.GetFilter(),
Context: o.GetContext(),
Context: ctx,
})
return outputResult(result, err, o, outputCircuits)
})
@@ -135,9 +137,11 @@ func outputCircuits(o *api.Options, results *circuit.ListCircuitsOK) error {
func runListLinks(o *api.Options) error {
return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error {
ctx, cancelF := o.GetContext()
defer cancelF()
result, err := client.Link.ListLinks(&link.ListLinksParams{
//Filter: o.GetFilter(),
Context: o.GetContext(),
Context: ctx,
})
return outputResult(result, err, o, outputLinks)
})
@@ -183,9 +187,12 @@ func outputLinks(o *api.Options, results *link.ListLinksOK) error {
func runListTerminators(o *api.Options) error {
return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error {
ctx, cancelF := o.GetContext()
defer cancelF()
result, err := client.Terminator.ListTerminators(&terminator.ListTerminatorsParams{
Filter: o.GetFilter(),
Context: o.GetContext(),
Context: ctx,
})
return outputResult(result, err, o, outputTerminators)
})
@@ -217,9 +224,12 @@ func outputTerminators(o *api.Options, result *terminator.ListTerminatorsOK) err
func runListServices(o *api.Options) error {
return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error {
ctx, cancelF := o.GetContext()
defer cancelF()
result, err := client.Service.ListServices(&service.ListServicesParams{
Filter: o.GetFilter(),
Context: o.GetContext(),
Context: ctx,
})
return outputResult(result, err, o, outputServices)
})
@@ -245,9 +255,12 @@ func outputServices(o *api.Options, result *service.ListServicesOK) error {
func runListRouters(o *api.Options) error {
return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error {
ctx, cancelF := o.GetContext()
defer cancelF()
result, err := client.Router.ListRouters(&router.ListRoutersParams{
Filter: o.GetFilter(),
Context: o.GetContext(),
Context: ctx,
})
return outputResult(result, err, o, outputRouters)
})
+4 -4
View File
@@ -192,13 +192,13 @@ func (self *streamTracesAction) DecodeTraceAndFormat(decode []byte) string {
out += k
out += "=["
v := meta[k]
switch v.(type) {
switch val := v.(type) {
case string:
out += v.(string)
out += val
case float64:
out += fmt.Sprintf("%0.0f", v.(float64))
out += fmt.Sprintf("%0.0f", val)
case bool:
out += fmt.Sprintf("%t", v.(bool))
out += fmt.Sprintf("%t", val)
default:
out += fmt.Sprintf("<%s>", reflect.TypeOf(v))
}
+2 -32
View File
@@ -19,38 +19,18 @@ package helpers
import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/pkg/errors"
"net/url"
"os"
"strings"
"github.com/spf13/cobra"
)
const (
DefaultErrorExitCode = 1
DefaultWritePermissions = 0760
)
type debugError interface {
DebugError() (msg string, args []interface{})
}
var fatalErrHandler = fatal
// BehaviorOnFatal allows you to override the default behavior when a fatal
// error occurs, which is to call os.Exit(code). You can pass 'panic' as a function
// here if you prefer the panic() over os.Exit(1).
func BehaviorOnFatal(f func(string, int)) {
fatalErrHandler = f
}
// DefaultBehaviorOnFatal allows you to undo any previous override. Useful in
// tests.
func DefaultBehaviorOnFatal() {
fatalErrHandler = fatal
}
// fatal prints the message (if provided) and then exits.
func fatal(msg string, code int) {
if len(msg) > 0 {
@@ -76,11 +56,6 @@ func CheckErr(err error) {
checkErr("", err, fatalErrHandler)
}
// checkErrWithPrefix works like CheckErr, but adds a caller-defined prefix to non-nil errors
func checkErrWithPrefix(prefix string, err error) {
checkErr(prefix, err, fatalErrHandler)
}
// checkErr formats a given error as a string and calls the passed handleErr
// func with that string and an kubectl exit code.
func checkErr(prefix string, err error, handleErr func(string, int)) {
@@ -166,14 +141,9 @@ func StandardErrorMessage(err error) (string, bool) {
return "", false
}
func UsageError(cmd *cobra.Command, format string, args ...interface{}) error {
msg := fmt.Sprintf(format, args...)
return fmt.Errorf("%s\nSee '%s -h' for help and examples.", msg, cmd.CommandPath())
}
func JFrogAPIKey() string {
if h := os.Getenv("JFROG_API_KEY"); h != "" {
return h
}
panic(fmt.Sprintf("ERROR: the JFROG_API_KEY env variable has not been set"))
panic(errors.New("ERROR: the JFROG_API_KEY env variable has not been set"))
}
-101
View File
@@ -17,13 +17,11 @@
package install
import (
"fmt"
"github.com/blang/semver"
"github.com/openziti/ziti/common/getziti"
c "github.com/openziti/ziti/ziti/constants"
"github.com/openziti/ziti/ziti/internal/log"
"github.com/openziti/ziti/ziti/util"
"gopkg.in/AlecAivazis/survey.v1"
"gopkg.in/resty.v1"
"os"
"os/exec"
@@ -32,50 +30,6 @@ import (
"strings"
)
// installRequirements installs any requirements needed to run the ziti CLI
func (o *InstallOptions) installRequirements(extraDependencies ...string) error {
var deps []string
for _, dep := range extraDependencies {
deps = o.addRequiredBinary(dep, deps)
}
return o.installMissingDependencies(deps)
}
func (o *InstallOptions) addRequiredBinary(binName string, deps []string) []string {
d := binaryShouldBeInstalled(binName)
if d != "" && util.StringArrayIndex(deps, d) < 0 {
deps = append(deps, d)
}
return deps
}
// appends the binary to the deps array if it cannot be found on the $PATH
func binaryShouldBeInstalled(d string) string {
_, err := exec.LookPath(d)
if err != nil {
// look for windows exec
if runtime.GOOS == "windows" {
d = d + ".exe"
_, err = exec.LookPath(d)
if err == nil {
return ""
}
}
binDir, err := util.BinaryLocation()
if err == nil {
exists, err := util.FileExists(filepath.Join(binDir, d))
if err == nil && exists {
return ""
}
}
log.Infof("%s not found\n", d)
return d
}
return ""
}
func isBinaryInstalled(d string) bool {
binDir, err := util.BinaryLocation()
if err == nil {
@@ -104,47 +58,6 @@ func (o *InstallOptions) deleteInstalledBinary(d string) bool {
return false
}
func (o *InstallOptions) installMissingDependencies(deps []string) error {
if len(deps) == 0 {
return nil
}
if o.BatchMode {
return fmt.Errorf("run without batch mode or manually install missing dependencies %v", deps)
}
install := []string{}
prompt := &survey.MultiSelect{
Message: "Installing required dependencies, deselect to avoid auto installing:",
Options: deps,
Default: deps,
}
survey.AskOne(prompt, &install, nil)
return o.doInstallMissingDependencies(install)
}
func (o *InstallOptions) doInstallMissingDependencies(install []string) error {
for _, i := range install {
var err error
switch i {
case "aws":
err = o.installAWSCli()
default:
return fmt.Errorf("unknown dependency to install %s", i)
}
if err != nil {
return fmt.Errorf("error installing %s: %v", i, err)
}
}
return nil
}
func (o *InstallOptions) installAWSCli() error {
return fmt.Errorf("Ziti's ability to auto-install the AWS CLI is curently un-implemented; For now, you must manually install the AWS CLI")
}
func (o *InstallOptions) shouldInstallBinary(binDir string, name string) (fileName string, download bool, err error) {
fileName = name
download = false
@@ -170,20 +83,6 @@ func (o *InstallOptions) shouldInstallBinary(binDir string, name string) (fileNa
return
}
func (o *InstallOptions) downloadFile(clientURL string, fullPath string) error {
log.Infof("Downloading %s to %s...\n", util.ColorInfo(clientURL), util.ColorInfo(fullPath))
err := util.DownloadFile(fullPath, clientURL)
if err != nil {
return fmt.Errorf("Unable to download file %s from %s due to: %v", fullPath, clientURL, err)
}
log.Infof("Downloaded %s\n", util.ColorInfo(fullPath))
return nil
}
func (o *InstallOptions) getLatestZitiVersion(branch string) (semver.Version, error) {
return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, c.ZITI)
}
func (o *InstallOptions) getLatestZitiAppVersion(branch string, zitiApp string) (semver.Version, error) {
return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, zitiApp)
}
@@ -86,6 +86,9 @@ func (o *InstallTerraformProviderEdgeControllerOptions) Run() error {
if o.Version != "" {
newVersion, err = semver.Make(o.Version)
if err != nil {
return err
}
}
log.Infoln("Attempting to install Terraform Provider '" + c.TERRAFORM_PROVIDER_EDGE_CONTROLLER + "' version: " + newVersion.String())
+3
View File
@@ -85,6 +85,9 @@ func (o *InstallZitiALLOptions) install(zitiApp string) error {
if o.Version != "" {
newVersion, err = semver.Make(o.Version)
if err != nil {
return err
}
}
log.Infoln("Attempting to install '" + zitiApp + "' version: " + newVersion.String())
@@ -85,6 +85,9 @@ func (o *InstallZitiControllerOptions) Run() error {
if o.Version != "" {
newVersion, err = semver.Make(o.Version)
if err != nil {
return err
}
}
log.Infoln("Attempting to install '" + c.ZITI_CONTROLLER + "' version: " + newVersion.String())
+3
View File
@@ -85,6 +85,9 @@ func (o *InstallZitiRouterOptions) Run() error {
if o.Version != "" {
newVersion, err = semver.Make(o.Version)
if err != nil {
return err
}
}
log.Infoln("Attempting to install '" + c.ZITI_ROUTER + "' version: " + newVersion.String())
+3
View File
@@ -85,6 +85,9 @@ func (o *InstallZitiTunnelOptions) Run() error {
if o.Version != "" {
newVersion, err = semver.Make(o.Version)
if err != nil {
return err
}
}
log.Infoln("Attempting to install '" + c.ZITI_TUNNEL + "' version: " + newVersion.String())
+22 -8
View File
@@ -72,8 +72,10 @@ func NewCmdVersion(out io.Writer, errOut io.Writer) *cobra.Command {
// Run ...
func (o *VersionOptions) Run() error {
util.ConfigDir()
_, err := util.ConfigDir()
if err != nil {
return err
}
info := util.ColorInfo
@@ -126,12 +128,24 @@ func (o *VersionOptions) versionPrintZitiApp(zitiApp string, table *table.Table)
}
func (o *VersionOptions) versionCheck() error {
o.versionCheckZitiApp(c.ZITI)
o.versionCheckZitiApp(c.ZITI_CONTROLLER)
o.versionCheckZitiApp(c.ZITI_PROX_C)
o.versionCheckZitiApp(c.ZITI_ROUTER)
o.versionCheckZitiApp(c.ZITI_TUNNEL)
o.versionCheckZitiApp(c.ZITI_EDGE_TUNNEL)
if err := o.versionCheckZitiApp(c.ZITI); err != nil {
return err
}
if err := o.versionCheckZitiApp(c.ZITI_CONTROLLER); err != nil {
return err
}
if err := o.versionCheckZitiApp(c.ZITI_PROX_C); err != nil {
return err
}
if err := o.versionCheckZitiApp(c.ZITI_ROUTER); err != nil {
return err
}
if err := o.versionCheckZitiApp(c.ZITI_TUNNEL); err != nil {
return err
}
if err := o.versionCheckZitiApp(c.ZITI_EDGE_TUNNEL); err != nil {
return err
}
return nil
}
+5 -20
View File
@@ -60,38 +60,23 @@ func (f *KeyTypeVar) Set(value string) error {
}
func (f *KeyTypeVar) EC256() bool {
if certcrypto.KeyType(*f) == certcrypto.EC256 {
return true
}
return false
return certcrypto.KeyType(*f) == certcrypto.EC256
}
func (f *KeyTypeVar) EC384() bool {
if certcrypto.KeyType(*f) == certcrypto.EC384 {
return true
}
return false
return certcrypto.KeyType(*f) == certcrypto.EC384
}
func (f *KeyTypeVar) RSA2048() bool {
if certcrypto.KeyType(*f) == certcrypto.RSA2048 {
return true
}
return false
return certcrypto.KeyType(*f) == certcrypto.RSA2048
}
func (f *KeyTypeVar) RSA4096() bool {
if certcrypto.KeyType(*f) == certcrypto.RSA4096 {
return true
}
return false
return certcrypto.KeyType(*f) == certcrypto.RSA4096
}
func (f *KeyTypeVar) RSA8192() bool {
if certcrypto.KeyType(*f) == certcrypto.RSA8192 {
return true
}
return false
return certcrypto.KeyType(*f) == certcrypto.RSA8192
}
func (f *KeyTypeVar) Get() certcrypto.KeyType {
+7 -7
View File
@@ -22,9 +22,7 @@ import (
"encoding/json"
"encoding/pem"
"errors"
"fmt"
"github.com/openziti/ziti/ziti/internal/log"
"io/ioutil"
"net/url"
"os"
"path/filepath"
@@ -132,11 +130,11 @@ func (s *AccountsStorage) Save(account *Account) error {
return err
}
return ioutil.WriteFile(s.accountFilePath, jsonBytes, filePerm)
return os.WriteFile(s.accountFilePath, jsonBytes, filePerm)
}
func (s *AccountsStorage) LoadAccount(options *leOptions, privateKey crypto.PrivateKey) *Account {
fileBytes, err := ioutil.ReadFile(s.accountFilePath)
fileBytes, err := os.ReadFile(s.accountFilePath)
if err != nil {
log.Fatalf("Could not load file for account %s: %v", s.userID, err)
}
@@ -183,7 +181,7 @@ func (s *AccountsStorage) GetPrivateKey(keyType certcrypto.KeyType) crypto.Priva
privateKey, err := loadPrivateKey(accKeyPath)
if err != nil {
log.Fatalf("Could not load RSA private key from file %s: %v", accKeyPath, err)
log.Fatalf("Could not load private key from file %s: %v", accKeyPath, err)
}
return privateKey
@@ -217,7 +215,7 @@ func generatePrivateKey(file string, keyType certcrypto.KeyType) (crypto.Private
}
func loadPrivateKey(file string) (crypto.PrivateKey, error) {
keyBytes, err := ioutil.ReadFile(file)
keyBytes, err := os.ReadFile(file)
if err != nil {
return nil, err
}
@@ -229,6 +227,8 @@ func loadPrivateKey(file string) (crypto.PrivateKey, error) {
return x509.ParsePKCS1PrivateKey(keyBlock.Bytes)
case "EC PRIVATE KEY":
return x509.ParseECPrivateKey(keyBlock.Bytes)
case "PRIVATE KEY":
return x509.ParsePKCS8PrivateKey(keyBlock.Bytes)
}
return nil, errors.New("unknown private key type")
@@ -238,7 +238,7 @@ func tryRecoverRegistration(options *leOptions, privateKey crypto.PrivateKey) (*
// couldn't load account but got a key. Try to look the account up.
config := lego.NewConfig(&Account{key: privateKey})
config.CADirURL = options.acmeserver
config.UserAgent = fmt.Sprintf("ziti-cli")
config.UserAgent = "ziti-cli"
client, err := lego.NewClient(config)
if err != nil {
+3 -7
View File
@@ -21,7 +21,6 @@ import (
"crypto/x509"
"encoding/json"
"github.com/openziti/ziti/ziti/internal/log"
"io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -165,7 +164,7 @@ func (s *CertificatesStorage) ExistsFile(domain, extension string) bool {
}
func (s *CertificatesStorage) ReadFile(domain, extension string) ([]byte, error) {
return ioutil.ReadFile(s.GetFileName(domain, extension))
return os.ReadFile(s.GetFileName(domain, extension))
}
func (s *CertificatesStorage) GetFileName(domain, extension string) string {
@@ -184,12 +183,9 @@ func (s *CertificatesStorage) ReadCertificate(domain, extension string) ([]*x509
}
func (s *CertificatesStorage) WriteFile(domain, extension string, data []byte) error {
var baseFileName string
baseFileName = sanitizedDomain(domain)
baseFileName := sanitizedDomain(domain)
filePath := filepath.Join(s.rootPath, baseFileName+extension)
return ioutil.WriteFile(filePath, data, filePerm)
return os.WriteFile(filePath, data, filePerm)
}
func (s *CertificatesStorage) MoveToArchive(domain string) error {
+9 -5
View File
@@ -30,8 +30,6 @@ import (
const acmeStaging string = "https://acme-staging-v02.api.letsencrypt.org/directory"
const acmeProd string = "https://acme-v02.api.letsencrypt.org/directory"
const rootPathWarningMessage = `!!!! HEADS UP !!!!`
// We need a user or account type that implements acme.User
type AcmeUser struct {
Email string
@@ -70,14 +68,20 @@ func newCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().SetInterspersed(true)
cmd.Flags().StringVarP(&options.domain, "domain", "d", "", "Domain for which Cert is being generated (e.g. me.example.com)")
cmd.MarkFlagRequired("domain")
if err := cmd.MarkFlagRequired("domain"); err != nil {
panic(err)
}
cmd.Flags().BoolVarP(&options.staging, "staging", "s", false, "Enable creation of 'staging' Certs (instead of production Certs)")
cmd.Flags().StringVarP(&options.acmeserver, "acmeserver", "a", acmeProd, "ACME CA hostname")
cmd.Flags().StringVarP(&options.email, "email", "e", "openziti@netfoundry.io", "Email used for registration and recovery contact")
options.keyType.Set("RSA4096") // set default
if err := options.keyType.Set("RSA4096"); err != nil { // set default
panic(err)
}
cmd.Flags().VarP(&options.keyType, "keytype", "k", "Key type to use for private keys")
cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory to use for storing the data")
cmd.MarkFlagRequired("path")
if err := cmd.MarkFlagRequired("path"); err != nil {
panic(err)
}
cmd.Flags().StringVarP(&options.port, "port", "o", "80", "Port to listen on for HTTP based ACME challenges")
cmd.Flags().StringVarP(&options.csr, "csr", "", "", "Certificate Signing Request filename, if an external CSR is to be used")
+6 -4
View File
@@ -21,8 +21,8 @@ import (
"fmt"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"io"
"io/ioutil"
"net/url"
"os"
"path/filepath"
"strings"
@@ -52,7 +52,9 @@ func newListCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().BoolVarP(&options.accounts, "accounts", "a", false, "Display Account info")
cmd.Flags().BoolVarP(&options.names, "names", "n", false, "Display Names info")
cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory where data is stored")
cmd.MarkFlagRequired("path")
if err := cmd.MarkFlagRequired("path"); err != nil {
panic(err)
}
return cmd
}
@@ -83,7 +85,7 @@ func listAccount(options *leOptions) error {
fmt.Println("Found the following accounts:")
for _, filename := range matches {
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
if err != nil {
return err
}
@@ -132,7 +134,7 @@ func listCertificates(options *leOptions) error {
continue
}
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
if err != nil {
return err
}
+9 -3
View File
@@ -56,13 +56,19 @@ func newRenewCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().SetInterspersed(true)
cmd.Flags().StringVarP(&options.domain, "domain", "d", "", "Domain for which Cert is being generated (e.g. me.example.com)")
cmd.MarkFlagRequired("domain")
if err := cmd.MarkFlagRequired("domain"); err != nil {
panic(err)
}
cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory where data is stored")
cmd.MarkFlagRequired("path")
if err := cmd.MarkFlagRequired("path"); err != nil {
panic(err)
}
cmd.Flags().IntVarP(&options.days, "days", "", 14, "The number of days left on a certificate to renew it")
cmd.Flags().BoolVarP(&options.reuseKey, "reuse-key", "r", true, "Used to indicate you want to reuse your current private key for the renewed certificate")
cmd.Flags().StringVarP(&options.email, "email", "e", "openziti@netfoundry.io", "Email used for registration and recovery contact")
options.keyType.Set("RSA4096") // set default
if err := options.keyType.Set("RSA4096"); err != nil { // set default
panic(err)
}
cmd.Flags().VarP(&options.keyType, "keytype", "k", "Key type to use for private keys")
cmd.Flags().StringVarP(&options.acmeserver, "acmeserver", "a", acmeProd, "ACME CA hostname")
cmd.Flags().BoolVarP(&options.staging, "staging", "s", false, "Enable creation of 'staging' Certs (instead of production Certs)")
+6 -2
View File
@@ -44,9 +44,13 @@ func newRevokeCmd(out io.Writer, errOut io.Writer) *cobra.Command {
cmd.Flags().SetInterspersed(true)
cmd.Flags().StringVarP(&options.domain, "domain", "d", "", "Domain for which Cert is being generated (e.g. me.example.com)")
cmd.MarkFlagRequired("domain")
if err := cmd.MarkFlagRequired("domain"); err != nil {
panic(err)
}
cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory where data is stored")
cmd.MarkFlagRequired("path")
if err := cmd.MarkFlagRequired("path"); err != nil {
panic(err)
}
cmd.Flags().StringVarP(&options.email, "email", "e", "openziti@netfoundry.io", "Email used for registration and recovery contact")
cmd.Flags().StringVarP(&options.acmeserver, "acmeserver", "a", acmeProd, "ACME CA hostname")
cmd.Flags().BoolVarP(&options.staging, "staging", "s", false, "Enable creation of 'staging' Certs (instead of production Certs)")
+1 -44
View File
@@ -17,11 +17,7 @@
package lets_encrypt
import (
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/openziti/ziti/ziti/internal/log"
"io/ioutil"
"os"
"time"
@@ -59,7 +55,7 @@ func newClient(options *leOptions, acc registration.User) *lego.Client {
KeyType: options.keyType.Get(),
Timeout: time.Duration(30) * time.Second, // Only used when obtaining certificates
}
config.UserAgent = fmt.Sprintf("zitii-cli")
config.UserAgent = "ziti-cli"
client, err := lego.NewClient(config)
if err != nil {
@@ -69,14 +65,6 @@ func newClient(options *leOptions, acc registration.User) *lego.Client {
return client
}
func getEmail(options *leOptions) string {
email := options.email
if len(email) == 0 {
log.Fatal("You have to pass an account (email address) to the program using --email or -m")
}
return email
}
func createNonExistingFolder(path string) error {
if _, err := os.Stat(path); os.IsNotExist(err) {
return os.MkdirAll(path, 0o700)
@@ -85,34 +73,3 @@ func createNonExistingFolder(path string) error {
}
return nil
}
func readCSRFile(filename string) (*x509.CertificateRequest, error) {
bytes, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
raw := bytes
// see if we can find a PEM-encoded CSR
var p *pem.Block
rest := bytes
for {
// decode a PEM block
p, rest = pem.Decode(rest)
// did we fail?
if p == nil {
break
}
// did we get a CSR?
if p.Type == "CERTIFICATE REQUEST" {
raw = p.Bytes
}
}
// no PEM-encoded CSR
// assume we were given a DER-encoded ASN.1 CSR
// (if this assumption is wrong, parsing these bytes will fail)
return x509.ParseCertificateRequest(raw)
}
+2 -1
View File
@@ -43,7 +43,7 @@ type PKIFlags struct {
CAName string
CommonName string
CAExpire int
CAMaxpath int
CAMaxPath int
CAPrivateKeySize int
IntermediateFile string
IntermediateName string
@@ -61,6 +61,7 @@ type PKIFlags struct {
PKI *pki.ZitiPKI
SpiffeID string
AllowOverwrite bool
EcCurve string
}
var (
+123 -73
View File
@@ -17,16 +17,18 @@
package cmd
import (
"crypto/elliptic"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"errors"
"fmt"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/pki/pki"
"github.com/openziti/ziti/ziti/util"
"io"
"io/ioutil"
"net"
"os"
"strings"
"sync"
"time"
@@ -77,38 +79,39 @@ func NewCmdPKICreate(out io.Writer, errOut io.Writer) *cobra.Command {
func (options *PKICreateOptions) addPKICreateFlags(cmd *cobra.Command) {
viperLock.Lock()
defer viperLock.Unlock()
cmd.PersistentFlags().StringVarP(&options.Flags.PKIRoot, "pki-root", "", "", "Directory in which to store CA")
cmd.MarkFlagRequired("pki-root")
viper.BindPFlag("pki_root", cmd.PersistentFlags().Lookup("pki-root"))
err := viper.BindPFlag("pki_root", cmd.PersistentFlags().Lookup("pki-root"))
options.panicOnErr(err)
cmd.PersistentFlags().StringVarP(&options.Flags.PKIOrganization, "pki-organization", "", "NetFoundry", "Organization")
cmd.MarkFlagRequired("pki-organization")
viper.BindPFlag("pki-organization", cmd.PersistentFlags().Lookup("pki-organization"))
err = viper.BindPFlag("pki-organization", cmd.PersistentFlags().Lookup("pki-organization"))
options.panicOnErr(err)
cmd.PersistentFlags().StringVarP(&options.Flags.PKIOrganizationalUnit, "pki-organizational-unit", "", "ADV-DEV", "Organization unit")
cmd.MarkFlagRequired("pki-organizational-unit")
viper.BindPFlag("pki-organizational-unit", cmd.PersistentFlags().Lookup("pki-organizational-unit"))
err = viper.BindPFlag("pki-organizational-unit", cmd.PersistentFlags().Lookup("pki-organizational-unit"))
options.panicOnErr(err)
cmd.PersistentFlags().StringVarP(&options.Flags.PKICountry, "pki-country", "", "US", "Country")
cmd.MarkFlagRequired("pki-country")
viper.BindPFlag("pki-country", cmd.PersistentFlags().Lookup("pki-country"))
err = viper.BindPFlag("pki-country", cmd.PersistentFlags().Lookup("pki-country"))
options.panicOnErr(err)
cmd.PersistentFlags().StringVarP(&options.Flags.PKILocality, "pki-locality", "", "Charlotte", "Locality/Location")
cmd.MarkFlagRequired("pki-locality")
viper.BindPFlag("pki-locality", cmd.PersistentFlags().Lookup("pki-locality"))
err = viper.BindPFlag("pki-locality", cmd.PersistentFlags().Lookup("pki-locality"))
options.panicOnErr(err)
// cmd.PersistentFlags().StringVarP(&options.Flags.PKILocality, "pki-location", "", "Charlotte", "Location/Locality")
// cmd.MarkFlagRequired("pki-location")
// viper.BindPFlag("pki-location", cmd.PersistentFlags().Lookup("pki-location"))
cmd.PersistentFlags().StringVarP(&options.Flags.PKIProvince, "pki-province", "", "NC", "Province/State")
cmd.MarkFlagRequired("pki-province")
viper.BindPFlag("pki-province", cmd.PersistentFlags().Lookup("pki-province"))
err = viper.BindPFlag("pki-province", cmd.PersistentFlags().Lookup("pki-province"))
options.panicOnErr(err)
// cmd.PersistentFlags().StringVarP(&options.Flags.PKIProvince, "pki-state", "", "NC", "State/Province")
// cmd.MarkFlagRequired("pki-state")
// viper.BindPFlag("pki-state", cmd.PersistentFlags().Lookup("pki-state"))
viperLock.Unlock()
}
// Run implements this command
@@ -118,111 +121,111 @@ func (o *PKICreateOptions) Run() error {
// ObtainPKIRoot returns the value for pki-root
func (o *PKICreateOptions) ObtainPKIRoot() (string, error) {
pkiroot := o.Flags.PKIRoot
if pkiroot == "" {
pkiroot = viper.GetString("pki-root")
if pkiroot == "" {
pkiRoot := o.Flags.PKIRoot
if pkiRoot == "" {
pkiRoot = viper.GetString("pki-root")
if pkiRoot == "" {
pkiRootDir, err := util.PKIRootDir()
if err != nil {
return "", err
}
pkiroot, err = util.PickValue("Required flag 'pki-root' not specified; Enter PKI Root now:", pkiRootDir, true)
pkiRoot, err = util.PickValue("Required flag 'pki-root' not specified; Enter PKI Root now:", pkiRootDir, true)
if err != nil {
return "", err
}
}
}
return pkiroot, nil
return pkiRoot, nil
}
// ObtainCAFile returns the value for ca-file
func (o *PKICreateOptions) ObtainCAFile() (string, error) {
cafile := o.Flags.CAFile
if cafile == "" {
cafile = viper.GetString("ca-file")
if cafile == "" {
caFile := o.Flags.CAFile
if caFile == "" {
caFile = viper.GetString("ca-file")
if caFile == "" {
var err error
cafile, err = util.PickValue("Required flag 'ca-file' not specified; Enter CA name now:", "ca", true)
caFile, err = util.PickValue("Required flag 'ca-file' not specified; Enter CA name now:", "ca", true)
if err != nil {
return "", err
}
}
}
return cafile, nil
return caFile, nil
}
// ObtainIntermediateCAFile returns the value for intermediate-file
func (o *PKICreateOptions) ObtainIntermediateCAFile() (string, error) {
intermediatefile := o.Flags.IntermediateFile
if intermediatefile == "" {
intermediatefile = viper.GetString("intermediate-file")
if intermediatefile == "" {
intermediateFile := o.Flags.IntermediateFile
if intermediateFile == "" {
intermediateFile = viper.GetString("intermediate-file")
if intermediateFile == "" {
var err error
intermediatefile, err = util.PickValue("Required flag 'intermediate-file' not specified; Enter Intermediate CA name now:", "intermediate", true)
intermediateFile, err = util.PickValue("Required flag 'intermediate-file' not specified; Enter Intermediate CA name now:", "intermediate", true)
if err != nil {
return "", err
}
}
}
return intermediatefile, nil
return intermediateFile, nil
}
// ObtainIntermediateCSRFile returns the value for intermediate-file
func (o *PKICreateOptions) ObtainIntermediateCSRFile() (string, error) {
intermediatecsrfile := viper.GetString("intermediate-csr-file")
if intermediatecsrfile == "" {
intermediateCsrFile := viper.GetString("intermediate-csr-file")
if intermediateCsrFile == "" {
var err error
intermediatecsrfile, err = util.PickValue("Required flag 'intermediate--csr-file' not specified; Enter Intermediate CSR file name now:", "intermediate-csr", true)
intermediateCsrFile, err = util.PickValue("Required flag 'intermediate--csr-file' not specified; Enter Intermediate CSR file name now:", "intermediate-csr", true)
if err != nil {
return "", err
}
}
return intermediatecsrfile, nil
return intermediateCsrFile, nil
}
// ObtainCSRFile returns the value for csr-file
func (o *PKICreateOptions) ObtainCSRFile() (string, error) {
csrfile := viper.GetString("csr-file")
if csrfile == "" {
csrFile := viper.GetString("csr-file")
if csrFile == "" {
var err error
csrfile, err = util.PickValue("Required flag 'csr-file' not specified; Enter CSR name now:", "csr", true)
csrFile, err = util.PickValue("Required flag 'csr-file' not specified; Enter CSR name now:", "csr", true)
if err != nil {
return "", err
}
}
return csrfile, nil
return csrFile, nil
}
// ObtainServerCertFile returns the value for server-file
func (o *PKICreateOptions) ObtainServerCertFile() (string, error) {
serverfile := o.Flags.ServerFile
if serverfile == "" {
serverfile = viper.GetString("server-file")
if serverfile == "" {
serverFile := o.Flags.ServerFile
if serverFile == "" {
serverFile = viper.GetString("server-file")
if serverFile == "" {
var err error
serverfile, err = util.PickValue("Required flag 'server-file' not specified; Enter name now:", "server", true)
serverFile, err = util.PickValue("Required flag 'server-file' not specified; Enter name now:", "server", true)
if err != nil {
return "", err
}
}
}
return serverfile, nil
return serverFile, nil
}
// ObtainClientCertFile returns the value for client-file
func (o *PKICreateOptions) ObtainClientCertFile() (string, error) {
clientfile := o.Flags.ClientFile
if clientfile == "" {
clientfile = viper.GetString("client-file")
if clientfile == "" {
clientFile := o.Flags.ClientFile
if clientFile == "" {
clientFile = viper.GetString("client-file")
if clientFile == "" {
var err error
clientfile, err = util.PickValue("Required flag 'client-file' not specified; Enter name now:", "client", true)
clientFile, err = util.PickValue("Required flag 'client-file' not specified; Enter name now:", "client", true)
if err != nil {
return "", err
}
}
}
return clientfile, nil
return clientFile, nil
}
// ObtainKeyFile returns the value for key-file
@@ -244,13 +247,13 @@ func (o *PKICreateOptions) ObtainKeyFile(required bool) (string, error) {
}
// ObtainCAName returns the value for ca-name
func (o *PKICreateOptions) ObtainCAName(pkiroot string) (string, error) {
caname := o.Flags.CAName
if caname == "" {
caname = viper.GetString("ca-name")
if caname == "" {
func (o *PKICreateOptions) ObtainCAName(pkiRoot string) (string, error) {
caName := o.Flags.CAName
if caName == "" {
caName = viper.GetString("ca-name")
if caName == "" {
var err error
files, err := ioutil.ReadDir(pkiroot)
files, err := os.ReadDir(pkiRoot)
if err != nil {
return "", err
}
@@ -262,14 +265,14 @@ func (o *PKICreateOptions) ObtainCAName(pkiroot string) (string, error) {
}
}
}
caname, err = util.PickName(names, "Required flag 'ca-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):")
caName, err = util.PickName(names, "Required flag 'ca-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):")
if err != nil {
return "", err
}
}
}
fmt.Println("Using CA name: ", caname)
return caname, nil
fmt.Println("Using CA name: ", caName)
return caName, nil
}
// ObtainCommonName returns the value for CN
@@ -289,9 +292,9 @@ func (o *PKICreateOptions) ObtainCommonName() (string, error) {
}
// ObtainFileName returns the value for the 'name' used in the PKI request
func (o *PKICreateOptions) ObtainFileName(cafile string, commonName string) string {
func (o *PKICreateOptions) ObtainFileName(caFile string, commonName string) string {
var filename string
if filename = cafile; len(cafile) == 0 {
if filename = caFile; len(caFile) == 0 {
filename = strings.Replace(commonName, " ", "_", -1)
filename = strings.Replace(filename, "*", "wildcard", -1)
}
@@ -321,18 +324,18 @@ func (o *PKICreateOptions) ObtainPKIRequestTemplate(commonName string) *x509.Cer
template := &x509.Certificate{
Subject: subject,
NotAfter: time.Now().AddDate(0, 0, o.Flags.CAExpire),
MaxPathLen: o.Flags.CAMaxpath,
MaxPathLen: o.Flags.CAMaxPath,
}
return template
}
// ObtainKeyName returns the private key from the key-file
func (o *PKICreateOptions) ObtainKeyName(pkiroot string) (string, error) {
keyname := viper.GetString("key-name")
if keyname == "" {
func (o *PKICreateOptions) ObtainKeyName(pkiRoot string) (string, error) {
keyName := viper.GetString("key-name")
if keyName == "" {
var err error
files, err := ioutil.ReadDir(pkiroot)
files, err := os.ReadDir(pkiRoot)
if err != nil {
return "", err
}
@@ -342,13 +345,13 @@ func (o *PKICreateOptions) ObtainKeyName(pkiroot string) (string, error) {
names = append(names, f.Name())
}
}
keyname, err = util.PickName(names, "Required flag 'key-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):")
keyName, err = util.PickName(names, "Required flag 'key-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):")
if err != nil {
return "", err
}
}
return keyname, nil
return keyName, nil
}
// ObtainPKICSRRequestTemplate returns the CSR 'template' used in the PKI request
@@ -379,8 +382,7 @@ func (o *PKICreateOptions) ObtainPKICSRRequestTemplate(commonName string) *x509.
val, _ := asn1.Marshal(basicConstraints{true, 0})
csrTemplate := &x509.CertificateRequest{
Subject: subject,
SignatureAlgorithm: x509.SHA512WithRSA,
Subject: subject,
ExtraExtensions: []pkix.Extension{
{
Id: asn1.ObjectIdentifier{2, 5, 29, 19},
@@ -393,7 +395,7 @@ func (o *PKICreateOptions) ObtainPKICSRRequestTemplate(commonName string) *x509.
return csrTemplate
}
// ObtainIPsAndDNSNames returns the IP addrs and/or DNS names used in the PKI request template
// ObtainIPsAndDNSNames returns the IP address and/or DNS names used in the PKI request template
func (o *PKICreateOptions) ObtainIPsAndDNSNames() ([]net.IP, []string, error) {
if (len(o.Flags.IP) == 0) && (len(o.Flags.DNSName) == 0) {
@@ -409,3 +411,51 @@ func (o *PKICreateOptions) ObtainIPsAndDNSNames() ([]net.IP, []string, error) {
return IPs, o.Flags.DNSName, nil
}
// ObtainPrivateKeyOptions returns the private key options necessary to generate a private key
func (o *PKICreateOptions) ObtainPrivateKeyOptions() (pki.PrivateKeyOptions, error) {
isEc := o.Flags.EcCurve != ""
if isEc {
return o.obtainEcOptions()
}
return o.obtainRsaOptions()
}
func (o *PKICreateOptions) obtainEcOptions() (pki.PrivateKeyOptions, error) {
target := strings.Replace(strings.ToLower(o.Flags.EcCurve), "-", "", -1)
validCurves := []elliptic.Curve{
elliptic.P224(),
elliptic.P256(),
elliptic.P384(),
elliptic.P521(),
}
for _, validCurve := range validCurves {
curCurveName := strings.Replace(strings.ToLower(validCurve.Params().Name), "-", "", -1)
if curCurveName == target {
return &pki.EcPrivateKeyOptions{
Curve: validCurve,
}, nil
}
}
validCurveString := ""
for _, validCurve := range validCurves {
if validCurveString != "" {
validCurveString = validCurveString + ", "
}
validCurveString = validCurveString + strings.Replace(validCurve.Params().Name, "-", "", -1)
}
return nil, fmt.Errorf("unknown curve name '%s', valid curves (case and dash insensitive) %s", o.Flags.EcCurve, validCurveString)
}
func (o *PKICreateOptions) obtainRsaOptions() (pki.PrivateKeyOptions, error) {
return &pki.RsaPrivateKeyOptions{
Size: o.Flags.CAPrivateKeySize,
}, nil
}
+15 -7
View File
@@ -17,6 +17,7 @@
package cmd
import (
"fmt"
"github.com/openziti/fabric/controller/idgen"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/internal/log"
@@ -70,23 +71,24 @@ func (o *PKICreateCAOptions) addPKICreateCAFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&o.Flags.CAFile, "ca-file", "", "", "Dir/File name (within PKI_ROOT) in which to store new CA")
cmd.Flags().StringVarP(&o.Flags.CAName, FlagCaName, "", "NetFoundry Inc. Certificate Authority", "Name of CA")
cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 3650, "Expiration limit in days")
cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key")
cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set")
cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521")
cmd.Flags().StringVar(&o.Flags.SpiffeID, "trust-domain", "", "An optional spiffe trust domain. spiffe:// will be automatically prefixed, if not provided")
}
// Run implements this command
func (o *PKICreateCAOptions) Run() error {
pkiroot, err := o.ObtainPKIRoot()
pkiRoot, err := o.ObtainPKIRoot()
if err != nil {
return err
}
o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}}
local := o.Flags.PKI.Store.(*store.Local)
local.Root = pkiroot
local.Root = pkiRoot
cafile, err := o.ObtainCAFile()
caFile, err := o.ObtainCAFile()
if err != nil {
return err
}
@@ -98,7 +100,7 @@ func (o *PKICreateCAOptions) Run() error {
commonName := o.Flags.CAName
filename := o.ObtainFileName(cafile, commonName)
filename := o.ObtainFileName(caFile, commonName)
template := o.ObtainPKIRequestTemplate(commonName)
template.IsCA = true
@@ -114,13 +116,19 @@ func (o *PKICreateCAOptions) Run() error {
template.URIs = append(template.URIs, spiffeId)
}
privateKeyOptions, err := o.ObtainPrivateKeyOptions()
if err != nil {
return fmt.Errorf("could not resolve private key options: %w", err)
}
var signer *certificate.Bundle
req := &pki.Request{
Name: filename,
Template: template,
IsClientCertificate: false,
PrivateKeySize: o.Flags.CAPrivateKeySize,
PrivateKeyOptions: privateKeyOptions,
}
if err = o.Flags.PKI.Sign(signer, req); err != nil {
+15 -7
View File
@@ -17,6 +17,7 @@
package cmd
import (
"fmt"
"github.com/openziti/fabric/controller/idgen"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/internal/log"
@@ -73,21 +74,22 @@ func (o *PKICreateClientOptions) addPKICreateClientFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&o.Flags.ClientName, FlagCaClientName, "", "NetFoundry Inc. Client", "Common Name (CN) to use for new Client certificate")
cmd.Flags().StringSliceVar(&o.Flags.Email, "email", []string{}, "Email addr(s) to add to Subject Alternate Name (SAN) for new Client certificate")
cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 365, "Expiration limit in days")
cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 2048, "Size of the private key")
cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set")
cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521")
cmd.Flags().StringVar(&o.Flags.SpiffeID, "spiffe-id", "", "Optionally provide the path portion of a SPIFFE id. The trust domain will be taken from the signing certificate.")
}
// Run implements this command
func (o *PKICreateClientOptions) Run() error {
pkiroot, err := o.ObtainPKIRoot()
pkiRoot, err := o.ObtainPKIRoot()
if err != nil {
return err
}
o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}}
local := o.Flags.PKI.Store.(*store.Local)
local.Root = pkiroot
local.Root = pkiRoot
if !o.Cmd.Flags().Changed(FlagCaClientName) {
o.Flags.ClientName = o.Flags.ClientName + " " + idgen.New()
@@ -108,7 +110,7 @@ func (o *PKICreateClientOptions) Run() error {
var signer *certificate.Bundle
caname, err := o.ObtainCAName(pkiroot)
caName, err := o.ObtainCAName(pkiRoot)
if err != nil {
return err
}
@@ -118,7 +120,7 @@ func (o *PKICreateClientOptions) Run() error {
return err
}
signer, err = o.Flags.PKI.GetCA(caname)
signer, err = o.Flags.PKI.GetCA(caName)
if err != nil {
return errors.Wrap(err, "cannot locate signer")
}
@@ -143,12 +145,18 @@ func (o *PKICreateClientOptions) Run() error {
template.URIs = append(template.URIs, &spiffId)
}
privateKeyOptions, err := o.ObtainPrivateKeyOptions()
if err != nil {
return fmt.Errorf("could not resolve private key options: %w", err)
}
req := &pki.Request{
Name: filename,
KeyName: keyFile,
Template: template,
IsClientCertificate: true,
PrivateKeySize: o.Flags.CAPrivateKeySize,
PrivateKeyOptions: privateKeyOptions,
}
if err := o.Flags.PKI.Sign(signer, req); err != nil {
+9 -10
View File
@@ -64,28 +64,27 @@ func (o *PKICreateCSROptions) addPKICreateCSRFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&o.Flags.CSRName, "csr-name", "", "NetFoundry Inc. CSR", "Name of CSR")
cmd.Flags().StringVarP(&o.Flags.KeyName, "key-name", "", "", "Name of file that contains private key for CSR")
cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 365, "Expiration limit in days")
cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key")
cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length")
}
// Run implements this command
func (o *PKICreateCSROptions) Run() error {
pkiroot, err := o.ObtainPKIRoot()
pkiRoot, err := o.ObtainPKIRoot()
if err != nil {
return fmt.Errorf("%s", err)
}
o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}}
local := o.Flags.PKI.Store.(*store.Local)
local.Root = pkiroot
local.Root = pkiRoot
csrfile, err := o.ObtainCSRFile()
csrFile, err := o.ObtainCSRFile()
if err != nil {
return fmt.Errorf("%s", err)
}
keyname, err := o.ObtainKeyName(pkiroot)
keyName, err := o.ObtainKeyName(pkiRoot)
if err != nil {
return fmt.Errorf("%s", err)
}
@@ -93,13 +92,13 @@ func (o *PKICreateCSROptions) Run() error {
commonName := o.Flags.CSRName
template := o.ObtainPKICSRRequestTemplate(commonName)
key, err := o.Flags.PKI.GetPrivateKey(keyname, keyname)
key, err := o.Flags.PKI.GetPrivateKey(keyName, keyName)
if err != nil {
return fmt.Errorf("Cannot locate private key: %v", err)
return fmt.Errorf("cannot locate private key: %v", err)
}
if err := o.Flags.PKI.CSR(keyname, csrfile, *template, key); err != nil {
return fmt.Errorf("Cannot create CSR: %v", err)
if err := o.Flags.PKI.CSR(keyName, csrFile, *template, key); err != nil {
return fmt.Errorf("cannot create CSR: %v", err)
}
log.Infoln("Success")
+17 -9
View File
@@ -17,6 +17,7 @@
package cmd
import (
"fmt"
"github.com/openziti/fabric/controller/idgen"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/internal/log"
@@ -70,22 +71,23 @@ func (o *PKICreateIntermediateOptions) addPKICreateIntermediateFlags(cmd *cobra.
cmd.Flags().StringVarP(&o.Flags.IntermediateFile, "intermediate-file", "", "intermediate", "Dir/File name (within PKI_ROOT) in which to store new Intermediate CA")
cmd.Flags().StringVarP(&o.Flags.IntermediateName, FlagCaIntermediateName, "", "NetFoundry Inc. Intermediate CA", "Common Name (CN) to use for new Intermediate CA")
cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 3650, "Expiration limit in days")
cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", 0, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key")
cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", 0, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set")
cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521")
}
// Run implements this command
func (o *PKICreateIntermediateOptions) Run() error {
pkiroot, err := o.ObtainPKIRoot()
pkiRoot, err := o.ObtainPKIRoot()
if err != nil {
return err
}
o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}}
local := o.Flags.PKI.Store.(*store.Local)
local.Root = pkiroot
local.Root = pkiRoot
intermediatefile, err := o.ObtainIntermediateCAFile()
intermediateFile, err := o.ObtainIntermediateCAFile()
if err != nil {
return err
}
@@ -96,19 +98,19 @@ func (o *PKICreateIntermediateOptions) Run() error {
commonName := o.Flags.IntermediateName
filename := o.ObtainFileName(intermediatefile, commonName)
filename := o.ObtainFileName(intermediateFile, commonName)
template := o.ObtainPKIRequestTemplate(commonName)
template.IsCA = true
var signer *certificate.Bundle
caname, err := o.ObtainCAName(pkiroot)
caName, err := o.ObtainCAName(pkiRoot)
if err != nil {
return err
}
signer, err = o.Flags.PKI.GetCA(caname)
signer, err = o.Flags.PKI.GetCA(caName)
if err != nil {
return errors.Wrap(err, "cannot locate signer")
}
@@ -119,11 +121,17 @@ func (o *PKICreateIntermediateOptions) Run() error {
}
}
privateKeyOptions, err := o.ObtainPrivateKeyOptions()
if err != nil {
return fmt.Errorf("could not resolve private key options: %w", err)
}
req := &pki.Request{
Name: filename,
Template: template,
IsClientCertificate: false,
PrivateKeySize: o.Flags.CAPrivateKeySize,
PrivateKeyOptions: privateKeyOptions,
}
if err := o.Flags.PKI.Sign(signer, req); err != nil {
+15 -8
View File
@@ -65,27 +65,28 @@ func (o *PKICreateKeyOptions) addPKICreateKeyFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&o.Flags.PKIRoot, "pki-root", "", "", "Directory in which PKI resides")
cmd.Flags().StringVarP(&o.Flags.CAName, "ca-name", "", "intermediate", "Name of Intermediate CA (within PKI_ROOT) to use to sign the new Client certificate")
cmd.Flags().StringVarP(&o.Flags.KeyFile, "key-file", "", "key", "Name of file (under chosen CA) in which to store new private key")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set")
cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521")
}
// Run implements this command
func (o *PKICreateKeyOptions) Run() error {
pkiroot, err := o.ObtainPKIRoot()
pkiRoot, err := o.ObtainPKIRoot()
if err != nil {
return fmt.Errorf("%s", err)
}
o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}}
local := o.Flags.PKI.Store.(*store.Local)
local.Root = pkiroot
local.Root = pkiRoot
keyFile, err := o.ObtainKeyFile(true)
if err != nil {
return fmt.Errorf("%s", err)
}
caname, err := o.ObtainCAName(pkiroot)
caName, err := o.ObtainCAName(pkiRoot)
if err != nil {
return fmt.Errorf("%s", err)
}
@@ -93,20 +94,26 @@ func (o *PKICreateKeyOptions) Run() error {
template := o.ObtainPKIRequestTemplate("")
var signer *certificate.Bundle
signer, err = o.Flags.PKI.GetCA(caname)
signer, err = o.Flags.PKI.GetCA(caName)
if err != nil {
return fmt.Errorf("Cannot locate signer: %v", err)
return fmt.Errorf("cannot locate signer: %v", err)
}
privateKeyOptions, err := o.ObtainPrivateKeyOptions()
if err != nil {
return fmt.Errorf("could not resolve private key options: %w", err)
}
req := &pki.Request{
KeyName: keyFile,
Template: template,
IsClientCertificate: false,
PrivateKeySize: o.Flags.CAPrivateKeySize,
PrivateKeyOptions: privateKeyOptions,
}
if err := o.Flags.PKI.GeneratePrivateKey(signer, req); err != nil {
return fmt.Errorf("Cannot Generate Private key: %v", err)
return fmt.Errorf("cannot Generate Private key: %v", err)
}
log.Infoln("Success")
+11 -3
View File
@@ -17,6 +17,7 @@
package cmd
import (
"fmt"
"github.com/openziti/fabric/controller/idgen"
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
"github.com/openziti/ziti/ziti/internal/log"
@@ -74,8 +75,9 @@ func (o *PKICreateServerOptions) addPKICreateServerFlags(cmd *cobra.Command) {
cmd.Flags().StringSliceVar(&o.Flags.DNSName, "dns", []string{}, "DNS name(s) to add to Subject Alternate Name (SAN) for new Server certificate")
cmd.Flags().StringSliceVar(&o.Flags.IP, "ip", []string{}, "IP addr(s) to add to Subject Alternate Name (SAN) for new Server certificate")
cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 365, "Expiration limit in days")
cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key")
cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length")
cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set")
cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521")
cmd.Flags().StringVar(&o.Flags.SpiffeID, "spiffe-id", "", "Optionally provide the path portion of a SPIFFE id. The trust domain will be taken from the signing certificate.")
cmd.Flags().BoolVar(&o.Flags.AllowOverwrite, "allow-overwrite", false, "Allow overwrite existing certs")
}
@@ -151,12 +153,18 @@ func (o *PKICreateServerOptions) Run() error {
template.URIs = append(template.URIs, &spiffId)
}
privateKeyOptions, err := o.ObtainPrivateKeyOptions()
if err != nil {
return fmt.Errorf("could not resolve private key options: %w", err)
}
req := &pki.Request{
Name: filename,
KeyName: keyFile,
Template: template,
IsClientCertificate: false,
PrivateKeySize: o.Flags.CAPrivateKeySize,
PrivateKeyOptions: privateKeyOptions,
AllowOverwrite: o.Flags.AllowOverwrite,
}
-9
View File
@@ -256,15 +256,6 @@ func rpad(s string, padding int) string {
return fmt.Sprintf(template, s)
}
func indentLines(s string, indentation int) string {
r := []string{}
for _, line := range strings.Split(s, "\n") {
indented := strings.Repeat(" ", indentation) + line
r = append(r, indented)
}
return strings.Join(r, "\n")
}
func appendIfNotPresent(s, stringToAppend string) string {
if strings.Contains(s, stringToAppend) {
return s
+5 -5
View File
@@ -6,7 +6,7 @@ import (
"github.com/openziti/identity"
"github.com/spf13/cobra"
"io"
"io/ioutil"
"os"
"strings"
)
@@ -42,7 +42,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman
outCaFile = rootFileName + ".ca"
}
identityJson, err := ioutil.ReadFile(identityFile)
identityJson, err := os.ReadFile(identityFile)
if err != nil {
_, _ = fmt.Fprintf(errOut, "error opening file %s: %v\n", args[0], err)
@@ -57,7 +57,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman
if strings.HasPrefix(config.ID.Cert, "pem:") {
data := strings.TrimPrefix(config.ID.Cert, "pem:")
if err := ioutil.WriteFile(outCertFile, []byte(data), 0); err != nil {
if err := os.WriteFile(outCertFile, []byte(data), 0); err != nil {
_, _ = fmt.Fprintf(errOut, "error writing certificate to file [%s]: %v\n", outCertFile, err)
return
}
@@ -67,7 +67,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman
if strings.HasPrefix(config.ID.Key, "pem:") {
data := strings.TrimPrefix(config.ID.Key, "pem:")
if err := ioutil.WriteFile(outKeyFile, []byte(data), 0); err != nil {
if err := os.WriteFile(outKeyFile, []byte(data), 0); err != nil {
_, _ = fmt.Fprintf(errOut, "error writing private key to file [%s]: %v\n", outKeyFile, err)
return
}
@@ -77,7 +77,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman
if strings.HasPrefix(config.ID.Key, "pem:") {
data := strings.TrimPrefix(config.ID.CA, "pem:")
if err := ioutil.WriteFile(outCaFile, []byte(data), 0); err != nil {
if err := os.WriteFile(outCaFile, []byte(data), 0); err != nil {
_, _ = fmt.Fprintf(errOut, "error writing CAs to file [%s]: %v\n", outCaFile, err)
return
}
+13 -5
View File
@@ -17,7 +17,7 @@
package certificate
import (
"crypto/rsa"
"crypto"
"crypto/x509"
"fmt"
)
@@ -25,21 +25,29 @@ import (
// Bundle represents a pair of private key and certificate.
type Bundle struct {
Name string
Key *rsa.PrivateKey
Key crypto.PrivateKey
Cert *x509.Certificate
}
// Raw returns the raw bytes for the private key and certificate.
func (b *Bundle) Raw() ([]byte, []byte) {
return x509.MarshalPKCS1PrivateKey(b.Key), b.Cert.Raw
keyBytes, _ := x509.MarshalPKCS8PrivateKey(b.Key)
return keyBytes, b.Cert.Raw
}
// RawToBundle creates a bundle from the name and bytes given for a private key
// and a certificate.
func RawToBundle(name string, key []byte, cert []byte) (*Bundle, error) {
k, err := x509.ParsePKCS1PrivateKey(key)
k, err := x509.ParsePKCS8PrivateKey(key)
if err != nil {
return nil, fmt.Errorf("failed parsing private key: %v", err)
//previous versions may have stored private keys as PKCS1 (aka RSA only) try as a secondary action
var pkcs1Err error
k, pkcs1Err = x509.ParsePKCS1PrivateKey(key)
if pkcs1Err != nil {
return nil, fmt.Errorf("failed parsing private key PKCS8 error: %w, PKCS1 error: %w", err, pkcs1Err)
}
}
c, err := x509.ParseCertificate(cert)
if err != nil {
+82 -15
View File
@@ -20,6 +20,7 @@ package pki
import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@@ -42,13 +43,40 @@ var (
ErrMaxPathLenReached = errors.New("max path len reached")
)
type PrivateKeyOptions interface {
GenerateKey() (crypto.PrivateKey, error)
}
var _ PrivateKeyOptions = &RsaPrivateKeyOptions{}
type RsaPrivateKeyOptions struct {
Size int
}
func (r *RsaPrivateKeyOptions) GenerateKey() (crypto.PrivateKey, error) {
if r.Size == 0 {
r.Size = defaultPrivateKeySize
}
return rsa.GenerateKey(rand.Reader, r.Size)
}
var _ PrivateKeyOptions = &EcPrivateKeyOptions{}
type EcPrivateKeyOptions struct {
Curve elliptic.Curve
}
func (e *EcPrivateKeyOptions) GenerateKey() (crypto.PrivateKey, error) {
return ecdsa.GenerateKey(e.Curve, rand.Reader)
}
// Request is a struct for providing configuration to
// GenerateCertificate when actioning a certification generation request.
type Request struct {
Name string
KeyName string
IsClientCertificate bool
PrivateKeySize int
PrivateKeyOptions PrivateKeyOptions
Template *x509.Certificate
AllowOverwrite bool
}
@@ -101,13 +129,11 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error {
}
var err error
var privateKey *rsa.PrivateKey
var privateKey crypto.PrivateKey
if req.KeyName == "" {
if req.PrivateKeySize == 0 {
req.PrivateKeySize = defaultPrivateKeySize
}
privateKey, err = rsa.GenerateKey(rand.Reader, req.PrivateKeySize)
privateKey, err = req.PrivateKeyOptions.GenerateKey()
if err != nil {
return fmt.Errorf("failed generating private key: %v", err)
}
@@ -118,7 +144,12 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error {
}
privateKey = pk.(*rsa.PrivateKey)
}
publicKey := privateKey.Public()
publicKey, err := publicKeyFromPrivate(privateKey)
if err != nil {
return err
}
if err := defaultTemplate(req, publicKey); err != nil {
return fmt.Errorf("failed updating generation request: %v", err)
@@ -148,12 +179,29 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error {
return fmt.Errorf("failed creating and signing certificate: %v", err)
}
if err := e.Store.Add(signer.Name, req.Name, req.Template.IsCA, x509.MarshalPKCS1PrivateKey(privateKey), rawCert, req.AllowOverwrite); err != nil {
keyBytes, err := x509.MarshalPKCS8PrivateKey(privateKey)
if err != nil {
return nil
}
if err := e.Store.Add(signer.Name, req.Name, req.Template.IsCA, keyBytes, rawCert, req.AllowOverwrite); err != nil {
return fmt.Errorf("failed saving generated bundle: %v", err)
}
return nil
}
func publicKeyFromPrivate(key crypto.PrivateKey) (crypto.PublicKey, error) {
switch pk := key.(type) {
case *rsa.PrivateKey:
return &pk.PublicKey, nil
case *ecdsa.PrivateKey:
return &pk.PublicKey, nil
}
return nil, errors.New("unsupported key type")
}
// Chain will...
func (e *ZitiPKI) Chain(signer *certificate.Bundle, req *Request) error {
destCA := signer.Name
@@ -166,16 +214,22 @@ func (e *ZitiPKI) Chain(signer *certificate.Bundle, req *Request) error {
return nil
}
// Generate and store a private key
// GeneratePrivateKey generates and stores a private key
func (e *ZitiPKI) GeneratePrivateKey(signer *certificate.Bundle, req *Request) error {
if req.PrivateKeySize == 0 {
req.PrivateKeySize = defaultPrivateKeySize
}
privateKey, err := rsa.GenerateKey(rand.Reader, req.PrivateKeySize)
privateKey, err := req.PrivateKeyOptions.GenerateKey()
if err != nil {
return fmt.Errorf("failed generating private key: %v", err)
}
if err := e.Store.AddKey(signer.Name, req.KeyName, x509.MarshalPKCS1PrivateKey(privateKey)); err != nil {
keyBytes, err := x509.MarshalPKCS8PrivateKey(privateKey)
if err != nil {
return fmt.Errorf("failed marshalling private key: %v", err)
}
if err := e.Store.AddKey(signer.Name, req.KeyName, keyBytes); err != nil {
return fmt.Errorf("failed saving generated key: %v", err)
}
return nil
@@ -200,7 +254,20 @@ func (e *ZitiPKI) CRL(caName string, expire time.Time) ([]byte, error) {
return nil, fmt.Errorf("failed retrieving CA bundle %v: %v", caName, err)
}
crl, err := ca.Cert.CreateCRL(rand.Reader, ca.Key, revoked, time.Now(), expire)
signer, ok := ca.Key.(crypto.Signer)
if !ok {
return nil, fmt.Errorf("could not convert %T to %T", ca.Key, signer)
}
template := &x509.RevocationList{
RevokedCertificates: revoked,
ThisUpdate: time.Now(),
NextUpdate: expire,
}
crl, err := x509.CreateRevocationList(rand.Reader, template, ca.Cert, signer)
if err != nil {
return nil, fmt.Errorf("failed creating crl for %v: %v", caName, err)
}
+2 -4
View File
@@ -19,17 +19,16 @@ package pki
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/asn1"
"fmt"
"math/big"
"time"
)
func defaultTemplate(genReq *Request, publicKey crypto.PublicKey) error {
publicKeyBytes, err := asn1.Marshal(*publicKey.(*rsa.PublicKey))
publicKeyBytes, err := x509.MarshalPKIXPublicKey(publicKey)
if err != nil {
return fmt.Errorf("failed marshaling public key: %v", err)
}
@@ -45,7 +44,6 @@ func defaultTemplate(genReq *Request, publicKey crypto.PublicKey) error {
genReq.Template.SerialNumber = sn
genReq.Template.NotBefore = time.Now().Add(-time.Minute)
genReq.Template.SignatureAlgorithm = x509.SHA256WithRSA
return nil
}
+36 -7
View File
@@ -156,19 +156,22 @@ func (l *Local) AddCSR(caName, name string, isCa bool, key, cert []byte) error {
return nil
}
// AddKey adds the given key to the local filesystem.
// AddKey adds the given private key to the local filesystem.
func (l *Local) AddKey(caName string, name string, key []byte) error {
if l.Exists(caName, name) {
return fmt.Errorf("a key already exists for the key name %v within CA %v", name, caName)
}
if err := l.writeKey(caName, name, key); err != nil {
pemType := getPkPemType(key)
if err := l.writeKey(caName, name, pemType, key); err != nil {
return fmt.Errorf("failed writing key %v within CA %v to the local filesystem: %v", name, caName, err)
}
return nil
}
// writeKey encodes in PEM format the bundle private key and stores it on the local filesystem.
func (l *Local) writeKey(caName string, name string, key []byte) error {
func (l *Local) writeKey(caName, name, pemType string, key []byte) error {
caDir := filepath.Join(l.Root, caName)
if _, err := os.Stat(caDir); err != nil {
if err := InitCADir(caDir); err != nil {
@@ -176,12 +179,30 @@ func (l *Local) writeKey(caName string, name string, key []byte) error {
}
}
keyPath, _ := l.path(caName, name)
if err := encodeAndWrite(keyPath, "RSA PRIVATE KEY", key); err != nil {
if err := encodeAndWrite(keyPath, pemType, key); err != nil {
return fmt.Errorf("failed encoding and writing private key file: %v", err)
}
return nil
}
func getPkPemType(key []byte) string {
var pkcs1Err error
_, pkcs1Err = x509.ParsePKCS1PrivateKey(key)
if pkcs1Err == nil {
return "RSA PRIVATE KEY"
}
var pkcsEcErr error
_, pkcsEcErr = x509.ParseECPrivateKey(key)
if pkcsEcErr == nil {
return "EC PRIVATE KEY"
}
return "PRIVATE KEY"
}
// writeBundle encodes in PEM format the bundle private key and
// certificate and stores them on the local filesystem.
func (l *Local) writeBundle(caName, name string, isCa bool, key, cert []byte) error {
@@ -191,8 +212,11 @@ func (l *Local) writeBundle(caName, name string, isCa bool, key, cert []byte) er
return fmt.Errorf("root directory for CA %v does not exist and cannot be created: %v", caDir, err)
}
}
keyPemType := getPkPemType(key)
keyPath, certPath := l.path(caName, name)
if err := encodeAndWrite(keyPath, "RSA PRIVATE KEY", key); err != nil {
if err := encodeAndWrite(keyPath, keyPemType, key); err != nil {
return fmt.Errorf("failed encoding and writing private key file: %v", err)
}
if err := encodeAndWrite(certPath, "CERTIFICATE", cert); err != nil {
@@ -377,8 +401,13 @@ func (l *Local) Update(caName string, sn *big.Int, st certificate.State) error {
}
}
f.Truncate(0)
f.Seek(0, 0)
if err = f.Truncate(0); err != nil {
return err
}
if _, err = f.Seek(0, 0); err != nil {
return err
}
for _, line := range lines {
n, err := fmt.Fprintln(f, line)
+1 -1
View File
@@ -65,7 +65,7 @@ type Store interface {
// Args:
// The intermediate CA name
// The Key name
// The raw private key.
// The private key
//
// Returns an error if it failed to store the bundle.
AddKey(string, string, []byte) error
+5 -3
View File
@@ -22,7 +22,7 @@ import (
"github.com/openziti/fabric/router"
"github.com/openziti/sdk-golang/ziti"
"github.com/spf13/cobra"
"io/ioutil"
"os"
)
var jwtPath *string
@@ -39,7 +39,9 @@ func NewEnrollGwCmd() *cobra.Command {
jwtPath = enrollEdgeRouterCmd.Flags().StringP("jwt", "j", "", "The path to a JWT file")
engine = enrollEdgeRouterCmd.Flags().StringP("engine", "e", "", "An engine")
keyAlg.Set("RSA") // set default
if err := keyAlg.Set("RSA"); err != nil { // set default
panic(err)
}
enrollEdgeRouterCmd.Flags().VarP(&keyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key")
return enrollEdgeRouterCmd
@@ -57,7 +59,7 @@ func enrollGw(cmd *cobra.Command, args []string) {
log.Panicf("could not load config: %s", err)
}
jwtBuf, err := ioutil.ReadFile(*jwtPath)
jwtBuf, err := os.ReadFile(*jwtPath)
if err != nil {
log.Panicf("could not load JWT file from path [%s]", *jwtPath)
}
+4 -4
View File
@@ -20,7 +20,7 @@ import (
"fmt"
"github.com/michaelquigley/pfxlog"
"github.com/openziti/agent"
"github.com/openziti/edge/edge_common"
"github.com/openziti/edge/common"
"github.com/openziti/edge/router/debugops"
"github.com/openziti/edge/router/fabric"
"github.com/openziti/edge/router/xgress_edge"
@@ -76,7 +76,7 @@ func run(cmd *cobra.Command, args []string) {
stateManager := fabric.NewStateManager()
xgressEdgeFactory := xgress_edge.NewFactory(config, version.GetCmdBuildInfo(), stateManager, r.GetMetricsRegistry())
xgress.GlobalRegistry().Register(edge_common.EdgeBinding, xgressEdgeFactory)
xgress.GlobalRegistry().Register(common.EdgeBinding, xgressEdgeFactory)
if err := r.RegisterXrctrl(xgressEdgeFactory); err != nil {
logrus.WithError(err).Panic("error registering edge in framework")
}
@@ -85,7 +85,7 @@ func run(cmd *cobra.Command, args []string) {
xgress.GlobalRegistry().Register(xgress_edge_transport.BindingName, xgressEdgeTransportFactory)
xgressEdgeTunnelFactory := xgress_edge_tunnel.NewFactory(r, config, stateManager)
xgress.GlobalRegistry().Register(edge_common.TunnelBinding, xgressEdgeTunnelFactory)
xgress.GlobalRegistry().Register(common.TunnelBinding, xgressEdgeTunnelFactory)
if err := r.RegisterXrctrl(xgressEdgeTunnelFactory); err != nil {
logrus.WithError(err).Panic("error registering edge tunnel in framework")
}
@@ -131,7 +131,7 @@ func getFlags(cmd *cobra.Command) map[string]*pflag.Flag {
func waitForShutdown(r *router.Router, config *router.Config) {
ch := make(chan os.Signal, 1)
signal.Notify(ch, os.Interrupt, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM)
signal.Notify(ch, os.Interrupt, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM)
s := <-ch
+8 -8
View File
@@ -8,7 +8,7 @@ import (
"encoding/pem"
"fmt"
"github.com/openziti/ziti/ziti/cmd/common"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
@@ -31,7 +31,7 @@ func WriteCert(p common.Printer, id string, cert []byte) (string, error) {
return "", errors.Wrapf(err, "unable to create ziti certs dir %v", certsDir)
}
certFile := filepath.Join(certsDir, id)
if err = ioutil.WriteFile(certFile, cert, 0600); err != nil {
if err = os.WriteFile(certFile, cert, 0600); err != nil {
return "", err
}
p.Printf("Server certificate chain written to %v\n", certFile)
@@ -51,7 +51,7 @@ func ReadCert(id string) ([]byte, string, error) {
}
return nil, "", errors.Wrapf(err, "error while statting cert file for %v", id)
}
result, err := ioutil.ReadFile(certFile)
result, err := os.ReadFile(certFile)
if err != nil {
return nil, "", errors.Wrapf(err, "error while reading cert for %v", id)
}
@@ -81,11 +81,11 @@ func AreCertsTrusted(host string, certs []byte) (bool, error) {
tlsConfig.RootCAs.AppendCertsFromPEM(certs)
transport := *http.DefaultTransport.(*http.Transport)
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = tlsConfig
client := http.Client{
Transport: &transport,
Transport: transport,
}
resp, err := client.Get(fmt.Sprintf("%v/.well-known/est/cacerts", host))
@@ -100,12 +100,12 @@ func AreCertsTrusted(host string, certs []byte) (bool, error) {
}
func GetWellKnownCerts(host string) ([]byte, []*x509.Certificate, error) {
transport := *http.DefaultTransport.(*http.Transport)
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
client := http.Client{
Transport: &transport,
Transport: transport,
}
resp, err := client.Get(fmt.Sprintf("%v/.well-known/est/cacerts", host))
@@ -113,7 +113,7 @@ func GetWellKnownCerts(host string) ([]byte, []*x509.Certificate, error) {
return nil, nil, err
}
defer func() { _ = resp.Body.Close() }()
encoded, err := ioutil.ReadAll(resp.Body)
encoded, err := io.ReadAll(resp.Body)
if err != nil {
return nil, nil, err
}
-126
View File
@@ -17,13 +17,8 @@
package util
import (
"fmt"
"github.com/openziti/ziti/ziti/internal/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
"os/exec"
"strings"
)
const (
@@ -36,127 +31,6 @@ func PathWithBinary() string {
return binDir + string(os.PathListSeparator) + path
}
// GetCommandOutput evaluates the given command and returns the trimmed output
func GetCommandOutput(dir string, name string, args ...string) (string, error) {
os.Setenv("PATH", PathWithBinary())
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
data, err := e.CombinedOutput()
text := string(data)
text = strings.TrimSpace(text)
if err != nil {
return text, fmt.Errorf("error: command failed %s %s %s %s", name, strings.Join(args, " "), text, err)
}
return text, err
}
// RunCommand evaluates the given command and returns the trimmed output
func RunCommand(dir string, name string, args ...string) error {
os.Setenv("PATH", PathWithBinary())
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
e.Stdout = os.Stdout
e.Stderr = os.Stdin
err := e.Run()
if err != nil {
log.Errorf("command failed %s %s\n", name, strings.Join(args, " "))
}
return err
}
// RunAWSCommand evaluates the given AWS CLI command and returns the trimmed output
func RunAWSCommand(args ...string) error {
os.Setenv("PATH", PathWithBinary())
e := exec.Command("aws", args...)
accessKey, err := getAWSConfigValue("AWS_ACCESS_KEY_ID")
if err != nil {
return fmt.Errorf("Cannot find AWS_ACCESS_KEY_ID in config; Please run 'ziti init'")
}
secretKey, err := getAWSConfigValue("AWS_SECRET_ACCESS_KEY")
if err != nil {
return fmt.Errorf("Cannot find AWS_SECRET_ACCESS_KEY in config; Please run 'ziti init'")
}
e.Env = os.Environ()
e.Env = append(e.Env, "AWS_ACCESS_KEY_ID="+accessKey)
e.Env = append(e.Env, "AWS_SECRET_ACCESS_KEY="+secretKey)
e.Stdout = os.Stdout
e.Stderr = os.Stdin
err = e.Run()
if err != nil {
log.Errorf("Command failed %s\n", strings.Join(args, " "))
}
return err
}
// getCommandOutput evaluates the given command and returns the trimmed output
func getCommandOutput(dir string, name string, args ...string) (string, error) {
err := os.Setenv("PATH", PathWithBinary())
if err != nil {
return "", fmt.Errorf("could not set environment variable PATH: %s", err)
}
e := exec.Command(name, args...)
if dir != "" {
e.Dir = dir
}
data, err := e.CombinedOutput()
text := string(data)
text = strings.TrimSpace(text)
if err != nil {
return "", fmt.Errorf("command failed 'aws %s %s': %s %s", name, strings.Join(args, " "), text, err)
}
return text, err
}
// getAWSCommandOutput evaluates the given AWS CLI command and returns the trimmed output
func getAWSCommandOutput(args ...string) (string, error) {
os.Setenv("PATH", PathWithBinary())
e := exec.Command("aws", args...)
accessKey, err := getAWSConfigValue("AWS_ACCESS_KEY_ID")
if err != nil {
return "", fmt.Errorf("Cannot find AWS_ACCESS_KEY_ID in config; Please run 'ziti init'")
}
secretKey, err := getAWSConfigValue("AWS_SECRET_ACCESS_KEY")
if err != nil {
return "", fmt.Errorf("Cannot find AWS_SECRET_ACCESS_KEY in config; Please run 'ziti init'")
}
e.Env = os.Environ()
e.Env = append(e.Env, "AWS_ACCESS_KEY_ID="+accessKey)
e.Env = append(e.Env, "AWS_SECRET_ACCESS_KEY="+secretKey)
data, err := e.CombinedOutput()
text := string(data)
text = strings.TrimSpace(text)
if err != nil {
return "", fmt.Errorf("command failed 'aws %s': %s %s", strings.Join(args, " "), text, err)
}
return text, err
}
// getAWSCommandOutput evaluates the given AWS CLI command and returns the trimmed output
func getAWSConfigValue(key string) (string, error) {
viper := viper.New()
viper.SetConfigType("json")
viper.SetConfigName(CONFIGFILENAME)
zitiConfigDir, err := ZitiAppConfigDir("ziti")
if err != nil {
return "", err
}
viper.AddConfigPath(zitiConfigDir)
err = viper.ReadInConfig()
if err != nil {
return "", err
}
val := viper.GetString(key)
return val, nil
}
// NewEmptyParentCmd creates a new cobra command with no parent
func NewEmptyParentCmd(name string, description string) *cobra.Command {
+2 -3
View File
@@ -19,7 +19,6 @@ package util
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -186,7 +185,7 @@ func WriteZitiAppFile(zitiApp string, fileType string, appData interface{}) erro
return err
}
return ioutil.WriteFile(filePath, data, 0600)
return os.WriteFile(filePath, data, 0600)
}
// ReadZitiAppConfigFile reads in the config file data for the given Ziti application from an appropriate location
@@ -203,7 +202,7 @@ func ReadZitiAppFile(zitiApp string, fileType string, configData interface{}) er
filePath := filepath.Join(configDir, fileType+".json")
data, err := ioutil.ReadFile(filePath)
data, err := os.ReadFile(filePath)
if err != nil {
return err
}
+5 -8
View File
@@ -19,7 +19,6 @@ package util
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -27,8 +26,6 @@ import (
const (
DefaultWritePermissions = 0760
MaximumNewDirectoryAttempts = 1000
)
func FileExists(path string) (bool, error) {
@@ -134,7 +131,7 @@ func CopyDir(src string, dst string, force bool) (err error) {
return
}
entries, err := ioutil.ReadDir(src)
entries, err := os.ReadDir(src)
if err != nil {
return
}
@@ -150,7 +147,7 @@ func CopyDir(src string, dst string, force bool) (err error) {
}
} else {
// Skip symlinks.
if entry.Mode()&os.ModeSymlink != 0 {
if entry.Type()&os.ModeSymlink != 0 {
continue
}
@@ -227,7 +224,7 @@ func CopyDirOverwrite(src string, dst string) (err error) {
return
}
entries, err := ioutil.ReadDir(src)
entries, err := os.ReadDir(src)
if err != nil {
return
}
@@ -243,7 +240,7 @@ func CopyDirOverwrite(src string, dst string) (err error) {
}
} else {
// Skip symlinks.
if entry.Mode()&os.ModeSymlink != 0 {
if entry.Type()&os.ModeSymlink != 0 {
continue
}
@@ -259,7 +256,7 @@ func CopyDirOverwrite(src string, dst string) (err error) {
// loads a file
func LoadBytes(dir, name string) ([]byte, error) {
path := filepath.Join(dir, name) // relative path
bytes, err := ioutil.ReadFile(path)
bytes, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("error loading file %s in directory %s, %v", name, dir, err)
}
+36 -29
View File
@@ -9,21 +9,21 @@ require (
github.com/Jeffail/gabs/v2 v2.7.0
github.com/google/uuid v1.3.0
github.com/michaelquigley/pfxlog v0.6.10
github.com/openziti/channel/v2 v2.0.84
github.com/openziti/edge v0.24.364
github.com/openziti/channel/v2 v2.0.91
github.com/openziti/edge v0.24.381
github.com/openziti/fablab v0.5.5
github.com/openziti/fabric v0.23.45
github.com/openziti/foundation/v2 v2.0.28
github.com/openziti/identity v1.0.59
github.com/openziti/sdk-golang v0.20.78
github.com/openziti/storage v0.2.11
github.com/openziti/transport/v2 v2.0.93
github.com/openziti/fabric v0.24.2
github.com/openziti/foundation/v2 v2.0.29
github.com/openziti/identity v1.0.60
github.com/openziti/sdk-golang v0.20.90
github.com/openziti/storage v0.2.12
github.com/openziti/transport/v2 v2.0.99
github.com/openziti/ziti v0.28.3
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
go.etcd.io/bbolt v1.3.7
golang.org/x/net v0.12.0
golang.org/x/net v0.14.0
google.golang.org/protobuf v1.31.0
)
@@ -63,7 +63,7 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/errors v0.20.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/runtime v0.26.0 // indirect
@@ -72,12 +72,14 @@ require (
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-openapi/validate v0.22.1 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a // indirect
github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/schema v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
@@ -107,7 +109,7 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
@@ -117,20 +119,21 @@ 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/muhlemmer/gu v0.3.1 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openziti/agent v1.0.14 // indirect
github.com/openziti/edge-api v0.25.30 // indirect
github.com/openziti/agent v1.0.15 // indirect
github.com/openziti/edge-api v0.25.31 // indirect
github.com/openziti/jwks v1.0.3 // indirect
github.com/openziti/metrics v1.2.30 // indirect
github.com/openziti/runzmd v1.0.28 // indirect
github.com/openziti/metrics v1.2.31 // indirect
github.com/openziti/runzmd v1.0.29 // indirect
github.com/openziti/secretstream v0.1.10 // indirect
github.com/openziti/x509-claims v1.0.3 // indirect
github.com/openziti/xweb/v2 v2.0.2 // indirect
github.com/openziti/ziti-db-explorer v1.1.1 // indirect
github.com/openziti/xweb/v2 v2.1.0 // indirect
github.com/openziti/ziti-db-explorer v1.1.3 // indirect
github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect
github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
@@ -142,8 +145,9 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rodaine/table v1.0.1 // indirect
github.com/rs/cors v1.9.0 // indirect
github.com/russross/blackfriday v1.5.2 // indirect
github.com/shirou/gopsutil/v3 v3.23.6 // indirect
github.com/shirou/gopsutil/v3 v3.23.7 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/speps/go-hashids v2.0.0+incompatible // indirect
@@ -155,7 +159,7 @@ require (
github.com/spf13/viper v1.10.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
@@ -163,24 +167,27 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.mongodb.org/mongo-driver v1.12.0 // indirect
github.com/zitadel/oidc/v2 v2.7.0 // indirect
go.mongodb.org/mongo-driver v1.12.1 // indirect
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/image v0.9.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/image v0.11.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/AlecAivazis/survey.v1 v1.8.7 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/resty.v1 v1.12.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.7 // indirect

Some files were not shown because too many files have changed in this diff Show More