From 7bd67cf9b9c0c85c92483b3dcec9975080e959cd Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 09:33:03 -0500 Subject: [PATCH 01/46] Remove the update command, which was non-functional --- CHANGELOG.md | 11 ++++++ ziti/cmd/ziti/cmd/cmd.go | 2 - ziti/cmd/ziti/cmd/update.go | 78 ------------------------------------- 3 files changed, 11 insertions(+), 80 deletions(-) delete mode 100644 ziti/cmd/ziti/cmd/update.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 75cf7d5ef..a5d3d31a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# Release 0.27.0 + +## What's New + +* Ziti CLI + * The CLI has been cleaned up and unused, unusable and underused components have been removed + +## Ziti CLI + +* The update command has been removed. It was non-functional, so this should not affect anyone + # Release 0.26.11 ## What's New diff --git a/ziti/cmd/ziti/cmd/cmd.go b/ziti/cmd/ziti/cmd/cmd.go index c648b0460..0819fd6ba 100644 --- a/ziti/cmd/ziti/cmd/cmd.go +++ b/ziti/cmd/ziti/cmd/cmd.go @@ -123,7 +123,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com initCommands := NewCmdInit(out, err) createCommands := NewCmdCreate(out, err) - updateCommands := NewCmdUpdate(out, err) executeCommands := NewCmdExecute(out, err) agentCommands := NewAgentCmd(p) psCommands := NewCmdPs(p) @@ -152,7 +151,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com Commands: []*cobra.Command{ initCommands, createCommands, - updateCommands, }, }, { diff --git a/ziti/cmd/ziti/cmd/update.go b/ziti/cmd/ziti/cmd/update.go deleted file mode 100644 index 42a098568..000000000 --- a/ziti/cmd/ziti/cmd/update.go +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - "io" - - "github.com/spf13/cobra" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" -) - -// Update contains the command line options -type UpdateOptions struct { - CommonOptions - - DisableImport bool - OutDir string -} - -var ( - updateResources = `Valid resource types include: - - * config - ` - - updateLong = templates.LongDesc(` - Updates an existing resource. - - ` + updateResources + ` -`) -) - -// NewCmdUpdate creates a command object for the "update" command -func NewCmdUpdate(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpdateOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "update", - Short: "Updates an existing resource", - Long: updateLong, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - - // cmd.AddCommand(NewCmdUpdateConfig(f, out, errOut)) - - return cmd -} - -// Run implements this command -func (o *UpdateOptions) Run() error { - return o.Cmd.Help() -} From cf2d3145e654dd376e6b89745ecac1a09c18b69b Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 09:37:12 -0500 Subject: [PATCH 02/46] Remove ansible/vagrant functionality. Removes adhoc, playbook and ping commands --- CHANGELOG.md | 1 + ziti/ansible/install.go | 144 --------- ziti/ansible/main.go | 187 ----------- ziti/ansible/module.go | 74 ----- ziti/ansible/playbook.go | 59 ---- ziti/cmd/ziti/cmd/adhoc.go | 122 ------- ziti/cmd/ziti/cmd/cmd.go | 3 - ziti/cmd/ziti/cmd/common_install.go | 8 - ziti/cmd/ziti/cmd/install_ansible.go | 94 ------ ziti/cmd/ziti/cmd/ping.go | 120 ------- ziti/cmd/ziti/cmd/playbook.go | 138 -------- ziti/provisioner/main.go | 35 -- ziti/provisioner/vagrant.go | 96 ------ ziti/vagrantutil/command.go | 190 ----------- ziti/vagrantutil/error.go | 100 ------ ziti/vagrantutil/parse.go | 68 ---- ziti/vagrantutil/stringer.go | 32 -- ziti/vagrantutil/vagrant.go | 456 --------------------------- 18 files changed, 1 insertion(+), 1926 deletions(-) delete mode 100644 ziti/ansible/install.go delete mode 100644 ziti/ansible/main.go delete mode 100644 ziti/ansible/module.go delete mode 100644 ziti/ansible/playbook.go delete mode 100644 ziti/cmd/ziti/cmd/adhoc.go delete mode 100644 ziti/cmd/ziti/cmd/install_ansible.go delete mode 100644 ziti/cmd/ziti/cmd/ping.go delete mode 100644 ziti/cmd/ziti/cmd/playbook.go delete mode 100644 ziti/provisioner/main.go delete mode 100644 ziti/provisioner/vagrant.go delete mode 100644 ziti/vagrantutil/command.go delete mode 100644 ziti/vagrantutil/error.go delete mode 100644 ziti/vagrantutil/parse.go delete mode 100644 ziti/vagrantutil/stringer.go delete mode 100644 ziti/vagrantutil/vagrant.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a5d3d31a5..f5bbff075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ## Ziti CLI * The update command has been removed. It was non-functional, so this should not affect anyone +* The adhoc, ping and playbook commands have been removed. These were ansible and vagrant commands that were not widely used. # Release 0.26.11 diff --git a/ziti/ansible/install.go b/ziti/ansible/install.go deleted file mode 100644 index 5881c63d0..000000000 --- a/ziti/ansible/install.go +++ /dev/null @@ -1,144 +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 ansible - -import ( - "fmt" - "os" - "path/filepath" -) - -// Options for installing ansible -type InstallOptions struct { - RequirementsTXT string - VirtualEnv string - Path string -} - -func InstallViaPip(options *InstallOptions) error { - // TODO - var ( - virtualenvBinary string - virtualEnv string - pipBinary string - requirementsTXT string - err error - ) - - if options.Path != "" { - if _, err = os.Stat(options.Path); os.IsNotExist(err) { - return fmt.Errorf("The specified Path (%s) does not exist", options.Path) - } - } - - cwd, _ := os.Getwd() - - // if no requirements.txt is set we should check to see if we have one in - // dir in provided path or the current working dir, if so we can use that. - if options.RequirementsTXT == "" { - if options.Path != "" { - requirementsTXT = filepath.Join(options.Path, "requirements.txt") - } else { - requirementsTXT = filepath.Join(cwd, "requirements.txt") - } - if requirementsTXT != "" { - fmt.Printf("checking if %s exists... ", requirementsTXT) - if _, err = os.Stat(requirementsTXT); err == nil { - options.RequirementsTXT = requirementsTXT - fmt.Println("yes") - } else { - fmt.Println("no") - } - } - } else { - fmt.Printf("checking if %s exists... ", options.RequirementsTXT) - if _, err = os.Stat(options.RequirementsTXT); err == nil { - fmt.Println("yes") - } else { - fmt.Println("no") - return fmt.Errorf("(%s) does not exist", options.RequirementsTXT) - } - } - - // if requesting virtualenv we need to make sure virtualenv binary exists - if options.VirtualEnv != "" { - virtualenvBinary = checkBinInPath("virtualenv") - if virtualenvBinary == "" { - return fmt.Errorf("unable to find virtualenv in path") - } - } - - // if no virtualenv is set we should check to see if we have a virtualenv - // dir in provided path or the current working dir, if so we can use that. - if options.VirtualEnv == "" { - //fmt.Printf("you specified path %s\n", options.Path) - if options.Path != "" { - virtualEnv = filepath.Join(options.Path, "virtualenv") - options.VirtualEnv = virtualEnv - } else { - virtualEnv = filepath.Join(cwd, "virtualenv") - fmt.Printf("checking if %s exists... ", virtualEnv) - if _, err = os.Stat(virtualEnv); err == nil { - options.VirtualEnv = virtualEnv - fmt.Println("yes") - } else { - fmt.Println("no") - } - } - } - - // if requesting virtualenv we need to make sure virtualenv binary exists - if options.VirtualEnv != "" { - virtualenvBinary = checkBinInPath("virtualenv") - if virtualenvBinary == "" { - return fmt.Errorf("unable to find virtualenv in path") - } - } - - // if a virtualenv is specified make sure that pip is installed - // in it and use that, otherwise make sure its in path. - if options.VirtualEnv != "" { - fmt.Printf("Using VirtualEnv: %s\n", options.VirtualEnv) - pipBinary = filepath.Join(options.VirtualEnv, "bin", "pip") - if _, err = os.Stat(pipBinary); os.IsNotExist(err) { - err = runCmd(virtualenvBinary, []string{options.VirtualEnv}) - if err != nil { - return err - } - } - } else { - pipBinary = checkBinInPath("pip") - } - if pipBinary == "" { - return fmt.Errorf("unable to find pip in path") - } - fmt.Printf("Using Pip: %s\n", pipBinary) - - if options.RequirementsTXT != "" { - err = runCmd(pipBinary, []string{"install", "-r", options.RequirementsTXT}) - if err != nil { - return err - } - } else { - err = runCmd(pipBinary, []string{"install", "ansible"}) - if err != nil { - return err - } - } - - return nil -} diff --git a/ziti/ansible/main.go b/ziti/ansible/main.go deleted file mode 100644 index 584bb9dde..000000000 --- a/ziti/ansible/main.go +++ /dev/null @@ -1,187 +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 ansible - -import ( - "bufio" - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" -) - -// Options for running ansible -type Options struct { - SSHConfigFile string - SSHForwardAgent bool - Provisioner string - Environment string - Inventory string - KnownHostsFile string - ModuleOptions - PlaybookOptions -} - -// sets an environment variable -func setEnvironmentVariables(variable, value string) { - os.Setenv(variable, value) -} - -// appends a string to an existing environment variable -func appendEnvironmentVariable(variable, value string) { - old := os.Getenv(variable) - new := []string{old, value} - os.Setenv(variable, strings.Join(new, " ")) -} - -// Checks if specified ssh config file exists, if not it -// checks if there is an ssh_config in the specified environment -// otherwise defaults to no ssh config. -// appends result to env var ANSIBLE_SSH_ARGS -func sshConfigFile(options *Options) error { - if options.SSHConfigFile == "" { - sshConfigFile := filepath.Join(options.Environment, "ssh_config") - if _, err := os.Stat(sshConfigFile); !os.IsNotExist(err) { - options.SSHConfigFile = sshConfigFile - } - } else { - if _, err := os.Stat(options.SSHConfigFile); os.IsNotExist(err) { - return fmt.Errorf("ssh_config file %s does not exist", options.SSHConfigFile) - } - } - if options.SSHConfigFile != "" { - appendEnvironmentVariable("ANSIBLE_SSH_ARGS", - fmt.Sprintf("-F %s", options.SSHConfigFile)) - } - return nil -} - -// isEnvironment checks if a given directory is a suitable environment -func isEnvironment(path string) bool { - fi, err := os.Stat(path) - switch { - case err != nil: - return false - case fi.IsDir(): - testInventory := filepath.Join(path, "hosts") - if _, err := os.Stat(testInventory); os.IsNotExist(err) { - return false - } - return true - default: - return false - } -} - -// if the user specifies an environment we will attempt to ensure that -// it exists, we will also set the inventory arg to be passed onto ansible. -func configureEnvironment(options *Options) error { - if options.Environment != "" { - if isEnvironment(options.Environment) { - options.Inventory = filepath.Join(options.Environment, "hosts") - } else { - return fmt.Errorf("%s is not a valid environment path", options.Environment) - } - } else { - cwd, _ := os.Getwd() - fmt.Printf("--environment not set. Trying your working directory (%s)\n", cwd) - if isEnvironment(cwd) { - options.Environment = cwd - options.Inventory = filepath.Join(cwd, "hosts") - } else { - return fmt.Errorf("%s is not a valid environment path", cwd) - } - } - - if options.Inventory != "" { - if _, err := os.Stat(options.Inventory); os.IsNotExist(err) { - return fmt.Errorf("inventory file %s does not exist", options.Inventory) - } - } - return nil -} - -// checks if the user specifies an alternative known hosts file, if not -// looks for one in the specified environment or just defaults to none. -func configureKnownHostsFile(options *Options) error { - if options.KnownHostsFile != "" { - if _, err := os.Stat(options.KnownHostsFile); os.IsNotExist(err) { - return fmt.Errorf("known hosts file %s does not exist", options.KnownHostsFile) - } - } else { - maybeKnownHostsFile := filepath.Join(options.Environment, "ssh_known_hosts") - if _, err := os.Stat(maybeKnownHostsFile); !os.IsNotExist(err) { - options.KnownHostsFile = maybeKnownHostsFile - } - } - if options.KnownHostsFile != "" { - appendEnvironmentVariable("ANSIBLE_SSH_ARGS", - fmt.Sprintf("-o UserKnownHostsFile=%s", options.KnownHostsFile)) - } - return nil -} - -// enables ssh agent forwarding -func configureSSHForwardAgent(options *Options) { - if options.SSHForwardAgent { - appendEnvironmentVariable("ANSIBLE_SSH_ARGS", "-o ForwardAgent=yes") - } -} - -func init() { - // setEnvironmentVariables("ANSIBLE_STDOUT_CALLBACK","json") -} - -func checkBinInPath(binary string) string { - fmt.Printf("==> checkBinInPath: %s\n", binary) - location, err := exec.LookPath(binary) - if err != nil { - fmt.Printf("==> checkBinInPath: err: %s\n", err) - return "" - } - return location -} - -// runCmd takes a command and args and runs it, streaming output to stdout -func runCmd(cmdName string, cmdArgs []string) error { - fmt.Printf("==> Running: %s %s\n", cmdName, strings.Join(cmdArgs, " ")) - //return fmt.Errorf("bye") - cmd := exec.Command(cmdName, cmdArgs...) - cmdReader, err := cmd.StdoutPipe() - if err != nil { - return err - } - - scanner := bufio.NewScanner(cmdReader) - go func() { - for scanner.Scan() { - fmt.Printf("%s\n", scanner.Text()) - } - }() - - err = cmd.Start() - if err != nil { - return err - } - - err = cmd.Wait() - if err != nil { - return err - } - return nil -} diff --git a/ziti/ansible/module.go b/ziti/ansible/module.go deleted file mode 100644 index b0bc944e3..000000000 --- a/ziti/ansible/module.go +++ /dev/null @@ -1,74 +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 ansible - -import ( - "fmt" -) - -// ModuleOptions for running ansible -type ModuleOptions struct { - ModuleHosts string - Module string - ModulePath string - ModuleArgs string -} - -// Module ansible playbook -func Module(options *Options, ansibleArgs []string) error { - var ( - err error - zitiArgs []string - ) - - err = configureEnvironment(options) - if err != nil { - return err - } - err = sshConfigFile(options) - if err != nil { - return err - } - err = configureKnownHostsFile(options) - if err != nil { - return err - } - configureSSHForwardAgent(options) - - zitiArgs = []string{options.ModuleHosts, "--module-name", options.Module} - - if options.ModulePath != "" { - zitiArgs = append(zitiArgs, - []string{"--module-path", options.ModulePath}...) - } - - if options.ModuleArgs != "" { - zitiArgs = append(zitiArgs, - []string{"--args", fmt.Sprintf("'%s'", options.ModuleArgs)}...) - } - - if options.Inventory != "" { - zitiArgs = append(zitiArgs, - []string{"--inventory", options.Inventory}...) - } - - cmdName := "ansible" - cmdArgs := append(zitiArgs, ansibleArgs...) - - return runCmd(cmdName, cmdArgs) - -} diff --git a/ziti/ansible/playbook.go b/ziti/ansible/playbook.go deleted file mode 100644 index 9d58620de..000000000 --- a/ziti/ansible/playbook.go +++ /dev/null @@ -1,59 +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 ansible - -import ( -// "fmt" -// "strings" -) - -// PlaybookOptions for running ansible -type PlaybookOptions struct { -} - -// PlaybookRun ansible playbook -func PlaybookRun(options *Options, ansibleArgs []string) error { - var ( - err error - zitiArgs []string - ) - - err = configureEnvironment(options) - if err != nil { - return err - } - err = sshConfigFile(options) - if err != nil { - return err - } - err = configureKnownHostsFile(options) - if err != nil { - return err - } - configureSSHForwardAgent(options) - - if options.Inventory != "" { - zitiArgs = append(zitiArgs, - []string{"--inventory", options.Inventory}...) - } - - cmdName := "ansible-playbook" - cmdArgs := append(zitiArgs, ansibleArgs...) - // fmt.Println("running: ansible_playbook", strings.Join(cmdArgs, " ")) - - return runCmd(cmdName, cmdArgs) -} diff --git a/ziti/cmd/ziti/cmd/adhoc.go b/ziti/cmd/ziti/cmd/adhoc.go deleted file mode 100644 index d94c36290..000000000 --- a/ziti/cmd/ziti/cmd/adhoc.go +++ /dev/null @@ -1,122 +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" - "io" - "os" - "os/exec" - "path/filepath" - - "github.com/openziti/ziti/ziti/ansible" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/spf13/cobra" -) - -// AdhocOptions are the flags for delete commands -type AdhocOptions struct { - CommonOptions -} - -var adhocOptions = &ansible.Options{} - -// NewCmdAdhoc creates the command -func NewCmdAdhoc(out io.Writer, errOut io.Writer) *cobra.Command { - options := &AdhocOptions{ - CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "adhoc [flags] command [ansible arguments]", - Short: "wrapper around ansible command", - Long: ` -'ziti adhoc' is a wrapper around the 'ansible --module' shell that adds some additional useful features. -`, - Aliases: []string{}, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var ( - err error - virtualEnv string - ) - // check if there's a virtualenv we should use in your cwd - cwd, _ := os.Getwd() - virtualEnv = filepath.Join(cwd, "virtualenv/bin") - if _, err = os.Stat(virtualEnv); err == nil { - os.Setenv("PATH", fmt.Sprintf("%s:%s", virtualEnv, os.Getenv("PATH"))) - } - - // check if there's a virtualenv we should use in your environment - if adhocOptions.Environment != cwd { - virtualEnv = filepath.Join(adhocOptions.Environment, "virtualenv/bin") - if _, err = os.Stat(virtualEnv); err == nil { - os.Setenv("PATH", fmt.Sprintf("%s:%s", virtualEnv, os.Getenv("PATH"))) - } - } - // check if ansible-playbook binary exists - _, err = exec.LookPath("ansible") - if err != nil { - return err - } - return nil - }, - - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - SuggestFor: []string{}, - } - - // stops parsing flags after first unknown flag is found - cmd.Flags().SetInterspersed(false) - - cmd.Flags().StringVarP(&adhocOptions.SSHConfigFile, "ssh-config-file", - "s", "", "Path to ssh config file to use.") - - cmd.Flags().BoolVarP(&adhocOptions.SSHForwardAgent, "ssh-forward-agent", - "f", false, "path to ssh config file to use") - - cmd.Flags().StringVarP(&adhocOptions.Environment, "environment", - "e", "", "directory that contains ansible inventory") - - cmd.Flags().StringVarP(&adhocOptions.KnownHostsFile, "known-hosts-file", - "", "", "location of known hosts file") - - cmd.Flags().StringVarP(&adhocOptions.ModuleHosts, "hosts", - "", "all", "host or host pattern to run") - - return cmd -} - -// Run implements this command -func (o *AdhocOptions) Run() error { - adhocOptions.Module = "raw" - - if len(o.Args) < 1 { - return o.Cmd.Help() - } - - adhocOptions.ModuleArgs = o.Args[0] - args := o.Args[1:] - return ansible.Module(adhocOptions, args) -} diff --git a/ziti/cmd/ziti/cmd/cmd.go b/ziti/cmd/ziti/cmd/cmd.go index 0819fd6ba..7ff1a2cb6 100644 --- a/ziti/cmd/ziti/cmd/cmd.go +++ b/ziti/cmd/ziti/cmd/cmd.go @@ -192,9 +192,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com cmd.Version = version.GetVersion() cmd.SetVersionTemplate("{{printf .Version}}\n") cmd.AddCommand(NewCmdArt(out, err)) - cmd.AddCommand(NewCmdPlaybook(out, err)) - cmd.AddCommand(NewCmdPing(out, err)) - cmd.AddCommand(NewCmdAdhoc(out, err)) cmd.AddCommand(NewCmdUse(out, err)) return cmd diff --git a/ziti/cmd/ziti/cmd/common_install.go b/ziti/cmd/ziti/cmd/common_install.go index 2aab9e0b4..b72071b6e 100644 --- a/ziti/cmd/ziti/cmd/common_install.go +++ b/ziti/cmd/ziti/cmd/common_install.go @@ -19,7 +19,6 @@ package cmd import ( "fmt" "github.com/blang/semver" - "github.com/openziti/ziti/ziti/ansible" c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/openziti/ziti/ziti/cmd/ziti/util" @@ -131,13 +130,6 @@ func (o *CommonOptions) doInstallMissingDependencies(install []string) error { switch i { case "aws": err = o.installAWSCli() - case "ansible": - opts := &ansible.InstallOptions{ - RequirementsTXT: "", - VirtualEnv: "", - Path: "", - } - err = ansible.InstallViaPip(opts) default: return fmt.Errorf("unknown dependency to install %s", i) } diff --git a/ziti/cmd/ziti/cmd/install_ansible.go b/ziti/cmd/ziti/cmd/install_ansible.go deleted file mode 100644 index f05e450e0..000000000 --- a/ziti/cmd/ziti/cmd/install_ansible.go +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - "io" - - "github.com/openziti/ziti/ziti/ansible" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - "github.com/spf13/cobra" -) - -var ( - installAnsibleLong = templates.LongDesc(` - 'ziti install ansible' will install ansible and/or any dependencies provided. - If you do not specify a virtualenv or requirements file it will attempt - to find them in your local path, or it will try to find them in your - environment if you provide one. - `) - - installAnsibleExample = templates.Examples(` - # Install Ansible - ziti install ansible - `) -) - -// InstallAnsibleOptions the options for the install command -type InstallAnsibleOptions struct { - InstallOptions - - Version string -} - -var installOptions = &ansible.InstallOptions{} - -// NewCmdInstallAnsible defines the command -func NewCmdInstallAnsible(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallAnsibleOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ansible", - Short: "Install ansible via pip", - Aliases: []string{}, - Long: installAnsibleLong, - Example: installAnsibleExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - - // stops parsing flags after first unknown flag is found - cmd.Flags().SetInterspersed(false) - - cmd.Flags().StringVarP(&installOptions.VirtualEnv, "virtualenv", - "v", "", "Path to VirtualEnv to use") - - cmd.Flags().StringVarP(&installOptions.RequirementsTXT, "requirements", - "r", "", "path to requirements.txt") - - cmd.Flags().StringVarP(&installOptions.Path, "environment", - "e", "", "path to your ziti environment") - - return cmd -} - -// Run implements the command -func (o *InstallAnsibleOptions) Run() error { - return ansible.InstallViaPip(installOptions) -} diff --git a/ziti/cmd/ziti/cmd/ping.go b/ziti/cmd/ziti/cmd/ping.go deleted file mode 100644 index 7e7c27cc6..000000000 --- a/ziti/cmd/ziti/cmd/ping.go +++ /dev/null @@ -1,120 +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" - "io" - "os" - "os/exec" - "path/filepath" - - "github.com/openziti/ziti/ziti/ansible" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - // "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - "github.com/spf13/cobra" -) - -// PingOptions are the flags for delete commands -type PingOptions struct { - CommonOptions -} - -var pingOptions = &ansible.Options{} - -// NewCmdPing creates the command -func NewCmdPing(out io.Writer, errOut io.Writer) *cobra.Command { - options := &PingOptions{ - CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ping [flags] [--] [ansible arguments]", - Short: "check if all hosts are available", - Long: ` -'ziti' ping' uses the ansible ping module to check if all hosts are available. -This is useful for checking if your machine can successfully SSH/Ansible to -each host. -`, - Aliases: []string{}, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var ( - err error - virtualEnv string - ) - // check if there's a virtualenv we should use in your cwd - cwd, _ := os.Getwd() - virtualEnv = filepath.Join(cwd, "virtualenv/bin") - if _, err = os.Stat(virtualEnv); err == nil { - os.Setenv("PATH", fmt.Sprintf("%s:%s", virtualEnv, os.Getenv("PATH"))) - } - - // check if there's a virtualenv we should use in your environment - if pingOptions.Environment != cwd { - virtualEnv = filepath.Join(pingOptions.Environment, "virtualenv/bin") - if _, err = os.Stat(virtualEnv); err == nil { - os.Setenv("PATH", fmt.Sprintf("%s:%s", virtualEnv, os.Getenv("PATH"))) - } - } - // check if ansible-playbook binary exists - _, err = exec.LookPath("ansible") - if err != nil { - return err - } - return nil - }, - - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - SuggestFor: []string{}, - } - - // stops parsing flags after first unknown flag is found - cmd.Flags().SetInterspersed(false) - - cmd.Flags().StringVarP(&pingOptions.SSHConfigFile, "ssh-config-file", - "s", "", "Path to ssh config file to use.") - - cmd.Flags().StringVarP(&pingOptions.Environment, "environment", - "e", "", "directory that contains ansible inventory") - - cmd.Flags().StringVarP(&pingOptions.KnownHostsFile, "known-hosts-file", - "", "", "location of known hosts file") - - cmd.Flags().StringVarP(&pingOptions.ModuleHosts, "hosts", - "", "all", "host or host pattern to run") - - return cmd -} - -// Run implements this command -func (o *PingOptions) Run() error { - pingOptions.Module = "ping" - - // if len(o.Args) < 1 { - // return o.Cmd.Help() - // } - - return ansible.Module(pingOptions, o.Args) -} diff --git a/ziti/cmd/ziti/cmd/playbook.go b/ziti/cmd/ziti/cmd/playbook.go deleted file mode 100644 index 47d95ce9a..000000000 --- a/ziti/cmd/ziti/cmd/playbook.go +++ /dev/null @@ -1,138 +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" - "io" - - "github.com/openziti/ziti/ziti/ansible" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/provisioner" - - "github.com/spf13/cobra" - "os" - "os/exec" - "path/filepath" -) - -const () - -type PlaybookOptions struct { - CommonOptions -} - -var playbookOptions = &ansible.Options{} -var po = &provisioner.Options{} - -func NewCmdPlaybook(out io.Writer, errOut io.Writer) *cobra.Command { - options := &PlaybookOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "playbook [flags] file.yml [--] [ansible-playbook arguments]", - Short: "Wrapper around ansible command", - Long: ` -'ziti playbook' will run an ansible playbook over your provided environment. - -You can set additional ansible-playbook flags by providing a double dash "--" and -then the additional flags. - -Example: - -To run playbook/yaml over the env/test environment passing flags to ansible and use -the user "root" and run in verbose mode, do this: - - $ ziti playbook -e env/test playbook.yml -- --user=root -vvvv -`, - Aliases: []string{"up"}, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - var ( - err error - virtualEnv string - ) - - // check if there's a virtualenv we should use in your cwd - cwd, _ := os.Getwd() - virtualEnv = filepath.Join(cwd, "virtualenv/bin") - if _, err = os.Stat(virtualEnv); err == nil { - os.Setenv("PATH", fmt.Sprintf("%s:%s", virtualEnv, os.Getenv("PATH"))) - } - - // check if there's a virtualenv we should use in your environment - if playbookOptions.Environment != cwd { - virtualEnv = filepath.Join(playbookOptions.Environment, "virtualenv/bin") - if _, err = os.Stat(virtualEnv); err == nil { - os.Setenv("PATH", fmt.Sprintf("%s:%s", virtualEnv, os.Getenv("PATH"))) - } - } - - // check if ansible-playbook binary exists - _, err = exec.LookPath("ansible-playbook") - if err != nil { - return err - } - // check if provisioning needs to happen - if po.Provisioner != "" { - po.Environment = playbookOptions.Environment - err = provisioner.Up(po) - if err != nil { - return err - } - } - - return nil - }, - - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - options.AddCommonFlags(cmd) - - cmd.Flags().StringVarP(&playbookOptions.SSHConfigFile, "ssh-config-file", - "s", "", "Path to ssh config file to use.") - - cmd.Flags().BoolVarP(&playbookOptions.SSHForwardAgent, "ssh-forward-agent", - "f", false, "path to ssh config file to use") - - cmd.Flags().StringVarP(&playbookOptions.Environment, "environment", - "e", "", "directory that contains ansible inventory") - - cmd.Flags().StringVarP(&playbookOptions.KnownHostsFile, "known-hosts-file", - "", "", "location of known hosts file") - - cmd.Flags().StringVarP(&po.Provisioner, "provisioner", - "", "", "provisioner (vagrant)") - - return cmd -} - -// Run ... -func (o *PlaybookOptions) Run() error { - if len(o.Args) < 1 { - return o.Cmd.Help() - } - return ansible.PlaybookRun(playbookOptions, o.Args) -} diff --git a/ziti/provisioner/main.go b/ziti/provisioner/main.go deleted file mode 100644 index bdf7d1a2a..000000000 --- a/ziti/provisioner/main.go +++ /dev/null @@ -1,35 +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 provisioner - -import ( - "fmt" -) - -// Provisioner settings -type Options struct { - Provisioner string - Environment string -} - -// Up instantiates an environment -func Up(po *Options) error { - if po.Provisioner == "vagrant" { - return VagrantUp(po) - } - return fmt.Errorf("%s is not a valid provisioner choice", po.Provisioner) -} diff --git a/ziti/provisioner/vagrant.go b/ziti/provisioner/vagrant.go deleted file mode 100644 index 2a9195581..000000000 --- a/ziti/provisioner/vagrant.go +++ /dev/null @@ -1,96 +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 provisioner - -import ( - "github.com/openziti/ziti/ziti/vagrantutil" - "fmt" - "io/ioutil" - "os" - "path/filepath" -) - -var vagrant *vagrantutil.Vagrant - -func findVagrantfile(paths []string) string { - var ( - vagrantFile string - path string - ) - for _, path = range paths { - vagrantFile = filepath.Join(path, "Vagrantfile") - if _, err := os.Stat(vagrantFile); !os.IsNotExist(err) { - return path - } - } - return "" -} - -func runVagrantUp() { - output, _ := vagrant.Up() - // print the output - for line := range output { - fmt.Println(line) - } -} - -// VagrantUp provisioner -func VagrantUp(po *Options) error { - var ( - err error - ) - cwd, _ := os.Getwd() - paths := []string{po.Environment, cwd} - vagrantPath := findVagrantfile(paths) - if vagrantPath == "" { - return fmt.Errorf("cannot find vagrantfile in %s", paths) - } - vagrant, _ = vagrantutil.NewVagrant(vagrantPath) - vagrant.Status() - // fmt.Println("vagrant.State: %s", vagrant.State) - switch state := vagrant.State; state { - case "NotCreated": - runVagrantUp() - case "PowerOff": - runVagrantUp() - case "Saved": - runVagrantUp() - case "Running": - // do nothing - default: - return fmt.Errorf("cannot handle vagrant state %s.", state) - } - - if vagrant.State == "NotCreated" { - output, _ := vagrant.Up() - // print the output - for line := range output { - fmt.Println(line) - } - } - sshConfig, err := (vagrant.SSHConfig()) - if err != nil { - return err - } - sshConfigFile := filepath.Join(vagrantPath, "ssh_config") - err = ioutil.WriteFile(sshConfigFile, []byte(sshConfig), 0644) - if err != nil { - return err - } - - return nil -} diff --git a/ziti/vagrantutil/command.go b/ziti/vagrantutil/command.go deleted file mode 100644 index 34326602f..000000000 --- a/ziti/vagrantutil/command.go +++ /dev/null @@ -1,190 +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 vagrantutil - -import ( - "bufio" - "errors" - "fmt" - "io" - "log" - "os" - "os/exec" - "strings" - "sync" -) - -var env = append(os.Environ(), "VAGRANT_CHECKPOINT_DISABLE=1") - -type command struct { - // log logging.Logger - cwd string - - onSuccess func() - onFailure func(err error) - - ignoreErr func(err error) bool - errIgnored bool - - cmd *exec.Cmd -} - -func newCommand(cwd string) *command { - cmd := &command{ - cwd: cwd, - } - - // if log != nil { - // cmd.log = log.New(cwd) - // } - - return cmd -} - -func (cmd *command) init(args []string) { - cmd.cmd = exec.Command("vagrant", args...) - cmd.cmd.Dir = cmd.cwd - cmd.cmd.Env = env - - cmd.debugf("%s: executing: %v", cmd.cwd, cmd.cmd.Args) -} - -func (cmd *command) run(args ...string) (string, error) { - cmd.init(args) - - out, err := cmd.cmd.CombinedOutput() - if err != nil && len(out) != 0 { - err = fmt.Errorf("%s: %s", err, out) - } - - if e := cmd.checkError(err); e != nil { - return "", cmd.done(e) - } - - s := string(out) - - cmd.debugf("execution of %v was successful: %s", cmd.cmd.Args, s) - - return s, cmd.done(nil) - -} - -// start starts the command and sends back both the stdout and stderr to -// the returned channel. Any error happened during the streaming is passed to -// the Error field. -func (cmd *command) start(args ...string) (ch <-chan *CommandOutput, err error) { - cmd.init(args) - - stdoutPipe, err := cmd.cmd.StdoutPipe() - if err != nil { - return nil, cmd.done(err) - } - - stderrPipe, err := cmd.cmd.StderrPipe() - if err != nil { - return nil, cmd.done(err) - } - - if err := cmd.cmd.Start(); err != nil { - return nil, cmd.done(err) - } - - var wg sync.WaitGroup - wg.Add(2) - out := make(chan *CommandOutput) - - output := func(r io.Reader) { - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - if line == "" { - continue // ignore excessive whitespace - } - - cmd.debugf("%s", line) - cmd.checkError(errors.New(line)) - - out <- &CommandOutput{Line: line} - } - - cmd.reportError(out, scanner.Err()) - wg.Done() - } - - go output(stdoutPipe) - go output(stderrPipe) - - go func() { - wg.Wait() - - err := cmd.reportError(out, cmd.cmd.Wait()) - - close(out) - cmd.done(err) - }() - - return out, nil -} - -func (cmd *command) done(err error) error { - if e := cmd.checkError(err); e != nil { - - cmd.debugf("execution of %v failed: %s", cmd.cmd.Args, e) - - if cmd.onFailure != nil { - cmd.onFailure(e) - } - - return e - } - - if cmd.onSuccess != nil { - cmd.onSuccess() - } - - return nil -} - -func (cmd *command) checkError(err error) error { - if err == nil { - return nil - } - - if cmd.errIgnored || cmd.ignoreErr != nil && cmd.ignoreErr(err) { - cmd.errIgnored = true - return nil - } - - return err -} - -func (cmd *command) reportError(out chan<- *CommandOutput, err error) error { - if e := cmd.checkError(err); e != nil { - cmd.debugf("reporting error for %v: %s (%t)", cmd.cmd.Args, err, cmd.errIgnored) - out <- &CommandOutput{Error: err} - - return e - } - - return nil -} - -func (cmd *command) debugf(format string, args ...interface{}) { - // if cmd.log != nil { - log.Printf(format, args...) - // } -} diff --git a/ziti/vagrantutil/error.go b/ziti/vagrantutil/error.go deleted file mode 100644 index 9b56cc423..000000000 --- a/ziti/vagrantutil/error.go +++ /dev/null @@ -1,100 +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 vagrantutil - -import ( - "errors" - "os" - "strings" -) - -// List of errors ignored by Destroy / Status methods: -const ( - errNotCreated = "A Vagrant environment or target machine is required to run this" - errRubyNotExists = "No such file or directory - getcwd (Errno::ENOENT)" -) - -func isNotCreated(err error) bool { - return os.IsNotExist(err) || strings.Contains(err.Error(), errNotCreated) || - strings.Contains(err.Error(), errRubyNotExists) -} - -// The following errors are returned by the Wait function: -var ( - ErrBoxAlreadyExists = errors.New("box already exists") - ErrBoxInvalidVersion = errors.New("invalid box version") - ErrBoxNotAvailable = errors.New("box is not available") - ErrBoxDownload = errors.New("unable to download the box") - ErrVirtualBox = errors.New("VirtualBox is missing or not operational") -) - -var defaultWaiter Waiter - -// Waiter is used to consume output channel from a Vagrant command, parsing -// each line looking for an error when command execution fails. -type Waiter struct { - // OutputFunc, when non-nil, is called each time a Wait method receives - // a line of output from command channel. - OutputFunc func(string) -} - -// Wait is a convenience method that consumes Vagrant output looking -// for well-known errors. -// -// It returns an error variable for any known error condition, which makes it -// easier for the caller to recover from failure. -// -// If OutputFunc is non-nil, it's called on each line of output received -// from the out channel. -func (w *Waiter) Wait(out <-chan *CommandOutput, err error) error { - var e error - for o := range out { - if w.OutputFunc != nil { - w.OutputFunc(o.Line) - } - for s, err := range errMapping { - if strings.Contains(o.Line, s) { - e = nonil(e, err) - } - } - e = nonil(e, o.Error) - } - return nonil(e, err) -} - -// Wait is a convenience function that consumes Vagrant output looking -// for well-known errors. -func Wait(out <-chan *CommandOutput, err error) error { - return defaultWaiter.Wait(out, err) -} - -var errMapping = map[string]error{ - "The box you're attempting to add already exists.": ErrBoxAlreadyExists, - "Gem::Requirement::BadRequirementError": ErrBoxInvalidVersion, - "could not be accessed in the remote catalog.": ErrBoxNotAvailable, - "An error occurred while downloading the remote file.": ErrBoxDownload, - "VirtualBox is complaining that the kernel module is not loaded": ErrVirtualBox, -} - -func nonil(err ...error) error { - for _, e := range err { - if e != nil { - return e - } - } - return nil -} diff --git a/ziti/vagrantutil/parse.go b/ziti/vagrantutil/parse.go deleted file mode 100644 index 5503d1f42..000000000 --- a/ziti/vagrantutil/parse.go +++ /dev/null @@ -1,68 +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 vagrantutil - -import ( - "bufio" - "fmt" - "strings" -) - -// parseData parses the given vagrant type field from the machine readable -// output (records). -func parseData(records [][]string, typeName string) (string, error) { - data := "" - for _, record := range records { - // first three are defined, after that data is variadic, it contains - // zero or more information. We should have a data, otherwise it's - // useless. - if len(record) < 4 { - continue - } - - if typeName == record[2] && record[3] != "" { - data = record[3] - break - } - } - - if data == "" { - return "", fmt.Errorf("couldn't parse data for vagrant type: %q", typeName) - } - - return data, nil -} - -func parseRecords(out string) (recs [][]string, err error) { - scanner := bufio.NewScanner(strings.NewReader(out)) - - for scanner.Scan() { - line := strings.TrimSpace(scanner.Text()) - if line == "" { - continue - } - - row := strings.Split(line, ",") - recs = append(recs, row) - } - - if err := scanner.Err(); err != nil { - return nil, err - } - - return recs, nil -} diff --git a/ziti/vagrantutil/stringer.go b/ziti/vagrantutil/stringer.go deleted file mode 100644 index b3f8ac9d9..000000000 --- a/ziti/vagrantutil/stringer.go +++ /dev/null @@ -1,32 +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. -*/ - -// Code generated by "stringer -type=Status -output=stringer.go"; DO NOT EDIT - -package vagrantutil - -import "fmt" - -const _Status_name = "UnknownNotCreatedRunningSavedPowerOffAbortedPreparing" - -var _Status_index = [...]uint8{0, 7, 17, 24, 29, 37, 44, 53} - -func (i Status) String() string { - if i < 0 || i >= Status(len(_Status_index)-1) { - return fmt.Sprintf("Status(%d)", i) - } - return _Status_name[_Status_index[i]:_Status_index[i+1]] -} diff --git a/ziti/vagrantutil/vagrant.go b/ziti/vagrantutil/vagrant.go deleted file mode 100644 index 095b5f1f1..000000000 --- a/ziti/vagrantutil/vagrant.go +++ /dev/null @@ -1,456 +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 vagrantutil is a high level wrapper around Vagrant which provides an -// idiomatic go API. -package vagrantutil - -import ( - "bufio" - "errors" - "fmt" - "io/ioutil" - "log" - "os" - "path/filepath" - "strings" -) - -//go:generate stringer -type=Status -output=stringer.go - -type Status int - -const ( - // Some possible states: - // https://github.com/mitchellh/vagrant/blob/master/templates/locales/en.yml#L1504 - Unknown Status = iota - NotCreated - Running - Saved - PowerOff - Aborted - Preparing -) - -// Box represents a single line of `vagrant box list` output. -type Box struct { - Name string - Provider string - Version string -} - -// CommandOutput is the streaming output of a command -type CommandOutput struct { - Line string - Error error -} - -type Vagrant struct { - // VagrantfilePath is the directory with specifies the directory where - // Vagrantfile is being stored. - VagrantfilePath string - - // ProviderName overwrites the default provider used for the Vagrantfile. - ProviderName string - - // ID is the unique ID of the given box. - ID string - - // State is populated/updated if the Status() or List() method is called. - State string - - // Log is used for logging output of vagrant commands in debug mode. - // Log logging.Logger -} - -// NewVagrant returns a new Vagrant instance for the given path. The path -// should be unique. If the path already exists in the system it'll be used, if -// not a new setup will be createad. -func NewVagrant(path string) (*Vagrant, error) { - if path == "" { - return nil, errors.New("vagrant: path is empty") - } - - if err := os.MkdirAll(path, 0755); err != nil { - return nil, err - } - - return &Vagrant{ - VagrantfilePath: path, - }, nil -} - -// Create creates the vagrantFile in the pre initialized vagrant path. -func (v *Vagrant) Create(vagrantFile string) error { - // Recreate the directory in case it was removed between - // call to NewVagrant and Create. - if err := os.MkdirAll(v.VagrantfilePath, 0755); err != nil { - return v.error(err) - } - - v.debugf("create:\n%s", vagrantFile) - - return v.error(ioutil.WriteFile(v.vagrantfile(), []byte(vagrantFile), 0644)) -} - -// Version returns the current installed vagrant version -func (v *Vagrant) Version() (string, error) { - out, err := v.vagrantCommand().run("version", "--machine-readable") - if err != nil { - return "", err - } - - records, err := parseRecords(out) - if err != nil { - return "", v.error(err) - } - - versionInstalled, err := parseData(records, "version-installed") - if err != nil { - return "", v.error(err) - } - - return versionInstalled, nil -} - -// Status returns the state of the box, such as "Running", "NotCreated", etc... -func (v *Vagrant) Status() (s Status, err error) { - defer func() { - v.State = s.String() - }() - - var notCreated bool - cmd := v.vagrantCommand() - cmd.ignoreErr = func(err error) bool { - if isNotCreated(err) { - notCreated = true - return true - } - - return false - } - - out, err := cmd.run("status", "--machine-readable") - if err != nil { - return Unknown, err - } - - if notCreated { - return NotCreated, nil - } - - records, err := parseRecords(out) - if err != nil { - return Unknown, v.error(err) - } - - status, err := parseData(records, "state") - if err != nil { - return Unknown, v.error(err) - } - - s, err = toStatus(status) - if err != nil { - return Unknown, err - } - - return s, nil -} - -func (v *Vagrant) Provider() (string, error) { - out, err := v.vagrantCommand().run("status", "--machine-readable") - if err != nil { - return "", err - } - - records, err := parseRecords(out) - if err != nil { - return "", v.error(err) - } - - provider, err := parseData(records, "provider-name") - if err != nil { - return "", v.error(err) - } - - return provider, nil -} - -// List returns all available boxes on the system. Under the hood it calls -// "global-status" and parses the output. -func (v *Vagrant) List() ([]*Vagrant, error) { - // Refresh box status cache. So it does not report that aborted - // box is running etc. - _, err := v.vagrantCommand().run("global-status", "--prune") - if err != nil { - return nil, err - } - out, err := v.vagrantCommand().run("global-status") - if err != nil { - return nil, err - } - - output := make([][]string, 0) - - scanner := bufio.NewScanner(strings.NewReader(out)) - collectStarted := false - - for scanner.Scan() { - if strings.HasPrefix(scanner.Text(), "--") { - scanner.Scan() // advance to next line - collectStarted = true - } - - if !collectStarted { - continue - } - - trimmedLine := strings.TrimSpace(scanner.Text()) - if trimmedLine == "" { - break // we are finished with collecting the boxes - } - - output = append(output, strings.Fields(trimmedLine)) - } - if err := scanner.Err(); err != nil { - return nil, v.error(err) - } - - boxes := make([]*Vagrant, len(output)) - - for i, box := range output { - // example box: [0c269f6 default virtualbox aborted /Users/fatih/path] - boxes[i] = &Vagrant{ - ID: box[0], - VagrantfilePath: box[len(box)-1], - State: box[3], - } - } - - return boxes, nil -} - -// Up executes "vagrant up" for the given vagrantfile. The returned channel -// contains the output stream. At the end of the output, the error is put into -// the Error field if there is any. -func (v *Vagrant) Up() (<-chan *CommandOutput, error) { - if v.ProviderName != "" { - return v.vagrantCommand().start("up", "--provider", v.ProviderName) - } - - return v.vagrantCommand().start("up") -} - -// Halt executes "vagrant halt". The returned reader contains the output -// stream. The client is responsible of calling the Close method of the -// returned reader. -func (v *Vagrant) Halt() (<-chan *CommandOutput, error) { - return v.vagrantCommand().start("halt") -} - -// Destroy executes "vagrant destroy". The returned reader contains the output -// stream. The client is responsible of calling the Close method of the -// returned reader. -func (v *Vagrant) Destroy() (<-chan *CommandOutput, error) { - if _, err := os.Stat(v.VagrantfilePath); os.IsNotExist(err) { - // Makes Destroy idempotent if called consecutively multiple times on - // the same path. - // - // Returning closed channel to not make existing like the one - // below hang: - // - // ch, err := vg.Destroy() - // if err != nil { - // ... - // } - // for line := range ch { - // ... - // } - // - ch := make(chan *CommandOutput) - close(ch) - - return ch, nil - } - - cmd := v.vagrantCommand() - cmd.onSuccess = func() { - // cleanup vagrant directory on success, as it's no longer needed; - // after destroy it should be not possible to call vagrant up - // again, call to Create is required first - if err := os.RemoveAll(v.VagrantfilePath); err != nil { - v.debugf("failed to cleanup %q after destroy: %s", v.VagrantfilePath, err) - } - - // We leave empty directory to not make other commands fail - // due to missing cwd. - // - // TODO(rjeczalik): rework lookup to use box id instead - if err := os.MkdirAll(v.VagrantfilePath, 0755); err != nil { - v.debugf("failed to create empty dir %q after destroy: %s", v.VagrantfilePath, err) - } - } - // if vagrant box is not created, return success - the destroy - // should be effectively a nop - cmd.ignoreErr = isNotCreated - - return cmd.start("destroy", "--force") -} - -var stripFmt = strings.NewReplacer("(", "", ",", "", ")", "") - -// BoxList executes "vagrant box list", parses the output and returns all -// available base boxes. -func (v *Vagrant) BoxList() ([]*Box, error) { - out, err := v.vagrantCommand().run("box", "list") - if err != nil { - return nil, err - } - - var boxes []*Box - scanner := bufio.NewScanner(strings.NewReader(out)) - - for scanner.Scan() { - line := strings.TrimSpace(stripFmt.Replace(scanner.Text())) - if line == "" { - continue - } - - var box Box - n, err := fmt.Sscanf(line, "%s %s %s", &box.Name, &box.Provider, &box.Version) - if err != nil { - return nil, v.errorf("%s for line: %s", err, line) - } - if n != 3 { - return nil, v.errorf("unable to parse output line: %s", line) - } - - boxes = append(boxes, &box) - } - if err := scanner.Err(); err != nil { - return nil, v.error(err) - } - - return boxes, nil -} - -// BoxAdd executes "vagrant box add" for the given box. The returned channel -// contains the output stream. At the end of the output, the error is put into -// the Error field if there is any. -// -// TODO(rjeczalik): BoxAdd does not support currently adding boxes directly -// from files. -func (v *Vagrant) BoxAdd(box *Box) (<-chan *CommandOutput, error) { - args := append([]string{"box", "add"}, toArgs(box)...) - return v.vagrantCommand().start(args...) -} - -// BoxRemove executes "vagrant box remove" for the given box. The returned channel -// contains the output stream. At the end of the output, the error is put into -// the Error field if there is any. -func (v *Vagrant) BoxRemove(box *Box) (<-chan *CommandOutput, error) { - args := append([]string{"box", "remove"}, toArgs(box)...) - return v.vagrantCommand().start(args...) -} - -// SSH executes "vagrant ssh" for the given vagrantfile. The returned channel -// contains the output stream. At the end of the output, the error is put into -// the Error field if there is any. -func (v *Vagrant) SSH(command string) (<-chan *CommandOutput, error) { - args := []string{"ssh", "-c", command} - return v.vagrantCommand().start(args...) -} - -// vagrantfile returns the Vagrantfile path -func (v *Vagrant) vagrantfile() string { - return filepath.Join(v.VagrantfilePath, "Vagrantfile") -} - -// vagrantfileExists checks if a Vagrantfile exists in the given path. It -// returns a nil error if exists. -func (v *Vagrant) vagrantfileExists() error { - if _, err := os.Stat(v.vagrantfile()); os.IsNotExist(err) { - return err - } - return nil -} - -// vagrantCommand creates a command which is setup to be run next to -// Vagrantfile -func (v *Vagrant) vagrantCommand() *command { - return newCommand(v.VagrantfilePath) -} - -func (v *Vagrant) debugf(format string, args ...interface{}) { - // if v.Log != nil { - log.Printf(format, args...) - // } -} - -func (v *Vagrant) errorf(format string, args ...interface{}) error { - err := fmt.Errorf(format, args...) - v.debugf("%s", err) - return err -} - -func (v *Vagrant) error(err error) error { - if err != nil { - v.debugf("%s", err) - } - return err -} - -// Runs "ssh-config" and returns the output. -func (v *Vagrant) SSHConfig() (string, error) { - out, err := v.vagrantCommand().run("ssh-config") - if err != nil { - return "", err - } - return out, nil -} - -// toArgs converts the given box to argument list for `vagrant box add/remove` -// commands -func toArgs(box *Box) (args []string) { - if box.Provider != "" { - args = append(args, "--provider", box.Provider) - } - if box.Version != "" { - args = append(args, "--box-version", box.Version) - } - return append(args, box.Name) -} - -// toStatus converts the given state string to Status type -func toStatus(state string) (Status, error) { - switch state { - case "running": - return Running, nil - case "not_created": - return NotCreated, nil - case "saved": - return Saved, nil - case "poweroff": - return PowerOff, nil - case "aborted": - return Aborted, nil - case "preparing": - return Preparing, nil - default: - return Unknown, fmt.Errorf("Unknown state: %s", state) - } - -} From 6ba28396bafb5a4ae0a4c9958fe16fae36c52ab9 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 09:39:47 -0500 Subject: [PATCH 03/46] Mark the art command hidden --- CHANGELOG.md | 1 + ziti/cmd/ziti/cmd/art.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5bbff075..2b89f7722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * The update command has been removed. It was non-functional, so this should not affect anyone * The adhoc, ping and playbook commands have been removed. These were ansible and vagrant commands that were not widely used. +* Make the art command hidden, doesn't need to be removed, leave it as an easter egg # Release 0.26.11 diff --git a/ziti/cmd/ziti/cmd/art.go b/ziti/cmd/ziti/cmd/art.go index 201befee3..7c2b5dd79 100644 --- a/ziti/cmd/ziti/cmd/art.go +++ b/ziti/cmd/ziti/cmd/art.go @@ -40,8 +40,9 @@ func NewCmdArt(out io.Writer, errOut io.Writer) *cobra.Command { } cmd := &cobra.Command{ - Use: "art", - Short: "Print the Ziti logo as ascii art :)", + Use: "art", + Short: "Print the Ziti logo as ascii art :)", + Hidden: true, Run: func(cmd *cobra.Command, args []string) { options.Cmd = cmd options.Args = args From 3e4e869ef680414e4a50bed25ca49021282bffff Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 10:05:19 -0500 Subject: [PATCH 04/46] Consolidate agent code under agentcli. Move ps command under agent. --- CHANGELOG.md | 1 + ziti/cmd/ziti/cmd/agent.go | 75 ----- ziti/cmd/ziti/cmd/agentcli/agent.go | 48 +++- .../cmd/{ => agentcli}/agent_ch_simple.go | 9 +- .../{ => agentcli}/agent_controller_init.go | 7 +- .../agent_controller_raft_join.go | 7 +- .../agent_controller_raft_list.go | 9 +- ziti/cmd/ziti/cmd/agentcli/agent_ps.go | 262 ++++++++++++++++++ .../{ => agentcli}/agent_router_add_route.go | 11 +- .../agent_router_forget_link.go | 9 +- .../ziti/cmd/{ => agentcli}/agent_simple.go | 7 +- ziti/cmd/ziti/cmd/cmd.go | 5 +- ziti/cmd/ziti/cmd/ps.go | 148 ---------- ziti/goprocess/gp.go | 141 ---------- ziti/util/util.go | 74 ----- 15 files changed, 338 insertions(+), 475 deletions(-) delete mode 100644 ziti/cmd/ziti/cmd/agent.go rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_ch_simple.go (94%) rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_controller_init.go (95%) rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_controller_raft_join.go (95%) rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_controller_raft_list.go (95%) create mode 100644 ziti/cmd/ziti/cmd/agentcli/agent_ps.go rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_router_add_route.go (94%) rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_router_forget_link.go (95%) rename ziti/cmd/ziti/cmd/{ => agentcli}/agent_simple.go (92%) delete mode 100644 ziti/cmd/ziti/cmd/ps.go delete mode 100644 ziti/goprocess/gp.go delete mode 100644 ziti/util/util.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b89f7722..7112ac11f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * The update command has been removed. It was non-functional, so this should not affect anyone * The adhoc, ping and playbook commands have been removed. These were ansible and vagrant commands that were not widely used. * Make the art command hidden, doesn't need to be removed, leave it as an easter egg +* Move ziti ps command under ziti agent. Remove all ziti ps subcommands, as they already exist as ziti agent subcommands # Release 0.26.11 diff --git a/ziti/cmd/ziti/cmd/agent.go b/ziti/cmd/ziti/cmd/agent.go deleted file mode 100644 index 932585ac7..000000000 --- a/ziti/cmd/ziti/cmd/agent.go +++ /dev/null @@ -1,75 +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 ( - "github.com/openziti/edge/router/debugops" - "github.com/openziti/fabric/controller" - "github.com/openziti/fabric/pb/mgmt_pb" - "github.com/openziti/fabric/router" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/spf13/cobra" -) - -type AgentAppId byte - -const ( - AgentAppController = AgentAppId(controller.AgentAppId) - AgentAppRouter = AgentAppId(router.AgentAppId) -) - -func NewAgentCmd(p common.OptionsProvider) *cobra.Command { - agentCmd := agentcli.NewAgentCmd(p) - - ctrlCmd := &cobra.Command{ - Use: "controller", - Aliases: []string{"c"}, - Short: "Interact with a ziti-controller process using the IPC agent", - Run: func(cmd *cobra.Command, args []string) { - cmdhelper.CheckErr(cmd.Help()) - }, - } - - agentCmd.AddCommand(ctrlCmd) - ctrlCmd.AddCommand(NewSimpleChAgentCustomCmd("snapshot-db", AgentAppController, int32(mgmt_pb.ContentType_SnapshotDbRequestType), p)) - ctrlCmd.AddCommand(NewAgentCtrlRaftJoin(p)) - ctrlCmd.AddCommand(NewAgentCtrlRaftList(p)) - ctrlCmd.AddCommand(NewAgentCtrlInit(p)) - - routerCmd := &cobra.Command{ - Use: "router", - Aliases: []string{"r"}, - Short: "Interact with a ziti-router process using the IPC agent", - Run: func(cmd *cobra.Command, args []string) { - cmdhelper.CheckErr(cmd.Help()) - }, - } - - agentCmd.AddCommand(routerCmd) - - routerCmd.AddCommand(NewRouteCmd(p)) - routerCmd.AddCommand(NewSimpleAgentCustomCmd("dump-routes", AgentAppRouter, router.DumpForwarderTables, p)) - routerCmd.AddCommand(NewSimpleAgentCustomCmd("disconnect", AgentAppRouter, router.CloseControlChannel, p)) - routerCmd.AddCommand(NewSimpleAgentCustomCmd("reconnect", AgentAppRouter, router.OpenControlChannel, p)) - routerCmd.AddCommand(NewSimpleAgentCustomCmd("dump-api-sessions", AgentAppRouter, debugops.DumpApiSessions, p)) - routerCmd.AddCommand(NewSimpleAgentCustomCmd("dump-links", AgentAppRouter, router.DumpLinks, p)) - routerCmd.AddCommand(NewForgetLinkAgentCmd(p)) - - return agentCmd -} diff --git a/ziti/cmd/ziti/cmd/agentcli/agent.go b/ziti/cmd/ziti/cmd/agentcli/agent.go index 1a2920072..6c39b6ea7 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent.go @@ -1,8 +1,12 @@ package agentcli import ( - "github.com/openziti/channel/v2" "github.com/openziti/agent" + "github.com/openziti/channel/v2" + "github.com/openziti/edge/router/debugops" + "github.com/openziti/fabric/controller" + "github.com/openziti/fabric/pb/mgmt_pb" + "github.com/openziti/fabric/router" "github.com/openziti/identity" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" @@ -11,6 +15,13 @@ import ( "time" ) +type AgentAppId byte + +const ( + AgentAppController = AgentAppId(controller.AgentAppId) + AgentAppRouter = AgentAppId(router.AgentAppId) +) + func NewAgentCmd(p common.OptionsProvider) *cobra.Command { agentCmd := &cobra.Command{ Use: "agent", @@ -20,6 +31,7 @@ func NewAgentCmd(p common.OptionsProvider) *cobra.Command { }, } + agentCmd.AddCommand(NewPsCmd(p)) agentCmd.AddCommand(NewGoVersionCmd(p)) agentCmd.AddCommand(NewGcCmd(p)) agentCmd.AddCommand(NewSetGcCmd(p)) @@ -33,6 +45,40 @@ func NewAgentCmd(p common.OptionsProvider) *cobra.Command { agentCmd.AddCommand(NewSetChannelLogLevelCmd(p)) agentCmd.AddCommand(NewClearChannelLogLevelCmd(p)) + ctrlCmd := &cobra.Command{ + Use: "controller", + Aliases: []string{"c"}, + Short: "Interact with a ziti-controller process using the IPC agent", + Run: func(cmd *cobra.Command, args []string) { + cmdhelper.CheckErr(cmd.Help()) + }, + } + + agentCmd.AddCommand(ctrlCmd) + ctrlCmd.AddCommand(NewSimpleChAgentCustomCmd("snapshot-db", AgentAppController, int32(mgmt_pb.ContentType_SnapshotDbRequestType), p)) + ctrlCmd.AddCommand(NewAgentCtrlRaftJoin(p)) + ctrlCmd.AddCommand(NewAgentCtrlRaftList(p)) + ctrlCmd.AddCommand(NewAgentCtrlInit(p)) + + routerCmd := &cobra.Command{ + Use: "router", + Aliases: []string{"r"}, + Short: "Interact with a ziti-router process using the IPC agent", + Run: func(cmd *cobra.Command, args []string) { + cmdhelper.CheckErr(cmd.Help()) + }, + } + + agentCmd.AddCommand(routerCmd) + + routerCmd.AddCommand(NewRouteCmd(p)) + routerCmd.AddCommand(NewSimpleAgentCustomCmd("dump-routes", AgentAppRouter, router.DumpForwarderTables, p)) + routerCmd.AddCommand(NewSimpleAgentCustomCmd("disconnect", AgentAppRouter, router.CloseControlChannel, p)) + routerCmd.AddCommand(NewSimpleAgentCustomCmd("reconnect", AgentAppRouter, router.OpenControlChannel, p)) + routerCmd.AddCommand(NewSimpleAgentCustomCmd("dump-api-sessions", AgentAppRouter, debugops.DumpApiSessions, p)) + routerCmd.AddCommand(NewSimpleAgentCustomCmd("dump-links", AgentAppRouter, router.DumpLinks, p)) + routerCmd.AddCommand(NewForgetLinkAgentCmd(p)) + return agentCmd } diff --git a/ziti/cmd/ziti/cmd/agent_ch_simple.go b/ziti/cmd/ziti/cmd/agentcli/agent_ch_simple.go similarity index 94% rename from ziti/cmd/ziti/cmd/agent_ch_simple.go rename to ziti/cmd/ziti/cmd/agentcli/agent_ch_simple.go index be69c8fd8..a95323274 100644 --- a/ziti/cmd/ziti/cmd/agent_ch_simple.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_ch_simple.go @@ -14,14 +14,13 @@ limitations under the License. */ -package cmd +package agentcli import ( "fmt" - "github.com/openziti/channel/v2" "github.com/openziti/agent" + "github.com/openziti/channel/v2" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" @@ -30,13 +29,13 @@ import ( ) type SimpleChAgentCmdOptions struct { - agentcli.AgentOptions + AgentOptions requestType int32 } func NewSimpleChAgentCustomCmd(name string, appId AgentAppId, op int32, p common.OptionsProvider) *cobra.Command { options := &SimpleChAgentCmdOptions{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, requestType: op, diff --git a/ziti/cmd/ziti/cmd/agent_controller_init.go b/ziti/cmd/ziti/cmd/agentcli/agent_controller_init.go similarity index 95% rename from ziti/cmd/ziti/cmd/agent_controller_init.go rename to ziti/cmd/ziti/cmd/agentcli/agent_controller_init.go index f67f8e96f..bf3dc5779 100644 --- a/ziti/cmd/ziti/cmd/agent_controller_init.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_controller_init.go @@ -14,7 +14,7 @@ limitations under the License. */ -package cmd +package agentcli import ( "fmt" @@ -23,7 +23,6 @@ import ( "github.com/openziti/channel/v2/protobufs" "github.com/openziti/edge/pb/edge_mgmt_pb" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" @@ -32,12 +31,12 @@ import ( ) type AgentCtrlInitOptions struct { - agentcli.AgentOptions + AgentOptions } func NewAgentCtrlInit(p common.OptionsProvider) *cobra.Command { options := &AgentCtrlInitOptions{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, } diff --git a/ziti/cmd/ziti/cmd/agent_controller_raft_join.go b/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_join.go similarity index 95% rename from ziti/cmd/ziti/cmd/agent_controller_raft_join.go rename to ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_join.go index 8aa981b28..d53141001 100644 --- a/ziti/cmd/ziti/cmd/agent_controller_raft_join.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_join.go @@ -14,7 +14,7 @@ limitations under the License. */ -package cmd +package agentcli import ( "fmt" @@ -23,7 +23,6 @@ import ( "github.com/openziti/fabric/controller" "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" @@ -32,14 +31,14 @@ import ( ) type AgentCtrlRaftJoinOptions struct { - agentcli.AgentOptions + AgentOptions Voter bool MemberId string } func NewAgentCtrlRaftJoin(p common.OptionsProvider) *cobra.Command { options := &AgentCtrlRaftJoinOptions{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, } diff --git a/ziti/cmd/ziti/cmd/agent_controller_raft_list.go b/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_list.go similarity index 95% rename from ziti/cmd/ziti/cmd/agent_controller_raft_list.go rename to ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_list.go index 46ff2e6d0..c615fe2fc 100644 --- a/ziti/cmd/ziti/cmd/agent_controller_raft_list.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_list.go @@ -14,16 +14,15 @@ limitations under the License. */ -package cmd +package agentcli import ( "fmt" "github.com/golang/protobuf/proto" + "github.com/openziti/agent" "github.com/openziti/channel/v2" "github.com/openziti/fabric/pb/mgmt_pb" - "github.com/openziti/agent" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" @@ -32,12 +31,12 @@ import ( ) type AgentCtrlRaftListOptions struct { - agentcli.AgentOptions + AgentOptions } func NewAgentCtrlRaftList(p common.OptionsProvider) *cobra.Command { options := &AgentCtrlRaftListOptions{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, } diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_ps.go b/ziti/cmd/ziti/cmd/agentcli/agent_ps.go new file mode 100644 index 000000000..f29666c8c --- /dev/null +++ b/ziti/cmd/ziti/cmd/agentcli/agent_ps.go @@ -0,0 +1,262 @@ +/* + 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 agentcli + +import ( + "bytes" + "fmt" + "github.com/keybase/go-ps" + "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "os" + "os/user" + "path/filepath" + "regexp" + goversion "rsc.io/goversion/version" + "runtime" + "strconv" + "strings" + "sync" + + cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" +) + +type AgentPsAction struct { + AgentOptions +} + +// NewPsCmd Pss a command object for the "Ps" command +func NewPsCmd(p common.OptionsProvider) *cobra.Command { + action := &AgentPsAction{ + AgentOptions: AgentOptions{ + CommonOptions: p(), + }, + } + + cmd := &cobra.Command{ + Use: "ps", + Short: "Show Ziti process info", + Long: "Show information about currently running Ziti processes", + Run: func(cmd *cobra.Command, args []string) { + action.Cmd = cmd + action.Args = args + err := action.Run() + cmdhelper.CheckErr(err) + }, + } + + return cmd +} + +// Run implements this command +func (self *AgentPsAction) Run() error { + fmt.Println("ps is running") + ps := FindAll() + + var maxPID, maxPPID, maxExec, maxVersion int + for i, p := range ps { + + fmt.Println("p.Path is: " + p.Path) + + ps[i].BuildVersion = shortenVersion(p.BuildVersion) + maxPID = max(maxPID, len(strconv.Itoa(p.PID))) + maxPPID = max(maxPPID, len(strconv.Itoa(p.PPID))) + maxExec = max(maxExec, len(p.Exec)) + maxVersion = max(maxVersion, len(ps[i].BuildVersion)) + + } + + for _, p := range ps { + buf := bytes.NewBuffer(nil) + pid := strconv.Itoa(p.PID) + fmt.Fprint(buf, pad(pid, maxPID)) + fmt.Fprint(buf, " ") + + ppid := strconv.Itoa(p.PPID) + fmt.Fprint(buf, pad(ppid, maxPPID)) + fmt.Fprint(buf, " ") + + fmt.Fprint(buf, pad(p.Exec, maxExec)) + + if p.Agent { + fmt.Fprint(buf, "*") + } else { + fmt.Fprint(buf, " ") + } + fmt.Fprint(buf, " ") + + fmt.Fprint(buf, pad(p.BuildVersion, maxVersion)) + fmt.Fprint(buf, " ") + + fmt.Fprint(buf, p.Path) + fmt.Fprintln(buf) + buf.WriteTo(os.Stdout) + } + + return nil +} + +var develRe = regexp.MustCompile(`devel\s+\+\w+`) + +func shortenVersion(v string) string { + if !strings.HasPrefix(v, "devel") { + return v + } + results := develRe.FindAllString(v, 1) + if len(results) == 0 { + return v + } + return results[0] +} + +func pad(s string, total int) string { + if len(s) >= total { + return s + } + return s + strings.Repeat(" ", total-len(s)) +} + +func max(i, j int) int { + if i > j { + return i + } + return j +} + +// P represents a Go process. +type P struct { + PID int + PPID int + Exec string + Path string + BuildVersion string + Agent bool +} + +// FindAll returns all the Ziti processes currently running on this host. +func FindAll() []P { + pss, err := ps.Processes() + // fmt.Println("FindAll, err is: %s", err) + + if err != nil { + return nil + } + + var wg sync.WaitGroup + wg.Add(len(pss)) + found := make(chan P) + + for _, pr := range pss { + pr := pr + go func() { + defer wg.Done() + + path, version, agent, ok, err := isGo(pr) + if err != nil { + // TODO(jbd): Return a list of errors. + } + if !ok { + return + } + if isZiti(pr) { + found <- P{ + PID: pr.Pid(), + PPID: pr.PPid(), + Exec: pr.Executable(), + Path: path, + BuildVersion: version, + Agent: agent, + } + } + }() + } + go func() { + wg.Wait() + close(found) + }() + var results []P + for p := range found { + results = append(results, p) + } + return results +} + +// isGo looks up the runtime.buildVersion symbol +// in the process' binary and determines if the process +// if a Go process or not. If the process is a Go process, +// it reports PID, binary name and full path of the binary. +func isGo(pr ps.Process) (path, version string, agent, ok bool, err error) { + if pr.Pid() == 0 { + // ignore system process + return + } + path, err = pr.Path() + if err != nil { + return + } + var versionInfo goversion.Version + versionInfo, err = goversion.ReadExe(path) + if err != nil { + return + } + ok = true + version = versionInfo.Release + pidfile, err := PIDFile(pr.Pid()) + if err == nil { + _, err := os.Stat(pidfile) + agent = err == nil + } + return path, version, agent, ok, nil +} + +const gopsConfigDirEnvKey = "GOPS_CONFIG_DIR" + +func ConfigDir() (string, error) { + if configDir := os.Getenv(gopsConfigDirEnvKey); configDir != "" { + return configDir, nil + } + + if runtime.GOOS == "windows" { + return filepath.Join(os.Getenv("APPDATA"), "gops"), nil + } + homeDir := guessUnixHomeDir() + if homeDir == "" { + return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty") + } + return filepath.Join(homeDir, ".config", "gops"), nil +} + +func guessUnixHomeDir() string { + usr, err := user.Current() + if err == nil { + return usr.HomeDir + } + return os.Getenv("HOME") +} + +func PIDFile(pid int) (string, error) { + gopsdir, err := ConfigDir() + if err != nil { + return "", err + } + return fmt.Sprintf("%s/%d", gopsdir, pid), nil +} + +func isZiti(pr ps.Process) (ok bool) { + return strings.HasPrefix(pr.Executable(), "ziti") +} diff --git a/ziti/cmd/ziti/cmd/agent_router_add_route.go b/ziti/cmd/ziti/cmd/agentcli/agent_router_add_route.go similarity index 94% rename from ziti/cmd/ziti/cmd/agent_router_add_route.go rename to ziti/cmd/ziti/cmd/agentcli/agent_router_add_route.go index 5277ae8b4..c604c20ae 100644 --- a/ziti/cmd/ziti/cmd/agent_router_add_route.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_router_add_route.go @@ -14,29 +14,28 @@ limitations under the License. */ -package cmd +package agentcli import ( "encoding/binary" - "google.golang.org/protobuf/proto" + "github.com/openziti/agent" "github.com/openziti/fabric/pb/ctrl_pb" "github.com/openziti/fabric/router" - "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" + "google.golang.org/protobuf/proto" "os" ) type AgentRouteAction struct { - agentcli.AgentOptions + AgentOptions CtrlListener string } func NewRouteCmd(p common.OptionsProvider) *cobra.Command { options := &AgentRouteAction{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, } diff --git a/ziti/cmd/ziti/cmd/agent_router_forget_link.go b/ziti/cmd/ziti/cmd/agentcli/agent_router_forget_link.go similarity index 95% rename from ziti/cmd/ziti/cmd/agent_router_forget_link.go rename to ziti/cmd/ziti/cmd/agentcli/agent_router_forget_link.go index e8a7e70dd..8895ac0fd 100644 --- a/ziti/cmd/ziti/cmd/agent_router_forget_link.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_router_forget_link.go @@ -14,16 +14,15 @@ limitations under the License. */ -package cmd +package agentcli import ( "fmt" + "github.com/openziti/agent" "github.com/openziti/channel/v2" "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/fabric/router" - "github.com/openziti/agent" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" @@ -32,12 +31,12 @@ import ( ) type ForgetLinkAgentAction struct { - agentcli.AgentOptions + AgentOptions } func NewForgetLinkAgentCmd(p common.OptionsProvider) *cobra.Command { options := &ForgetLinkAgentAction{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, } diff --git a/ziti/cmd/ziti/cmd/agent_simple.go b/ziti/cmd/ziti/cmd/agentcli/agent_simple.go similarity index 92% rename from ziti/cmd/ziti/cmd/agent_simple.go rename to ziti/cmd/ziti/cmd/agentcli/agent_simple.go index 7aa4e20ad..a0fbded07 100644 --- a/ziti/cmd/ziti/cmd/agent_simple.go +++ b/ziti/cmd/ziti/cmd/agentcli/agent_simple.go @@ -14,11 +14,10 @@ limitations under the License. */ -package cmd +package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" @@ -26,12 +25,12 @@ import ( ) type SimpleAgentAction struct { - agentcli.AgentOptions + AgentOptions } func NewSimpleAgentCustomCmd(name string, appId AgentAppId, op byte, p common.OptionsProvider) *cobra.Command { action := &SimpleAgentAction{ - AgentOptions: agentcli.AgentOptions{ + AgentOptions: AgentOptions{ CommonOptions: p(), }, } diff --git a/ziti/cmd/ziti/cmd/cmd.go b/ziti/cmd/ziti/cmd/cmd.go index 7ff1a2cb6..d2c1bffa1 100644 --- a/ziti/cmd/ziti/cmd/cmd.go +++ b/ziti/cmd/ziti/cmd/cmd.go @@ -19,6 +19,7 @@ package cmd import ( goflag "flag" "fmt" + "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" "io" "os" "path/filepath" @@ -124,8 +125,7 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com initCommands := NewCmdInit(out, err) createCommands := NewCmdCreate(out, err) executeCommands := NewCmdExecute(out, err) - agentCommands := NewAgentCmd(p) - psCommands := NewCmdPs(p) + agentCommands := agentcli.NewAgentCmd(p) pkiCommands := NewCmdPKI(out, err) fabricCommand := fabric.NewFabricCmd(p) edgeCommand := edge.NewCmdEdge(out, err) @@ -158,7 +158,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com Commands: []*cobra.Command{ executeCommands, agentCommands, - psCommands, pkiCommands, unwrapIdentityFileCommand, }, diff --git a/ziti/cmd/ziti/cmd/ps.go b/ziti/cmd/ziti/cmd/ps.go deleted file mode 100644 index b4ebb67b6..000000000 --- a/ziti/cmd/ziti/cmd/ps.go +++ /dev/null @@ -1,148 +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 ( - "bytes" - "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/spf13/cobra" - "os" - "regexp" - "strconv" - "strings" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/goprocess" -) - -type PsAction struct { - agentcli.AgentOptions -} - -// NewCmdPs Pss a command object for the "Ps" command -func NewCmdPs(p common.OptionsProvider) *cobra.Command { - action := &PsAction{ - AgentOptions: agentcli.AgentOptions{ - CommonOptions: p(), - }, - } - - cmd := &cobra.Command{ - Use: "ps", - Short: "Show Ziti process info", - Long: "Show information about currently running Ziti preocesses", - Run: func(cmd *cobra.Command, args []string) { - action.Cmd = cmd - action.Args = args - err := action.Run() - cmdhelper.CheckErr(err) - }, - } - - cmd.AddCommand(agentcli.NewGetCmd(p)) - cmd.AddCommand(agentcli.NewGoVersionCmd(p)) - cmd.AddCommand(agentcli.NewGcCmd(p)) - cmd.AddCommand(agentcli.NewSetGcCmd(p)) - cmd.AddCommand(agentcli.NewStackCmd(p)) - cmd.AddCommand(agentcli.NewMemstatsCmd(p)) - cmd.AddCommand(agentcli.NewStatsCmd(p)) - cmd.AddCommand(agentcli.NewPprofHeapCmd(p)) - cmd.AddCommand(agentcli.NewPprofCpuCmd(p)) - cmd.AddCommand(agentcli.NewTraceCmd(p)) - cmd.AddCommand(agentcli.NewSetLogLevelCmd(p)) - cmd.AddCommand(agentcli.NewSetChannelLogLevelCmd(p)) - cmd.AddCommand(agentcli.NewClearChannelLogLevelCmd(p)) - - return cmd -} - -// Run implements this command -func (self *PsAction) Run() error { - fmt.Println("ps is running") - ps := goprocess.FindAll() - - var maxPID, maxPPID, maxExec, maxVersion int - for i, p := range ps { - - fmt.Println("p.Path is: " + p.Path) - - ps[i].BuildVersion = shortenVersion(p.BuildVersion) - maxPID = max(maxPID, len(strconv.Itoa(p.PID))) - maxPPID = max(maxPPID, len(strconv.Itoa(p.PPID))) - maxExec = max(maxExec, len(p.Exec)) - maxVersion = max(maxVersion, len(ps[i].BuildVersion)) - - } - - for _, p := range ps { - buf := bytes.NewBuffer(nil) - pid := strconv.Itoa(p.PID) - fmt.Fprint(buf, pad(pid, maxPID)) - fmt.Fprint(buf, " ") - - ppid := strconv.Itoa(p.PPID) - fmt.Fprint(buf, pad(ppid, maxPPID)) - fmt.Fprint(buf, " ") - - fmt.Fprint(buf, pad(p.Exec, maxExec)) - - if p.Agent { - fmt.Fprint(buf, "*") - } else { - fmt.Fprint(buf, " ") - } - fmt.Fprint(buf, " ") - - fmt.Fprint(buf, pad(p.BuildVersion, maxVersion)) - fmt.Fprint(buf, " ") - - fmt.Fprint(buf, p.Path) - fmt.Fprintln(buf) - buf.WriteTo(os.Stdout) - } - - return nil -} - -var develRe = regexp.MustCompile(`devel\s+\+\w+`) - -func shortenVersion(v string) string { - if !strings.HasPrefix(v, "devel") { - return v - } - results := develRe.FindAllString(v, 1) - if len(results) == 0 { - return v - } - return results[0] -} - -func pad(s string, total int) string { - if len(s) >= total { - return s - } - return s + strings.Repeat(" ", total-len(s)) -} - -func max(i, j int) int { - if i > j { - return i - } - return j -} diff --git a/ziti/goprocess/gp.go b/ziti/goprocess/gp.go deleted file mode 100644 index 65ea71b4f..000000000 --- a/ziti/goprocess/gp.go +++ /dev/null @@ -1,141 +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 goprocess - -import ( - // "fmt" - "os" - "strings" - "sync" - - goversion "rsc.io/goversion/version" - - "github.com/openziti/ziti/ziti/util" - ps "github.com/keybase/go-ps" -) - -// P represents a Go process. -type P struct { - PID int - PPID int - Exec string - Path string - BuildVersion string - Agent bool -} - -// FindAll returns all the Ziti processes currently running on this host. -func FindAll() []P { - pss, err := ps.Processes() - // fmt.Println("FindAll, err is: %s", err) - - if err != nil { - return nil - } - - var wg sync.WaitGroup - wg.Add(len(pss)) - found := make(chan P) - - for _, pr := range pss { - pr := pr - go func() { - defer wg.Done() - - path, version, agent, ok, err := isGo(pr) - if err != nil { - // TODO(jbd): Return a list of errors. - } - if !ok { - return - } - if isZiti(pr) { - found <- P{ - PID: pr.Pid(), - PPID: pr.PPid(), - Exec: pr.Executable(), - Path: path, - BuildVersion: version, - Agent: agent, - } - } - }() - } - go func() { - wg.Wait() - close(found) - }() - var results []P - for p := range found { - results = append(results, p) - } - return results -} - -// Find finds info about the process identified with the given PID. -func Find(pid int) (p P, ok bool, err error) { - pr, err := ps.FindProcess(pid) - if err != nil { - return P{}, false, err - } - path, version, agent, ok, err := isGo(pr) - if !ok { - return P{}, false, nil - } - return P{ - PID: pr.Pid(), - PPID: pr.PPid(), - Exec: pr.Executable(), - Path: path, - BuildVersion: version, - Agent: agent, - }, true, nil -} - -// isGo looks up the runtime.buildVersion symbol -// in the process' binary and determines if the process -// if a Go process or not. If the process is a Go process, -// it reports PID, binary name and full path of the binary. -func isGo(pr ps.Process) (path, version string, agent, ok bool, err error) { - if pr.Pid() == 0 { - // ignore system process - return - } - path, err = pr.Path() - if err != nil { - return - } - var versionInfo goversion.Version - versionInfo, err = goversion.ReadExe(path) - if err != nil { - return - } - ok = true - version = versionInfo.Release - pidfile, err := util.PIDFile(pr.Pid()) - if err == nil { - _, err := os.Stat(pidfile) - agent = err == nil - } - return path, version, agent, ok, nil -} - -func isZiti(pr ps.Process) (ok bool) { - // fmt.Println("isZiti, pr.Executable(): %s", pr.Executable()) - - return strings.HasPrefix(pr.Executable(), "ziti-") -} diff --git a/ziti/util/util.go b/ziti/util/util.go deleted file mode 100644 index e20959678..000000000 --- a/ziti/util/util.go +++ /dev/null @@ -1,74 +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 util - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - "os/user" - "path/filepath" - "runtime" - "strings" -) - -const gopsConfigDirEnvKey = "GOPS_CONFIG_DIR" - -func ConfigDir() (string, error) { - if configDir := os.Getenv(gopsConfigDirEnvKey); configDir != "" { - return configDir, nil - } - - if runtime.GOOS == "windows" { - return filepath.Join(os.Getenv("APPDATA"), "gops"), nil - } - homeDir := guessUnixHomeDir() - if homeDir == "" { - return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty") - } - return filepath.Join(homeDir, ".config", "gops"), nil -} - -func guessUnixHomeDir() string { - usr, err := user.Current() - if err == nil { - return usr.HomeDir - } - return os.Getenv("HOME") -} - -func PIDFile(pid int) (string, error) { - gopsdir, err := ConfigDir() - if err != nil { - return "", err - } - return fmt.Sprintf("%s/%d", gopsdir, pid), nil -} - -func GetPort(pid int) (string, error) { - portfile, err := PIDFile(pid) - if err != nil { - return "", err - } - b, err := ioutil.ReadFile(portfile) - if err != nil { - return "", err - } - port := strings.TrimSpace(string(b)) - return port, nil -} From 6068ca0beae3be53ee91183491a4dfee848fd3f7 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 10:43:57 -0500 Subject: [PATCH 05/46] Flatten ziti tree. Move ziti/cmd/ziti/* -> ziti/ --- common/enrollment/enroll.go | 4 +- doc/003-local-deploy.md | 15 ++++-- ziti-controller/main.go | 4 +- ziti-router/main.go | 4 +- ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go | 8 +-- ziti/cmd/{ziti/cmd => }/agentcli/agent.go | 4 +- .../cmd => }/agentcli/agent_ch_simple.go | 4 +- .../agentcli/agent_clear_channel_log_level.go | 4 +- .../agentcli/agent_controller_init.go | 4 +- .../agentcli/agent_controller_raft_join.go | 4 +- .../agentcli/agent_controller_raft_list.go | 4 +- ziti/cmd/{ziti/cmd => }/agentcli/agent_gc.go | 4 +- ziti/cmd/{ziti/cmd => }/agentcli/agent_get.go | 7 ++- .../agentcli/agent_go_version_action.go | 4 +- .../{ziti/cmd => }/agentcli/agent_memstats.go | 4 +- .../cmd => }/agentcli/agent_pprof_cpu.go | 4 +- .../cmd => }/agentcli/agent_pprof_heap.go | 4 +- ziti/cmd/{ziti/cmd => }/agentcli/agent_ps.go | 5 +- .../agentcli/agent_router_add_route.go | 4 +- .../agentcli/agent_router_forget_link.go | 4 +- .../agentcli/agent_set_channel_log_level.go | 4 +- .../cmd => }/agentcli/agent_set_log_level.go | 4 +- .../{ziti/cmd => }/agentcli/agent_setgc.go | 4 +- .../{ziti/cmd => }/agentcli/agent_simple.go | 4 +- .../{ziti/cmd => }/agentcli/agent_stack.go | 4 +- .../{ziti/cmd => }/agentcli/agent_stats.go | 4 +- .../{ziti/cmd => }/agentcli/agent_trace.go | 4 +- ziti/cmd/{ziti/cmd => }/api/delete.go | 2 +- ziti/cmd/{ziti/cmd => }/api/json.go | 0 ziti/cmd/{ziti/cmd => }/api/list.go | 2 +- ziti/cmd/{ziti/cmd => }/api/options.go | 2 +- ziti/cmd/{ziti/cmd => }/api/ws.go | 2 +- ziti/cmd/{ziti/cmd => }/art.go | 5 +- ziti/cmd/{ziti/cmd => }/cmd.go | 25 ++++----- ziti/cmd/{ziti/cmd => }/color/color.go | 2 +- ziti/cmd/{ziti/cmd => }/common.go | 0 ziti/cmd/{ziti/cmd => }/common/options.go | 0 ziti/cmd/{ziti/cmd => }/common_commands.go | 5 +- ziti/cmd/{ziti/cmd => }/common_init.go | 4 +- ziti/cmd/{ziti/cmd => }/common_install.go | 6 +-- .../cmd/{ziti/cmd => }/common_install_test.go | 2 +- .../cmd => }/config_templates/controller.yml | 0 .../cmd => }/config_templates/environment.yml | 0 .../cmd => }/config_templates/router.yml | 0 ziti/cmd/{ziti/cmd => }/create.go | 5 +- ziti/cmd/{ziti/cmd => }/create_config.go | 32 ++++++------ .../cmd => }/create_config_controller.go | 28 +++++----- .../cmd => }/create_config_controller_test.go | 0 .../cmd => }/create_config_environment.go | 6 +-- .../{ziti/cmd => }/create_config_router.go | 2 +- .../cmd => }/create_config_router_common.go | 5 +- .../cmd => }/create_config_router_edge.go | 4 +- .../create_config_router_edge_test.go | 2 +- .../cmd => }/create_config_router_fabric.go | 4 +- .../create_config_router_fabric_test.go | 2 +- .../cmd => }/create_config_router_test.go | 2 +- ziti/cmd/{ziti/cmd => }/create_config_test.go | 0 ziti/cmd/{ziti/cmd => }/create_environment.go | 6 +-- ziti/cmd/{ziti/cmd => }/database/cmd.go | 2 +- ziti/cmd/{ziti/cmd => }/demo/echo-notes.txt | 0 ziti/cmd/{ziti/cmd => }/demo/echo_server.go | 2 +- .../demo/echo_server_update_terminator.go | 8 +-- ziti/cmd/{ziti/cmd => }/demo/root.go | 6 +-- ziti/cmd/{ziti/cmd => }/demo/setup-client.go | 8 +-- ...up-multi-router-tunneler-hosted-service.go | 8 +-- .../cmd => }/demo/setup-multi-sdk-service.go | 8 +-- .../setup-multi-tunneler-hosted-service.go | 8 +-- .../demo/setup-router-tunneler-both-sides.go | 8 +-- .../multi-router-tunneler-hosted.md | 0 .../demo/setup-scripts/multi-sdk-hosted.md | 0 .../setup-scripts/multi-tunneler-hosted.md | 0 .../router-tunneler-both-sides.md | 0 .../cmd => }/demo/setup-scripts/sdk-client.md | 0 .../single-router-tunneler-hosted.md | 0 .../demo/setup-scripts/single-sdk-hosted.md | 0 .../update-config-addressable.md | 0 .../demo/setup-scripts/update-config-ha.md | 0 ...p-single-router-tunneler-hosted-service.go | 8 +-- .../cmd => }/demo/setup-single-sdk-service.go | 8 +-- .../demo/setup-update-config-addressable.go | 8 +-- .../cmd => }/demo/setup-update-config-ha.go | 8 +-- ziti/cmd/{ziti/cmd => }/demo/zcat.go | 0 ziti/cmd/{ziti/cmd => }/edge/common.go | 2 +- ziti/cmd/{ziti/cmd => }/edge/create.go | 6 +-- .../cmd => }/edge/create_authenticator.go | 4 +- .../edge/create_authenticator_updb.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/create_ca.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/create_config.go | 6 +-- .../{ziti/cmd => }/edge/create_config_type.go | 6 +-- .../{ziti/cmd => }/edge/create_edge_router.go | 7 ++- .../edge/create_edge_router_policy.go | 6 +-- .../{ziti/cmd => }/edge/create_enrollment.go | 8 +-- .../{ziti/cmd => }/edge/create_identity.go | 6 +-- .../cmd => }/edge/create_posture_check.go | 8 +-- .../cmd/{ziti/cmd => }/edge/create_service.go | 6 +-- .../edge/create_service_edge_router_policy.go | 6 +-- .../cmd => }/edge/create_service_policy.go | 6 +-- .../{ziti/cmd => }/edge/create_terminator.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/db.go | 2 +- .../{ziti/cmd => }/edge/db_check_integrity.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/db_snapshot.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/delete.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/detail.go | 2 +- .../cmd/{ziti/cmd => }/edge/encryption_var.go | 0 ziti/cmd/{ziti/cmd => }/edge/list.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/login.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/logout.go | 8 +-- .../cmd/{ziti/cmd => }/edge/policy_advisor.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/root.go | 5 +- ziti/cmd/{ziti/cmd => }/edge/show.go | 8 +-- .../cmd/{ziti/cmd => }/edge/trace_identity.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/traceroute.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/update.go | 6 +-- .../cmd => }/edge/update_authenticator.go | 4 +- .../edge/update_authenticator_updb.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/update_ca.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/update_config.go | 6 +-- .../{ziti/cmd => }/edge/update_config_type.go | 6 +-- .../{ziti/cmd => }/edge/update_edge_router.go | 7 ++- .../edge/update_edge_router_policy.go | 6 +-- .../{ziti/cmd => }/edge/update_identity.go | 6 +-- .../cmd => }/edge/update_identity_configs.go | 6 +-- .../cmd => }/edge/update_posture_check.go | 6 +-- .../cmd/{ziti/cmd => }/edge/update_service.go | 6 +-- .../edge/update_service_edge_router_policy.go | 6 +-- .../cmd => }/edge/update_service_policy.go | 6 +-- .../{ziti/cmd => }/edge/update_terminator.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/use.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/verify.go | 6 +-- ziti/cmd/{ziti/cmd => }/edge/verify_ca.go | 8 +-- ziti/cmd/{ziti/cmd => }/edge/version.go | 8 +-- ziti/cmd/{ziti/cmd => }/execute.go | 5 +- ziti/cmd/{ziti/cmd => }/execute_controller.go | 8 +-- .../cmd/{ziti/cmd => }/fabric/add_identity.go | 4 +- .../{ziti/cmd => }/fabric/create_router.go | 5 +- .../{ziti/cmd => }/fabric/create_service.go | 4 +- .../cmd => }/fabric/create_terminator.go | 8 +-- ziti/cmd/{ziti/cmd => }/fabric/db.go | 4 +- .../cmd => }/fabric/db_check_integrity.go | 8 +-- ziti/cmd/{ziti/cmd => }/fabric/db_snapshot.go | 8 +-- ziti/cmd/{ziti/cmd => }/fabric/delete.go | 8 +-- ziti/cmd/{ziti/cmd => }/fabric/inspect.go | 6 +-- ziti/cmd/{ziti/cmd => }/fabric/list.go | 8 +-- .../{ziti/cmd => }/fabric/remove_identity.go | 6 +-- ziti/cmd/{ziti/cmd => }/fabric/root.go | 8 +-- .../{ziti/cmd => }/fabric/stream_circuits.go | 6 +-- .../{ziti/cmd => }/fabric/stream_metrics.go | 4 +- .../fabric/stream_toggle_pipe_traces.go | 6 +-- .../{ziti/cmd => }/fabric/stream_traces.go | 6 +-- ziti/cmd/{ziti/cmd => }/fabric/update_link.go | 6 +-- .../{ziti/cmd => }/fabric/update_router.go | 9 ++-- .../{ziti/cmd => }/fabric/update_service.go | 8 +-- .../cmd => }/fabric/update_terminator.go | 8 +-- .../cmd/{ziti/cmd => }/helpers/env_helpers.go | 2 +- ziti/cmd/{ziti/cmd => }/helpers/helpers.go | 0 .../{ziti/cmd => }/helpers/helpers_test.go | 0 ziti/cmd/{ziti/cmd => }/init.go | 6 +-- ziti/cmd/{ziti/cmd => }/install.go | 4 +- ...tall_terraform_provider_edge_controller.go | 8 +-- ziti/cmd/{ziti/cmd => }/install_ziti_ALL.go | 8 +-- .../{ziti/cmd => }/install_ziti_controller.go | 8 +-- .../cmd => }/install_ziti_edge_tunnel.go | 8 +-- .../cmd/{ziti/cmd => }/install_ziti_prox_c.go | 8 +-- .../cmd/{ziti/cmd => }/install_ziti_router.go | 8 +-- .../cmd/{ziti/cmd => }/install_ziti_tunnel.go | 8 +-- .../{ziti/cmd => }/lets_encrypt/KeyTypeVar.go | 0 .../{ziti/cmd => }/lets_encrypt/account.go | 0 .../cmd => }/lets_encrypt/accounts_storage.go | 43 ++++++++------- .../cmd => }/lets_encrypt/certs_storage.go | 15 +++--- .../cmd/{ziti/cmd => }/lets_encrypt/create.go | 4 +- ziti/cmd/{ziti/cmd => }/lets_encrypt/list.go | 2 +- ziti/cmd/{ziti/cmd => }/lets_encrypt/renew.go | 4 +- .../cmd/{ziti/cmd => }/lets_encrypt/revoke.go | 4 +- ziti/cmd/{ziti/cmd => }/lets_encrypt/root.go | 2 +- ziti/cmd/{ziti/cmd => }/lets_encrypt/setup.go | 2 +- ziti/cmd/{ziti/cmd => }/log_filter.go | 2 +- ziti/cmd/{ziti/cmd => }/pki.go | 9 ++-- ziti/cmd/{ziti/cmd => }/pki_create.go | 4 +- ziti/cmd/{ziti/cmd => }/pki_create_ca.go | 11 ++-- ziti/cmd/{ziti/cmd => }/pki_create_client.go | 11 ++-- ziti/cmd/{ziti/cmd => }/pki_create_csr.go | 9 ++-- .../{ziti/cmd => }/pki_create_intermediate.go | 11 ++-- ziti/cmd/{ziti/cmd => }/pki_create_key.go | 9 ++-- ziti/cmd/{ziti/cmd => }/pki_create_server.go | 4 +- ziti/cmd/{ziti/cmd => }/table/padding.go | 0 ziti/cmd/{ziti/cmd => }/table/table.go | 0 .../cmd => }/templates/command_groups.go | 0 ziti/cmd/{ziti/cmd => }/templates/markdown.go | 0 .../{ziti/cmd => }/templates/normalizers.go | 0 .../cmd/{ziti/cmd => }/templates/templater.go | 2 +- .../cmd/{ziti/cmd => }/templates/templates.go | 0 .../tutorial/first-service-tutorial.go | 6 +-- .../cmd => }/tutorial/plain_echo_client.go | 0 .../tutorial/plain_echo_client_cmd.go | 4 +- .../cmd => }/tutorial/plain_echo_server.go | 0 .../tutorial/plain_echo_server_cmd.go | 4 +- ziti/cmd/{ziti/cmd => }/tutorial/root.go | 6 +-- .../tutorial/tutorials/first-service.md | 0 .../cmd => }/tutorial/tutorials/more-info.md | 0 .../cmd => }/tutorial/ziti_echo_client.go | 0 .../cmd => }/tutorial/ziti_echo_client_cmd.go | 4 +- .../cmd => }/tutorial/ziti_echo_server.go | 0 .../cmd => }/tutorial/ziti_echo_server_cmd.go | 4 +- ziti/cmd/{ziti/cmd => }/uninstall.go | 4 +- .../cmd => }/uninstall_ziti_controller.go | 6 +-- .../cmd => }/uninstall_ziti_edge_tunnel.go | 6 +-- .../{ziti/cmd => }/uninstall_ziti_proxy_c.go | 6 +-- .../{ziti/cmd => }/uninstall_ziti_router.go | 6 +-- .../{ziti/cmd => }/uninstall_ziti_tunnel.go | 6 +-- ziti/cmd/{ziti/cmd => }/unwrap_identity.go | 0 ziti/cmd/{ziti/cmd => }/upgrade.go | 4 +- ziti/cmd/{ziti/cmd => }/upgrade_ziti.go | 6 +-- .../{ziti/cmd => }/upgrade_ziti_controller.go | 6 +-- .../cmd => }/upgrade_ziti_edge_tunnel.go | 6 +-- .../cmd/{ziti/cmd => }/upgrade_ziti_prox_c.go | 6 +-- .../cmd/{ziti/cmd => }/upgrade_ziti_router.go | 6 +-- .../cmd/{ziti/cmd => }/upgrade_ziti_tunnel.go | 6 +-- ziti/cmd/{ziti/cmd => }/use.go | 8 +-- ziti/cmd/{ziti/cmd => }/version.go | 11 ++-- ziti/cmd/ziti/main.go | 25 --------- ziti/{cmd/ziti => }/constants/constants.go | 0 .../controller}/delete_sessions.go | 2 +- .../subcmd => ziti/controller}/root.go | 6 +-- .../subcmd => ziti/controller}/run.go | 2 +- .../subcmd => ziti/controller}/version.go | 4 +- ziti/{cmd/ziti => }/internal/log/log.go | 0 ziti/main.go | 52 +++++++++++++++++++ ziti/pki/pki/pki.go | 4 +- ziti/pki/store/local.go | 23 ++++---- ziti/pki/store/store.go | 3 +- .../subcmd => ziti/router}/enrollgw.go | 2 +- {ziti-router/subcmd => ziti/router}/root.go | 6 +-- {ziti-router/subcmd => ziti/router}/run.go | 2 +- .../subcmd => ziti/router}/version.go | 4 +- ziti/{cmd/ziti => }/util/certs.go | 2 +- ziti/{cmd/ziti => }/util/colors.go | 0 ziti/{cmd/ziti => }/util/commands.go | 3 +- ziti/{cmd/ziti => }/util/dirs.go | 0 ziti/{cmd/ziti => }/util/files.go | 0 ziti/{cmd/ziti => }/util/identities.go | 2 +- ziti/{cmd/ziti => }/util/pickers.go | 2 +- ziti/{cmd/ziti => }/util/rest.go | 4 +- ziti/{cmd/ziti => }/util/session.go | 0 ziti/{cmd/ziti => }/util/strings.go | 0 ziti/{cmd/ziti => }/util/suggestions.go | 0 ziti/{cmd/ziti => }/util/updates.go | 2 +- 246 files changed, 655 insertions(+), 650 deletions(-) rename ziti/cmd/{ziti/cmd => }/agentcli/agent.go (96%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_ch_simple.go (95%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_clear_channel_log_level.go (94%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_controller_init.go (95%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_controller_raft_join.go (95%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_controller_raft_list.go (95%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_gc.go (92%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_get.go (93%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_go_version_action.go (92%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_memstats.go (92%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_pprof_cpu.go (93%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_pprof_heap.go (92%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_ps.go (97%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_router_add_route.go (94%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_router_forget_link.go (95%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_set_channel_log_level.go (95%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_set_log_level.go (94%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_setgc.go (93%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_simple.go (92%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_stack.go (93%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_stats.go (92%) rename ziti/cmd/{ziti/cmd => }/agentcli/agent_trace.go (92%) rename ziti/cmd/{ziti/cmd => }/api/delete.go (97%) rename ziti/cmd/{ziti/cmd => }/api/json.go (100%) rename ziti/cmd/{ziti/cmd => }/api/list.go (99%) rename ziti/cmd/{ziti/cmd => }/api/options.go (97%) rename ziti/cmd/{ziti/cmd => }/api/ws.go (97%) rename ziti/cmd/{ziti/cmd => }/art.go (96%) rename ziti/cmd/{ziti/cmd => }/cmd.go (90%) rename ziti/cmd/{ziti/cmd => }/color/color.go (98%) rename ziti/cmd/{ziti/cmd => }/common.go (100%) rename ziti/cmd/{ziti/cmd => }/common/options.go (100%) rename ziti/cmd/{ziti/cmd => }/common_commands.go (97%) rename ziti/cmd/{ziti/cmd => }/common_init.go (97%) rename ziti/cmd/{ziti/cmd => }/common_install.go (98%) rename ziti/cmd/{ziti/cmd => }/common_install_test.go (95%) rename ziti/cmd/{ziti/cmd => }/config_templates/controller.yml (100%) rename ziti/cmd/{ziti/cmd => }/config_templates/environment.yml (100%) rename ziti/cmd/{ziti/cmd => }/config_templates/router.yml (100%) rename ziti/cmd/{ziti/cmd => }/create.go (92%) rename ziti/cmd/{ziti/cmd => }/create_config.go (91%) rename ziti/cmd/{ziti/cmd => }/create_config_controller.go (92%) rename ziti/cmd/{ziti/cmd => }/create_config_controller_test.go (100%) rename ziti/cmd/{ziti/cmd => }/create_config_environment.go (98%) rename ziti/cmd/{ziti/cmd => }/create_config_router.go (97%) rename ziti/cmd/{ziti/cmd => }/create_config_router_common.go (96%) rename ziti/cmd/{ziti/cmd => }/create_config_router_edge.go (97%) rename ziti/cmd/{ziti/cmd => }/create_config_router_edge_test.go (99%) rename ziti/cmd/{ziti/cmd => }/create_config_router_fabric.go (96%) rename ziti/cmd/{ziti/cmd => }/create_config_router_fabric_test.go (99%) rename ziti/cmd/{ziti/cmd => }/create_config_router_test.go (99%) rename ziti/cmd/{ziti/cmd => }/create_config_test.go (100%) rename ziti/cmd/{ziti/cmd => }/create_environment.go (92%) rename ziti/cmd/{ziti/cmd => }/database/cmd.go (93%) rename ziti/cmd/{ziti/cmd => }/demo/echo-notes.txt (100%) rename ziti/cmd/{ziti/cmd => }/demo/echo_server.go (100%) rename ziti/cmd/{ziti/cmd => }/demo/echo_server_update_terminator.go (93%) rename ziti/cmd/{ziti/cmd => }/demo/root.go (93%) rename ziti/cmd/{ziti/cmd => }/demo/setup-client.go (91%) rename ziti/cmd/{ziti/cmd => }/demo/setup-multi-router-tunneler-hosted-service.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/setup-multi-sdk-service.go (91%) rename ziti/cmd/{ziti/cmd => }/demo/setup-multi-tunneler-hosted-service.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/setup-router-tunneler-both-sides.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/multi-router-tunneler-hosted.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/multi-sdk-hosted.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/multi-tunneler-hosted.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/router-tunneler-both-sides.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/sdk-client.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/single-router-tunneler-hosted.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/single-sdk-hosted.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/update-config-addressable.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-scripts/update-config-ha.md (100%) rename ziti/cmd/{ziti/cmd => }/demo/setup-single-router-tunneler-hosted-service.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/setup-single-sdk-service.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/setup-update-config-addressable.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/setup-update-config-ha.go (92%) rename ziti/cmd/{ziti/cmd => }/demo/zcat.go (100%) rename ziti/cmd/{ziti/cmd => }/edge/common.go (98%) rename ziti/cmd/{ziti/cmd => }/edge/create.go (92%) rename ziti/cmd/{ziti/cmd => }/edge/create_authenticator.go (92%) rename ziti/cmd/{ziti/cmd => }/edge/create_authenticator_updb.go (96%) rename ziti/cmd/{ziti/cmd => }/edge/create_ca.go (96%) rename ziti/cmd/{ziti/cmd => }/edge/create_config.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/create_config_type.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/create_edge_router.go (96%) rename ziti/cmd/{ziti/cmd => }/edge/create_edge_router_policy.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/create_enrollment.go (96%) rename ziti/cmd/{ziti/cmd => }/edge/create_identity.go (97%) rename ziti/cmd/{ziti/cmd => }/edge/create_posture_check.go (99%) rename ziti/cmd/{ziti/cmd => }/edge/create_service.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/create_service_edge_router_policy.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/create_service_policy.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/create_terminator.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/db.go (88%) rename ziti/cmd/{ziti/cmd => }/edge/db_check_integrity.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/db_snapshot.go (87%) rename ziti/cmd/{ziti/cmd => }/edge/delete.go (96%) rename ziti/cmd/{ziti/cmd => }/edge/detail.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/encryption_var.go (100%) rename ziti/cmd/{ziti/cmd => }/edge/list.go (99%) rename ziti/cmd/{ziti/cmd => }/edge/login.go (97%) rename ziti/cmd/{ziti/cmd => }/edge/logout.go (89%) rename ziti/cmd/{ziti/cmd => }/edge/policy_advisor.go (98%) rename ziti/cmd/{ziti/cmd => }/edge/root.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/show.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/trace_identity.go (94%) rename ziti/cmd/{ziti/cmd => }/edge/traceroute.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_authenticator.go (92%) rename ziti/cmd/{ziti/cmd => }/edge/update_authenticator_updb.go (97%) rename ziti/cmd/{ziti/cmd => }/edge/update_ca.go (97%) rename ziti/cmd/{ziti/cmd => }/edge/update_config.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_config_type.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_edge_router.go (96%) rename ziti/cmd/{ziti/cmd => }/edge/update_edge_router_policy.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_identity.go (97%) rename ziti/cmd/{ziti/cmd => }/edge/update_identity_configs.go (93%) rename ziti/cmd/{ziti/cmd => }/edge/update_posture_check.go (98%) rename ziti/cmd/{ziti/cmd => }/edge/update_service.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_service_edge_router_policy.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_service_policy.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/update_terminator.go (95%) rename ziti/cmd/{ziti/cmd => }/edge/use.go (90%) rename ziti/cmd/{ziti/cmd => }/edge/verify.go (89%) rename ziti/cmd/{ziti/cmd => }/edge/verify_ca.go (97%) rename ziti/cmd/{ziti/cmd => }/edge/version.go (89%) rename ziti/cmd/{ziti/cmd => }/execute.go (93%) rename ziti/cmd/{ziti/cmd => }/execute_controller.go (92%) rename ziti/cmd/{ziti/cmd => }/fabric/add_identity.go (96%) rename ziti/cmd/{ziti/cmd => }/fabric/create_router.go (96%) rename ziti/cmd/{ziti/cmd => }/fabric/create_service.go (95%) rename ziti/cmd/{ziti/cmd => }/fabric/create_terminator.go (94%) rename ziti/cmd/{ziti/cmd => }/fabric/db.go (80%) rename ziti/cmd/{ziti/cmd => }/fabric/db_check_integrity.go (94%) rename ziti/cmd/{ziti/cmd => }/fabric/db_snapshot.go (87%) rename ziti/cmd/{ziti/cmd => }/fabric/delete.go (95%) rename ziti/cmd/{ziti/cmd => }/fabric/inspect.go (96%) rename ziti/cmd/{ziti/cmd => }/fabric/list.go (97%) rename ziti/cmd/{ziti/cmd => }/fabric/remove_identity.go (91%) rename ziti/cmd/{ziti/cmd => }/fabric/root.go (94%) rename ziti/cmd/{ziti/cmd => }/fabric/stream_circuits.go (96%) rename ziti/cmd/{ziti/cmd => }/fabric/stream_metrics.go (97%) rename ziti/cmd/{ziti/cmd => }/fabric/stream_toggle_pipe_traces.go (96%) rename ziti/cmd/{ziti/cmd => }/fabric/stream_traces.go (98%) rename ziti/cmd/{ziti/cmd => }/fabric/update_link.go (92%) rename ziti/cmd/{ziti/cmd => }/fabric/update_router.go (93%) rename ziti/cmd/{ziti/cmd => }/fabric/update_service.go (92%) rename ziti/cmd/{ziti/cmd => }/fabric/update_terminator.go (94%) rename ziti/cmd/{ziti/cmd => }/helpers/env_helpers.go (99%) rename ziti/cmd/{ziti/cmd => }/helpers/helpers.go (100%) rename ziti/cmd/{ziti/cmd => }/helpers/helpers_test.go (100%) rename ziti/cmd/{ziti/cmd => }/init.go (92%) rename ziti/cmd/{ziti/cmd => }/install.go (94%) rename ziti/cmd/{ziti/cmd => }/install_terraform_provider_edge_controller.go (92%) rename ziti/cmd/{ziti/cmd => }/install_ziti_ALL.go (92%) rename ziti/cmd/{ziti/cmd => }/install_ziti_controller.go (91%) rename ziti/cmd/{ziti/cmd => }/install_ziti_edge_tunnel.go (91%) rename ziti/cmd/{ziti/cmd => }/install_ziti_prox_c.go (91%) rename ziti/cmd/{ziti/cmd => }/install_ziti_router.go (91%) rename ziti/cmd/{ziti/cmd => }/install_ziti_tunnel.go (91%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/KeyTypeVar.go (100%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/account.go (100%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/accounts_storage.go (81%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/certs_storage.go (95%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/create.go (97%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/list.go (98%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/renew.go (97%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/revoke.go (96%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/root.go (97%) rename ziti/cmd/{ziti/cmd => }/lets_encrypt/setup.go (98%) rename ziti/cmd/{ziti/cmd => }/log_filter.go (96%) rename ziti/cmd/{ziti/cmd => }/pki.go (92%) rename ziti/cmd/{ziti/cmd => }/pki_create.go (99%) rename ziti/cmd/{ziti/cmd => }/pki_create_ca.go (96%) rename ziti/cmd/{ziti/cmd => }/pki_create_client.go (97%) rename ziti/cmd/{ziti/cmd => }/pki_create_csr.go (96%) rename ziti/cmd/{ziti/cmd => }/pki_create_intermediate.go (96%) rename ziti/cmd/{ziti/cmd => }/pki_create_key.go (96%) rename ziti/cmd/{ziti/cmd => }/pki_create_server.go (97%) rename ziti/cmd/{ziti/cmd => }/table/padding.go (100%) rename ziti/cmd/{ziti/cmd => }/table/table.go (100%) rename ziti/cmd/{ziti/cmd => }/templates/command_groups.go (100%) rename ziti/cmd/{ziti/cmd => }/templates/markdown.go (100%) rename ziti/cmd/{ziti/cmd => }/templates/normalizers.go (100%) rename ziti/cmd/{ziti/cmd => }/templates/templater.go (99%) rename ziti/cmd/{ziti/cmd => }/templates/templates.go (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/first-service-tutorial.go (96%) rename ziti/cmd/{ziti/cmd => }/tutorial/plain_echo_client.go (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/plain_echo_client_cmd.go (93%) rename ziti/cmd/{ziti/cmd => }/tutorial/plain_echo_server.go (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/plain_echo_server_cmd.go (93%) rename ziti/cmd/{ziti/cmd => }/tutorial/root.go (90%) rename ziti/cmd/{ziti/cmd => }/tutorial/tutorials/first-service.md (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/tutorials/more-info.md (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/ziti_echo_client.go (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/ziti_echo_client_cmd.go (93%) rename ziti/cmd/{ziti/cmd => }/tutorial/ziti_echo_server.go (100%) rename ziti/cmd/{ziti/cmd => }/tutorial/ziti_echo_server_cmd.go (93%) rename ziti/cmd/{ziti/cmd => }/uninstall.go (94%) rename ziti/cmd/{ziti/cmd => }/uninstall_ziti_controller.go (91%) rename ziti/cmd/{ziti/cmd => }/uninstall_ziti_edge_tunnel.go (91%) rename ziti/cmd/{ziti/cmd => }/uninstall_ziti_proxy_c.go (91%) rename ziti/cmd/{ziti/cmd => }/uninstall_ziti_router.go (91%) rename ziti/cmd/{ziti/cmd => }/uninstall_ziti_tunnel.go (91%) rename ziti/cmd/{ziti/cmd => }/unwrap_identity.go (100%) rename ziti/cmd/{ziti/cmd => }/upgrade.go (94%) rename ziti/cmd/{ziti/cmd => }/upgrade_ziti.go (92%) rename ziti/cmd/{ziti/cmd => }/upgrade_ziti_controller.go (93%) rename ziti/cmd/{ziti/cmd => }/upgrade_ziti_edge_tunnel.go (92%) rename ziti/cmd/{ziti/cmd => }/upgrade_ziti_prox_c.go (92%) rename ziti/cmd/{ziti/cmd => }/upgrade_ziti_router.go (92%) rename ziti/cmd/{ziti/cmd => }/upgrade_ziti_tunnel.go (92%) rename ziti/cmd/{ziti/cmd => }/use.go (94%) rename ziti/cmd/{ziti/cmd => }/version.go (95%) delete mode 100644 ziti/cmd/ziti/main.go rename ziti/{cmd/ziti => }/constants/constants.go (100%) rename {ziti-controller/subcmd => ziti/controller}/delete_sessions.go (99%) rename {ziti-controller/subcmd => ziti/controller}/root.go (95%) rename {ziti-controller/subcmd => ziti/controller}/run.go (99%) rename {ziti-controller/subcmd => ziti/controller}/version.go (97%) rename ziti/{cmd/ziti => }/internal/log/log.go (100%) create mode 100644 ziti/main.go rename {ziti-router/subcmd => ziti/router}/enrollgw.go (99%) rename {ziti-router/subcmd => ziti/router}/root.go (94%) rename {ziti-router/subcmd => ziti/router}/run.go (99%) rename {ziti-router/subcmd => ziti/router}/version.go (98%) rename ziti/{cmd/ziti => }/util/certs.go (98%) rename ziti/{cmd/ziti => }/util/colors.go (100%) rename ziti/{cmd/ziti => }/util/commands.go (98%) rename ziti/{cmd/ziti => }/util/dirs.go (100%) rename ziti/{cmd/ziti => }/util/files.go (100%) rename ziti/{cmd/ziti => }/util/identities.go (99%) rename ziti/{cmd/ziti => }/util/pickers.go (98%) rename ziti/{cmd/ziti => }/util/rest.go (99%) rename ziti/{cmd/ziti => }/util/session.go (100%) rename ziti/{cmd/ziti => }/util/strings.go (100%) rename ziti/{cmd/ziti => }/util/suggestions.go (100%) rename ziti/{cmd/ziti => }/util/updates.go (98%) diff --git a/common/enrollment/enroll.go b/common/enrollment/enroll.go index bb513da63..c4c45519a 100644 --- a/common/enrollment/enroll.go +++ b/common/enrollment/enroll.go @@ -19,16 +19,16 @@ package enrollment import ( "encoding/json" "fmt" + "github.com/openziti/ziti/ziti/cmd/common" "io/ioutil" "os" "strings" "github.com/michaelquigley/pfxlog" - "github.com/openziti/identity/certtools" "github.com/openziti/foundation/v2/term" + "github.com/openziti/identity/certtools" "github.com/openziti/sdk-golang/ziti/config" "github.com/openziti/sdk-golang/ziti/enroll" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/doc/003-local-deploy.md b/doc/003-local-deploy.md index 5b0e16d15..e720f7d14 100644 --- a/doc/003-local-deploy.md +++ b/doc/003-local-deploy.md @@ -1,6 +1,8 @@ # Overview -This local deployment README guides you to set up a running local Ziti stack. If you have not already built the apps in this repo you may go back to [the previous tutorial about getting set up for local development](./002-local-dev.md) for build instructions. The remainder of the tutorial will assume you have installed all the apps so they can be found in your shell's executable search `PATH`. +This local deployment README guides you to set up a running local Ziti stack. If you have not already built the apps in this repo you may go back +to [the previous tutorial about getting set up for local development](./002-local-dev.md) for build instructions. The remainder of the tutorial will assume you have installed all the apps so they can +be found in your shell's executable search `PATH`. You will configure and run: @@ -9,13 +11,15 @@ You will configure and run: ## A Note About Windows -These commands require a running BASH shell. Windows users will need to use WSL, [cygwin](https://www.cygwin.com/), a Linux virtual machine, or some other environment that supports BASH. The easiest thing might just be to use the shell that comes with [git bashfor windows](https://gitforwindows.org/). WSL is maturing more and more: [Mintty and WSL](https://github.com/mintty/wsltty). +These commands require a running BASH shell. Windows users will need to use WSL, [cygwin](https://www.cygwin.com/), a Linux virtual machine, or some other environment that supports BASH. The easiest +thing might just be to use the shell that comes with [git bashfor windows](https://gitforwindows.org/). WSL is maturing more and more: [Mintty and WSL](https://github.com/mintty/wsltty). Also note that commands for `ziti`, `ziti-controller`, and `ziti-router` may need to have the `.exe` suffix appended to the example commands. ## Initialize the Environment -The remainder of this local development tutorital will instruct you to run terminal commands with current working directory of the top-level of this checked-out repo. The generated configuration files will use filesystem paths that are relative to this directory. +The remainder of this local development tutorital will instruct you to run terminal commands with current working directory of the top-level of this checked-out repo. The generated configuration files +will use filesystem paths that are relative to this directory. Go ahead and create a `./db` directory. Git is configured to ignore this directory and it will house the tutorial files. You may delete this directory to reset the tutorial. @@ -93,7 +97,8 @@ ziti-router enroll --jwt /tmp/router01.jwt ./db/router01-config.yml ## Run the Edge Router -Edge SDKs will connect to the running edge router to connect to services. Leave the router process running in a terminal so you can monitor the log messages while you continue the tutorial in a new terminal. +Edge SDKs will connect to the running edge router to connect to services. Leave the router process running in a terminal so you can monitor the log messages while you continue the tutorial in a new +terminal. ```bash ziti-router run ./db/router01-config.yml @@ -109,7 +114,7 @@ When prompted, select your running edge router `router01`. ziti edge tutorial first-service ``` -If you prefer, you may read [the first-service tutorial as a web site](../ziti/cmd/ziti/cmd/tutorial/tutorials/first-service.md) +If you prefer, you may read [the first-service tutorial as a web site](../ziti/cmd/tutorial/tutorials/first-service.md) ## Further Exploration diff --git a/ziti-controller/main.go b/ziti-controller/main.go index abd968468..27439663f 100644 --- a/ziti-controller/main.go +++ b/ziti-controller/main.go @@ -26,7 +26,7 @@ import ( "github.com/openziti/transport/v2/transwarptls" "github.com/openziti/transport/v2/wss" "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti-controller/subcmd" + "github.com/openziti/ziti/ziti/controller" "github.com/sirupsen/logrus" ) @@ -44,5 +44,5 @@ func init() { } func main() { - subcmd.Execute() + controller.Execute() } diff --git a/ziti-router/main.go b/ziti-router/main.go index 9400fcaf7..cb261b26b 100644 --- a/ziti-router/main.go +++ b/ziti-router/main.go @@ -28,7 +28,7 @@ import ( "github.com/openziti/transport/v2/ws" "github.com/openziti/transport/v2/wss" "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti-router/subcmd" + "github.com/openziti/ziti/ziti/router" "github.com/sirupsen/logrus" ) @@ -48,5 +48,5 @@ func init() { } func main() { - subcmd.Execute() + router.Execute() } diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go b/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go index c26acceab..f3c737526 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go +++ b/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go @@ -17,24 +17,24 @@ package subcmd import ( + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/util" "io/ioutil" "os" "path/filepath" "time" "github.com/michaelquigley/pfxlog" + "github.com/openziti/agent" "github.com/openziti/edge/tunnel" "github.com/openziti/edge/tunnel/dns" "github.com/openziti/edge/tunnel/entities" "github.com/openziti/edge/tunnel/intercept" - "github.com/openziti/agent" "github.com/openziti/sdk-golang/ziti" "github.com/openziti/sdk-golang/ziti/config" "github.com/openziti/ziti/common/enrollment" "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent.go b/ziti/cmd/agentcli/agent.go similarity index 96% rename from ziti/cmd/ziti/cmd/agentcli/agent.go rename to ziti/cmd/agentcli/agent.go index 6c39b6ea7..320f87af5 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent.go +++ b/ziti/cmd/agentcli/agent.go @@ -8,8 +8,8 @@ import ( "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/fabric/router" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "net" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_ch_simple.go b/ziti/cmd/agentcli/agent_ch_simple.go similarity index 95% rename from ziti/cmd/ziti/cmd/agentcli/agent_ch_simple.go rename to ziti/cmd/agentcli/agent_ch_simple.go index a95323274..ac97ef999 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_ch_simple.go +++ b/ziti/cmd/agentcli/agent_ch_simple.go @@ -21,8 +21,8 @@ import ( "github.com/openziti/agent" "github.com/openziti/channel/v2" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "net" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_clear_channel_log_level.go b/ziti/cmd/agentcli/agent_clear_channel_log_level.go similarity index 94% rename from ziti/cmd/ziti/cmd/agentcli/agent_clear_channel_log_level.go rename to ziti/cmd/agentcli/agent_clear_channel_log_level.go index 33a433bfa..c307b00e7 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_clear_channel_log_level.go +++ b/ziti/cmd/agentcli/agent_clear_channel_log_level.go @@ -20,8 +20,8 @@ import ( "bytes" "encoding/binary" "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_controller_init.go b/ziti/cmd/agentcli/agent_controller_init.go similarity index 95% rename from ziti/cmd/ziti/cmd/agentcli/agent_controller_init.go rename to ziti/cmd/agentcli/agent_controller_init.go index bf3dc5779..ffe9b960c 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_controller_init.go +++ b/ziti/cmd/agentcli/agent_controller_init.go @@ -23,8 +23,8 @@ import ( "github.com/openziti/channel/v2/protobufs" "github.com/openziti/edge/pb/edge_mgmt_pb" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "net" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_join.go b/ziti/cmd/agentcli/agent_controller_raft_join.go similarity index 95% rename from ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_join.go rename to ziti/cmd/agentcli/agent_controller_raft_join.go index d53141001..bda3a55a5 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_join.go +++ b/ziti/cmd/agentcli/agent_controller_raft_join.go @@ -23,8 +23,8 @@ import ( "github.com/openziti/fabric/controller" "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "net" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_list.go b/ziti/cmd/agentcli/agent_controller_raft_list.go similarity index 95% rename from ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_list.go rename to ziti/cmd/agentcli/agent_controller_raft_list.go index c615fe2fc..4bf2176fb 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_controller_raft_list.go +++ b/ziti/cmd/agentcli/agent_controller_raft_list.go @@ -23,8 +23,8 @@ import ( "github.com/openziti/channel/v2" "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "net" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_gc.go b/ziti/cmd/agentcli/agent_gc.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_gc.go rename to ziti/cmd/agentcli/agent_gc.go index 4c3bc4d51..ad56c6db9 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_gc.go +++ b/ziti/cmd/agentcli/agent_gc.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_get.go b/ziti/cmd/agentcli/agent_get.go similarity index 93% rename from ziti/cmd/ziti/cmd/agentcli/agent_get.go rename to ziti/cmd/agentcli/agent_get.go index 2a8c9d1a3..ad2aca505 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_get.go +++ b/ziti/cmd/agentcli/agent_get.go @@ -18,14 +18,13 @@ package agentcli import ( "fmt" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "strconv" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" "github.com/shirou/gopsutil/v3/process" "github.com/spf13/cobra" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" ) type AgentGetOptionsAction struct { diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_go_version_action.go b/ziti/cmd/agentcli/agent_go_version_action.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_go_version_action.go rename to ziti/cmd/agentcli/agent_go_version_action.go index 46a18e16c..94e0a9099 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_go_version_action.go +++ b/ziti/cmd/agentcli/agent_go_version_action.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_memstats.go b/ziti/cmd/agentcli/agent_memstats.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_memstats.go rename to ziti/cmd/agentcli/agent_memstats.go index 7a0e8168f..8004b8eda 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_memstats.go +++ b/ziti/cmd/agentcli/agent_memstats.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_pprof_cpu.go b/ziti/cmd/agentcli/agent_pprof_cpu.go similarity index 93% rename from ziti/cmd/ziti/cmd/agentcli/agent_pprof_cpu.go rename to ziti/cmd/agentcli/agent_pprof_cpu.go index 23519c3fb..ad590e17e 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_pprof_cpu.go +++ b/ziti/cmd/agentcli/agent_pprof_cpu.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" "os" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_pprof_heap.go b/ziti/cmd/agentcli/agent_pprof_heap.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_pprof_heap.go rename to ziti/cmd/agentcli/agent_pprof_heap.go index 79a817a2f..04776721c 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_pprof_heap.go +++ b/ziti/cmd/agentcli/agent_pprof_heap.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" "os" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_ps.go b/ziti/cmd/agentcli/agent_ps.go similarity index 97% rename from ziti/cmd/ziti/cmd/agentcli/agent_ps.go rename to ziti/cmd/agentcli/agent_ps.go index f29666c8c..f88bb48e0 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_ps.go +++ b/ziti/cmd/agentcli/agent_ps.go @@ -20,7 +20,8 @@ import ( "bytes" "fmt" "github.com/keybase/go-ps" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" "github.com/spf13/cobra" "os" @@ -32,8 +33,6 @@ import ( "strconv" "strings" "sync" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" ) type AgentPsAction struct { diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_router_add_route.go b/ziti/cmd/agentcli/agent_router_add_route.go similarity index 94% rename from ziti/cmd/ziti/cmd/agentcli/agent_router_add_route.go rename to ziti/cmd/agentcli/agent_router_add_route.go index c604c20ae..0cd14bd8e 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_router_add_route.go +++ b/ziti/cmd/agentcli/agent_router_add_route.go @@ -21,8 +21,8 @@ import ( "github.com/openziti/agent" "github.com/openziti/fabric/pb/ctrl_pb" "github.com/openziti/fabric/router" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "google.golang.org/protobuf/proto" "os" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_router_forget_link.go b/ziti/cmd/agentcli/agent_router_forget_link.go similarity index 95% rename from ziti/cmd/ziti/cmd/agentcli/agent_router_forget_link.go rename to ziti/cmd/agentcli/agent_router_forget_link.go index 8895ac0fd..1ed92255e 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_router_forget_link.go +++ b/ziti/cmd/agentcli/agent_router_forget_link.go @@ -23,8 +23,8 @@ import ( "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/fabric/router" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "net" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_set_channel_log_level.go b/ziti/cmd/agentcli/agent_set_channel_log_level.go similarity index 95% rename from ziti/cmd/ziti/cmd/agentcli/agent_set_channel_log_level.go rename to ziti/cmd/agentcli/agent_set_channel_log_level.go index 9b44f896c..a92e8dd11 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_set_channel_log_level.go +++ b/ziti/cmd/agentcli/agent_set_channel_log_level.go @@ -20,8 +20,8 @@ import ( "bytes" "encoding/binary" "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_set_log_level.go b/ziti/cmd/agentcli/agent_set_log_level.go similarity index 94% rename from ziti/cmd/ziti/cmd/agentcli/agent_set_log_level.go rename to ziti/cmd/agentcli/agent_set_log_level.go index d9148b3e4..be306648f 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_set_log_level.go +++ b/ziti/cmd/agentcli/agent_set_log_level.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_setgc.go b/ziti/cmd/agentcli/agent_setgc.go similarity index 93% rename from ziti/cmd/ziti/cmd/agentcli/agent_setgc.go rename to ziti/cmd/agentcli/agent_setgc.go index 513571a6a..ca1a9663d 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_setgc.go +++ b/ziti/cmd/agentcli/agent_setgc.go @@ -19,8 +19,8 @@ package agentcli import ( "encoding/binary" "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" "strconv" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_simple.go b/ziti/cmd/agentcli/agent_simple.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_simple.go rename to ziti/cmd/agentcli/agent_simple.go index a0fbded07..38701e896 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_simple.go +++ b/ziti/cmd/agentcli/agent_simple.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_stack.go b/ziti/cmd/agentcli/agent_stack.go similarity index 93% rename from ziti/cmd/ziti/cmd/agentcli/agent_stack.go rename to ziti/cmd/agentcli/agent_stack.go index 81e584df5..338a4a113 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_stack.go +++ b/ziti/cmd/agentcli/agent_stack.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" "time" diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_stats.go b/ziti/cmd/agentcli/agent_stats.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_stats.go rename to ziti/cmd/agentcli/agent_stats.go index 9f68d56a3..adeba86d4 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_stats.go +++ b/ziti/cmd/agentcli/agent_stats.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/agentcli/agent_trace.go b/ziti/cmd/agentcli/agent_trace.go similarity index 92% rename from ziti/cmd/ziti/cmd/agentcli/agent_trace.go rename to ziti/cmd/agentcli/agent_trace.go index 1e5bf7031..ac704a74a 100644 --- a/ziti/cmd/ziti/cmd/agentcli/agent_trace.go +++ b/ziti/cmd/agentcli/agent_trace.go @@ -18,8 +18,8 @@ package agentcli import ( "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "os" ) diff --git a/ziti/cmd/ziti/cmd/api/delete.go b/ziti/cmd/api/delete.go similarity index 97% rename from ziti/cmd/ziti/cmd/api/delete.go rename to ziti/cmd/api/delete.go index 1ef462d25..b245907b6 100644 --- a/ziti/cmd/ziti/cmd/api/delete.go +++ b/ziti/cmd/api/delete.go @@ -19,7 +19,7 @@ package api import ( "github.com/fatih/color" "github.com/openziti/storage/boltz" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/util" "net/url" "strings" ) diff --git a/ziti/cmd/ziti/cmd/api/json.go b/ziti/cmd/api/json.go similarity index 100% rename from ziti/cmd/ziti/cmd/api/json.go rename to ziti/cmd/api/json.go diff --git a/ziti/cmd/ziti/cmd/api/list.go b/ziti/cmd/api/list.go similarity index 99% rename from ziti/cmd/ziti/cmd/api/list.go rename to ziti/cmd/api/list.go index 58987d2dc..2eef77647 100644 --- a/ziti/cmd/ziti/cmd/api/list.go +++ b/ziti/cmd/api/list.go @@ -21,7 +21,7 @@ import ( "github.com/Jeffail/gabs" "github.com/jedib0t/go-pretty/v6/table" "github.com/openziti/foundation/v2/errorz" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "io" "net/url" diff --git a/ziti/cmd/ziti/cmd/api/options.go b/ziti/cmd/api/options.go similarity index 97% rename from ziti/cmd/ziti/cmd/api/options.go rename to ziti/cmd/api/options.go index a10c23527..cda80e3de 100644 --- a/ziti/cmd/ziti/cmd/api/options.go +++ b/ziti/cmd/api/options.go @@ -19,7 +19,7 @@ package api import ( "fmt" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/api/ws.go b/ziti/cmd/api/ws.go similarity index 97% rename from ziti/cmd/ziti/cmd/api/ws.go rename to ziti/cmd/api/ws.go index d89e78541..5abcccb1d 100644 --- a/ziti/cmd/ziti/cmd/api/ws.go +++ b/ziti/cmd/api/ws.go @@ -23,7 +23,7 @@ import ( "github.com/openziti/channel/v2" "github.com/openziti/channel/v2/websockets" "github.com/openziti/identity" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/util" "io" "net/http" "strings" diff --git a/ziti/cmd/ziti/cmd/art.go b/ziti/cmd/art.go similarity index 96% rename from ziti/cmd/ziti/cmd/art.go rename to ziti/cmd/art.go index 7c2b5dd79..25caa7fb0 100644 --- a/ziti/cmd/ziti/cmd/art.go +++ b/ziti/cmd/art.go @@ -17,11 +17,10 @@ package cmd import ( - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/cmd.go b/ziti/cmd/cmd.go similarity index 90% rename from ziti/cmd/ziti/cmd/cmd.go rename to ziti/cmd/cmd.go index d2c1bffa1..53edfd8c3 100644 --- a/ziti/cmd/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -19,26 +19,23 @@ package cmd import ( goflag "flag" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" + "github.com/openziti/ziti/ziti/cmd/agentcli" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/database" + "github.com/openziti/ziti/ziti/cmd/demo" + "github.com/openziti/ziti/ziti/cmd/edge" + "github.com/openziti/ziti/ziti/cmd/fabric" + "github.com/openziti/ziti/ziti/cmd/templates" + "github.com/openziti/ziti/ziti/cmd/tutorial" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/util" "io" "os" "path/filepath" "strings" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/database" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/demo" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/fabric" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" - - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/edge" - - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/cmd/ziti/util" - "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/ziti/cmd/ziti/cmd/color/color.go b/ziti/cmd/color/color.go similarity index 98% rename from ziti/cmd/ziti/cmd/color/color.go rename to ziti/cmd/color/color.go index a5e1e0dc3..ff8a79f41 100644 --- a/ziti/cmd/ziti/cmd/color/color.go +++ b/ziti/cmd/color/color.go @@ -17,8 +17,8 @@ package color import ( - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/fatih/color" + "github.com/openziti/ziti/ziti/util" "sort" ) diff --git a/ziti/cmd/ziti/cmd/common.go b/ziti/cmd/common.go similarity index 100% rename from ziti/cmd/ziti/cmd/common.go rename to ziti/cmd/common.go diff --git a/ziti/cmd/ziti/cmd/common/options.go b/ziti/cmd/common/options.go similarity index 100% rename from ziti/cmd/ziti/cmd/common/options.go rename to ziti/cmd/common/options.go diff --git a/ziti/cmd/ziti/cmd/common_commands.go b/ziti/cmd/common_commands.go similarity index 97% rename from ziti/cmd/ziti/cmd/common_commands.go rename to ziti/cmd/common_commands.go index b106cc63a..e0be196a1 100644 --- a/ziti/cmd/ziti/cmd/common_commands.go +++ b/ziti/cmd/common_commands.go @@ -18,13 +18,12 @@ package cmd import ( "fmt" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/util" "io/ioutil" "os" "os/exec" "strings" - - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/cmd/ziti/util" ) var cliAgentEnabled bool diff --git a/ziti/cmd/ziti/cmd/common_init.go b/ziti/cmd/common_init.go similarity index 97% rename from ziti/cmd/ziti/cmd/common_init.go rename to ziti/cmd/common_init.go index bf32280ee..b1f271d13 100644 --- a/ziti/cmd/ziti/cmd/common_init.go +++ b/ziti/cmd/common_init.go @@ -18,8 +18,8 @@ package cmd import ( "fmt" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/viper" "gopkg.in/AlecAivazis/survey.v1" "os" diff --git a/ziti/cmd/ziti/cmd/common_install.go b/ziti/cmd/common_install.go similarity index 98% rename from ziti/cmd/ziti/cmd/common_install.go rename to ziti/cmd/common_install.go index b72071b6e..243d339ae 100644 --- a/ziti/cmd/ziti/cmd/common_install.go +++ b/ziti/cmd/common_install.go @@ -19,9 +19,9 @@ package cmd import ( "fmt" "github.com/blang/semver" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + 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" diff --git a/ziti/cmd/ziti/cmd/common_install_test.go b/ziti/cmd/common_install_test.go similarity index 95% rename from ziti/cmd/ziti/cmd/common_install_test.go rename to ziti/cmd/common_install_test.go index 3b89d6f8d..f74ee6798 100644 --- a/ziti/cmd/ziti/cmd/common_install_test.go +++ b/ziti/cmd/common_install_test.go @@ -17,7 +17,7 @@ package cmd import ( - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" + c "github.com/openziti/ziti/ziti/constants" "github.com/pborman/uuid" "github.com/stretchr/testify/assert" "os" diff --git a/ziti/cmd/ziti/cmd/config_templates/controller.yml b/ziti/cmd/config_templates/controller.yml similarity index 100% rename from ziti/cmd/ziti/cmd/config_templates/controller.yml rename to ziti/cmd/config_templates/controller.yml diff --git a/ziti/cmd/ziti/cmd/config_templates/environment.yml b/ziti/cmd/config_templates/environment.yml similarity index 100% rename from ziti/cmd/ziti/cmd/config_templates/environment.yml rename to ziti/cmd/config_templates/environment.yml diff --git a/ziti/cmd/ziti/cmd/config_templates/router.yml b/ziti/cmd/config_templates/router.yml similarity index 100% rename from ziti/cmd/ziti/cmd/config_templates/router.yml rename to ziti/cmd/config_templates/router.yml diff --git a/ziti/cmd/ziti/cmd/create.go b/ziti/cmd/create.go similarity index 92% rename from ziti/cmd/ziti/cmd/create.go rename to ziti/cmd/create.go index 65207d2d7..03e786054 100644 --- a/ziti/cmd/ziti/cmd/create.go +++ b/ziti/cmd/create.go @@ -17,11 +17,10 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "github.com/spf13/cobra" "io" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" ) var ( diff --git a/ziti/cmd/ziti/cmd/create_config.go b/ziti/cmd/create_config.go similarity index 91% rename from ziti/cmd/ziti/cmd/create_config.go rename to ziti/cmd/create_config.go index 77f0bda76..59aaf47e1 100644 --- a/ziti/cmd/ziti/cmd/create_config.go +++ b/ziti/cmd/create_config.go @@ -17,6 +17,9 @@ package cmd import ( + "github.com/openziti/ziti/ziti/cmd/common" + helpers2 "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/constants" "os" "time" @@ -26,9 +29,6 @@ import ( fabForwarder "github.com/openziti/fabric/router/forwarder" foundation "github.com/openziti/transport/v2" fabXweb "github.com/openziti/xweb/v2" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -179,7 +179,7 @@ func init() { } } - workingDir = cmdhelper.NormalizePath(zh) + workingDir = helpers2.NormalizePath(zh) } // NewCmdCreateConfig creates a command object for the "config" command @@ -189,7 +189,7 @@ func NewCmdCreateConfig() *cobra.Command { Short: "Creates a config file for specified Ziti component using environment variables", Aliases: []string{"cfg"}, Run: func(cmd *cobra.Command, args []string) { - cmdhelper.CheckErr(cmd.Help()) + helpers2.CheckErr(cmd.Help()) }, } @@ -213,47 +213,47 @@ func (data *ConfigTemplateValues) populateEnvVars() { handleVariableError(err, "hostname") // Get and add ziti home to the params - zitiHome, err := cmdhelper.GetZitiHome() + zitiHome, err := helpers2.GetZitiHome() handleVariableError(err, constants.ZitiHomeVarName) // Get Ziti Controller Name - zitiCtrlHostname, err := cmdhelper.GetZitiCtrlName() + zitiCtrlHostname, err := helpers2.GetZitiCtrlName() handleVariableError(err, constants.ZitiCtrlNameVarName) // Get Ziti Edge Router Port - zitiEdgeRouterPort, err := cmdhelper.GetZitiEdgeRouterPort() + zitiEdgeRouterPort, err := helpers2.GetZitiEdgeRouterPort() handleVariableError(err, constants.ZitiEdgeRouterPortVarName) // Get Ziti Controller Listener Address - zitiCtrlListenerAddress, err := cmdhelper.GetZitiCtrlListenerAddress() + zitiCtrlListenerAddress, err := helpers2.GetZitiCtrlListenerAddress() handleVariableError(err, constants.ZitiCtrlListenerAddressVarName) // Get Ziti Controller Advertised Address - zitiCtrlAdvertisedAddress, err := cmdhelper.GetZitiCtrlAdvertisedAddress() + zitiCtrlAdvertisedAddress, err := helpers2.GetZitiCtrlAdvertisedAddress() handleVariableError(err, constants.ZitiCtrlAdvertisedAddressVarName) // Get Ziti Controller Port - zitiCtrlPort, err := cmdhelper.GetZitiCtrlPort() + zitiCtrlPort, err := helpers2.GetZitiCtrlPort() handleVariableError(err, constants.ZitiCtrlPortVarName) // Get Ziti Edge Controller Listener Host and Port - zitiEdgeCtrlListenerHostPort, err := cmdhelper.GetZitiEdgeCtrlListenerHostPort() + zitiEdgeCtrlListenerHostPort, err := helpers2.GetZitiEdgeCtrlListenerHostPort() handleVariableError(err, constants.ZitiEdgeCtrlListenerHostPortVarName) // Get Ziti Edge Controller Advertised Host and Port - zitiEdgeCtrlAdvertisedHostPort, err := cmdhelper.GetZitiEdgeCtrlAdvertisedHostPort() + zitiEdgeCtrlAdvertisedHostPort, err := helpers2.GetZitiEdgeCtrlAdvertisedHostPort() handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedHostPortVarName) // Get Ziti Edge Controller Advertised Port - zitiEdgeCtrlAdvertisedPort, err := cmdhelper.GetZitiEdgeCtrlAdvertisedPort() + zitiEdgeCtrlAdvertisedPort, err := helpers2.GetZitiEdgeCtrlAdvertisedPort() handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedPortVarName) // Get Ziti edge Identity enrollment duration - zitiEdgeIdentityEnrollmentDuration, err := cmdhelper.GetZitiEdgeIdentityEnrollmentDuration() + zitiEdgeIdentityEnrollmentDuration, err := helpers2.GetZitiEdgeIdentityEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeIdentityEnrollmentDurationVarName) // Get Ziti edge Router enrollment duration - zitiEdgeRouterEnrollmentDuration, err := cmdhelper.GetZitiEdgeRouterEnrollmentDuration() + zitiEdgeRouterEnrollmentDuration, err := helpers2.GetZitiEdgeRouterEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeRouterEnrollmentDurationVarName) data.ZitiHome = zitiHome diff --git a/ziti/cmd/ziti/cmd/create_config_controller.go b/ziti/cmd/create_config_controller.go similarity index 92% rename from ziti/cmd/ziti/cmd/create_config_controller.go rename to ziti/cmd/create_config_controller.go index 34eefaac7..da4c7619f 100644 --- a/ziti/cmd/ziti/cmd/create_config_controller.go +++ b/ziti/cmd/create_config_controller.go @@ -19,9 +19,9 @@ package cmd import ( _ "embed" edge "github.com/openziti/edge/controller/config" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" + helpers2 "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + "github.com/openziti/ziti/ziti/constants" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -126,7 +126,7 @@ func NewCmdCreateConfigController() *cobra.Command { controllerOptions.Cmd = cmd controllerOptions.Args = args err := controllerOptions.run(data) - cmdhelper.CheckErr(err) + helpers2.CheckErr(err) }, PostRun: func(cmd *cobra.Command, args []string) { // Reset log output after run completes @@ -204,28 +204,28 @@ func SetControllerIdentityCert(c *ControllerTemplateValues) { if val == "" { val = workingDir + "/" + hostnameOrNetworkName() + ".cert" // default } - c.IdentityCert = cmdhelper.NormalizePath(val) + c.IdentityCert = helpers2.NormalizePath(val) } func SetControllerIdentityServerCert(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiCtrlIdentityServerCertVarName) if val == "" { val = workingDir + "/" + hostnameOrNetworkName() + ".server.chain.cert" // default } - c.IdentityServerCert = cmdhelper.NormalizePath(val) + c.IdentityServerCert = helpers2.NormalizePath(val) } func SetControllerIdentityKey(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiCtrlIdentityKeyVarName) if val == "" { val = workingDir + "/" + hostnameOrNetworkName() + ".key" // default } - c.IdentityKey = cmdhelper.NormalizePath(val) + c.IdentityKey = helpers2.NormalizePath(val) } func SetControllerIdentityCA(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiCtrlIdentityCAVarName) if val == "" { val = workingDir + "/" + hostnameOrNetworkName() + ".ca" // default } - c.IdentityCA = cmdhelper.NormalizePath(val) + c.IdentityCA = helpers2.NormalizePath(val) } func SetEdgeConfig(data *ControllerTemplateValues) { @@ -237,14 +237,14 @@ func SetEdgeSigningCert(c *ControllerTemplateValues) { if val == "" { val = workingDir + "/" + hostnameOrNetworkName() + ".signing.cert" // default } - c.Edge.ZitiSigningCert = cmdhelper.NormalizePath(val) + c.Edge.ZitiSigningCert = helpers2.NormalizePath(val) } func SetEdgeSigningKey(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiSigningKeyVarName) if val == "" { val = workingDir + "/" + hostnameOrNetworkName() + ".signing.key" // default } - c.Edge.ZitiSigningKey = cmdhelper.NormalizePath(val) + c.Edge.ZitiSigningKey = helpers2.NormalizePath(val) } func SetWebConfig(data *ControllerTemplateValues) { @@ -258,26 +258,26 @@ func SetWebIdentityCert(c *ControllerTemplateValues) { if val == "" { val = c.IdentityCert //default } - c.Edge.IdentityCert = cmdhelper.NormalizePath(val) + c.Edge.IdentityCert = helpers2.NormalizePath(val) } func SetWebIdentityServerCert(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiEdgeCtrlIdentityServerCertVarName) if val == "" { val = c.IdentityServerCert //default } - c.Edge.IdentityServerCert = cmdhelper.NormalizePath(val) + c.Edge.IdentityServerCert = helpers2.NormalizePath(val) } func SetWebIdentityKey(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiEdgeCtrlIdentityKeyVarName) if val == "" { val = c.IdentityKey //default } - c.Edge.IdentityKey = cmdhelper.NormalizePath(val) + c.Edge.IdentityKey = helpers2.NormalizePath(val) } func SetWebIdentityCA(c *ControllerTemplateValues) { val := os.Getenv(constants.ZitiEdgeCtrlIdentityCAVarName) if val == "" { val = c.IdentityCA //default } - c.Edge.IdentityCA = cmdhelper.NormalizePath(val) + c.Edge.IdentityCA = helpers2.NormalizePath(val) } diff --git a/ziti/cmd/ziti/cmd/create_config_controller_test.go b/ziti/cmd/create_config_controller_test.go similarity index 100% rename from ziti/cmd/ziti/cmd/create_config_controller_test.go rename to ziti/cmd/create_config_controller_test.go diff --git a/ziti/cmd/ziti/cmd/create_config_environment.go b/ziti/cmd/create_config_environment.go similarity index 98% rename from ziti/cmd/ziti/cmd/create_config_environment.go rename to ziti/cmd/create_config_environment.go index d6a996d1d..343fa2042 100644 --- a/ziti/cmd/ziti/cmd/create_config_environment.go +++ b/ziti/cmd/create_config_environment.go @@ -19,15 +19,15 @@ package cmd import ( _ "embed" "fmt" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + "github.com/openziti/ziti/ziti/constants" "os" "path/filepath" "runtime" "strings" "text/template" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/ziti/cmd/ziti/cmd/create_config_router.go b/ziti/cmd/create_config_router.go similarity index 97% rename from ziti/cmd/ziti/cmd/create_config_router.go rename to ziti/cmd/create_config_router.go index 05c27a850..10ed476a3 100644 --- a/ziti/cmd/ziti/cmd/create_config_router.go +++ b/ziti/cmd/create_config_router.go @@ -18,10 +18,10 @@ package cmd import ( _ "embed" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "os" "strings" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/create_config_router_common.go b/ziti/cmd/create_config_router_common.go similarity index 96% rename from ziti/cmd/ziti/cmd/create_config_router_common.go rename to ziti/cmd/create_config_router_common.go index 0440384fb..378faeee1 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_common.go +++ b/ziti/cmd/create_config_router_common.go @@ -18,11 +18,10 @@ package cmd import ( _ "embed" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/constants" "log" "os" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" ) func SetZitiRouterIdentity(r *RouterTemplateValues, routerName string) { diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge.go b/ziti/cmd/create_config_router_edge.go similarity index 97% rename from ziti/cmd/ziti/cmd/create_config_router_edge.go rename to ziti/cmd/create_config_router_edge.go index be0becc08..ca66e5f77 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge.go +++ b/ziti/cmd/create_config_router_edge.go @@ -18,13 +18,13 @@ package cmd import ( _ "embed" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "os" "path/filepath" "strings" "text/template" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go b/ziti/cmd/create_config_router_edge_test.go similarity index 99% rename from ziti/cmd/ziti/cmd/create_config_router_edge_test.go rename to ziti/cmd/create_config_router_edge_test.go index bebf5d2a4..ef9eca47f 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go +++ b/ziti/cmd/create_config_router_edge_test.go @@ -1,7 +1,7 @@ package cmd import ( - "github.com/openziti/ziti/ziti/cmd/ziti/constants" + "github.com/openziti/ziti/ziti/constants" "github.com/stretchr/testify/assert" "os" "testing" diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric.go b/ziti/cmd/create_config_router_fabric.go similarity index 96% rename from ziti/cmd/ziti/cmd/create_config_router_fabric.go rename to ziti/cmd/create_config_router_fabric.go index 27e3e893a..de642a534 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric.go +++ b/ziti/cmd/create_config_router_fabric.go @@ -18,8 +18,8 @@ package cmd import ( _ "embed" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go b/ziti/cmd/create_config_router_fabric_test.go similarity index 99% rename from ziti/cmd/ziti/cmd/create_config_router_fabric_test.go rename to ziti/cmd/create_config_router_fabric_test.go index 2b1e0cf8a..2145b09cc 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go +++ b/ziti/cmd/create_config_router_fabric_test.go @@ -1,7 +1,7 @@ package cmd import ( - "github.com/openziti/ziti/ziti/cmd/ziti/constants" + "github.com/openziti/ziti/ziti/constants" "github.com/stretchr/testify/assert" "os" "testing" diff --git a/ziti/cmd/ziti/cmd/create_config_router_test.go b/ziti/cmd/create_config_router_test.go similarity index 99% rename from ziti/cmd/ziti/cmd/create_config_router_test.go rename to ziti/cmd/create_config_router_test.go index 81ad11d25..7d0a18545 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_test.go +++ b/ziti/cmd/create_config_router_test.go @@ -2,7 +2,7 @@ package cmd import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" + "github.com/openziti/ziti/ziti/constants" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" "os" diff --git a/ziti/cmd/ziti/cmd/create_config_test.go b/ziti/cmd/create_config_test.go similarity index 100% rename from ziti/cmd/ziti/cmd/create_config_test.go rename to ziti/cmd/create_config_test.go diff --git a/ziti/cmd/ziti/cmd/create_environment.go b/ziti/cmd/create_environment.go similarity index 92% rename from ziti/cmd/ziti/cmd/create_environment.go rename to ziti/cmd/create_environment.go index fb22392ef..37e35a481 100644 --- a/ziti/cmd/ziti/cmd/create_environment.go +++ b/ziti/cmd/create_environment.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/util" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/database/cmd.go b/ziti/cmd/database/cmd.go similarity index 93% rename from ziti/cmd/ziti/cmd/database/cmd.go rename to ziti/cmd/database/cmd.go index 37f82f1c1..31e07b588 100644 --- a/ziti/cmd/ziti/cmd/database/cmd.go +++ b/ziti/cmd/database/cmd.go @@ -3,7 +3,7 @@ package database import ( "fmt" "github.com/openziti/ziti-db-explorer/cmd/ziti-db-explorer/zdecli" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/demo/echo-notes.txt b/ziti/cmd/demo/echo-notes.txt similarity index 100% rename from ziti/cmd/ziti/cmd/demo/echo-notes.txt rename to ziti/cmd/demo/echo-notes.txt diff --git a/ziti/cmd/ziti/cmd/demo/echo_server.go b/ziti/cmd/demo/echo_server.go similarity index 100% rename from ziti/cmd/ziti/cmd/demo/echo_server.go rename to ziti/cmd/demo/echo_server.go index 344c08424..bfc304060 100644 --- a/ziti/cmd/ziti/cmd/demo/echo_server.go +++ b/ziti/cmd/demo/echo_server.go @@ -20,8 +20,8 @@ import ( "bufio" "fmt" "github.com/michaelquigley/pfxlog" - "github.com/openziti/channel/v2" "github.com/openziti/agent" + "github.com/openziti/channel/v2" "github.com/openziti/identity" "github.com/openziti/sdk-golang/ziti" "github.com/openziti/sdk-golang/ziti/config" diff --git a/ziti/cmd/ziti/cmd/demo/echo_server_update_terminator.go b/ziti/cmd/demo/echo_server_update_terminator.go similarity index 93% rename from ziti/cmd/ziti/cmd/demo/echo_server_update_terminator.go rename to ziti/cmd/demo/echo_server_update_terminator.go index 1009bf581..4bd27c748 100644 --- a/ziti/cmd/ziti/cmd/demo/echo_server_update_terminator.go +++ b/ziti/cmd/demo/echo_server_update_terminator.go @@ -18,11 +18,11 @@ package demo import ( "fmt" - "github.com/openziti/channel/v2" "github.com/openziti/agent" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/channel/v2" + "github.com/openziti/ziti/ziti/cmd/agentcli" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" "github.com/spf13/cobra" "time" diff --git a/ziti/cmd/ziti/cmd/demo/root.go b/ziti/cmd/demo/root.go similarity index 93% rename from ziti/cmd/ziti/cmd/demo/root.go rename to ziti/cmd/demo/root.go index 6009dac6f..044976664 100644 --- a/ziti/cmd/ziti/cmd/demo/root.go +++ b/ziti/cmd/demo/root.go @@ -17,9 +17,9 @@ package demo import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/agentcli" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/agentcli" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-client.go b/ziti/cmd/demo/setup-client.go similarity index 91% rename from ziti/cmd/ziti/cmd/demo/setup-client.go rename to ziti/cmd/demo/setup-client.go index 28dedd95e..72d00c014 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-client.go +++ b/ziti/cmd/demo/setup-client.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-multi-router-tunneler-hosted-service.go b/ziti/cmd/demo/setup-multi-router-tunneler-hosted-service.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-multi-router-tunneler-hosted-service.go rename to ziti/cmd/demo/setup-multi-router-tunneler-hosted-service.go index 8e9ea2525..5a688f7c8 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-multi-router-tunneler-hosted-service.go +++ b/ziti/cmd/demo/setup-multi-router-tunneler-hosted-service.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-multi-sdk-service.go b/ziti/cmd/demo/setup-multi-sdk-service.go similarity index 91% rename from ziti/cmd/ziti/cmd/demo/setup-multi-sdk-service.go rename to ziti/cmd/demo/setup-multi-sdk-service.go index dfaf0f13d..85b15385a 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-multi-sdk-service.go +++ b/ziti/cmd/demo/setup-multi-sdk-service.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-multi-tunneler-hosted-service.go b/ziti/cmd/demo/setup-multi-tunneler-hosted-service.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-multi-tunneler-hosted-service.go rename to ziti/cmd/demo/setup-multi-tunneler-hosted-service.go index 6c28fc6fd..cc8d1c229 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-multi-tunneler-hosted-service.go +++ b/ziti/cmd/demo/setup-multi-tunneler-hosted-service.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-router-tunneler-both-sides.go b/ziti/cmd/demo/setup-router-tunneler-both-sides.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-router-tunneler-both-sides.go rename to ziti/cmd/demo/setup-router-tunneler-both-sides.go index b2d073e2a..98c546be7 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-router-tunneler-both-sides.go +++ b/ziti/cmd/demo/setup-router-tunneler-both-sides.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/multi-router-tunneler-hosted.md b/ziti/cmd/demo/setup-scripts/multi-router-tunneler-hosted.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/multi-router-tunneler-hosted.md rename to ziti/cmd/demo/setup-scripts/multi-router-tunneler-hosted.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/multi-sdk-hosted.md b/ziti/cmd/demo/setup-scripts/multi-sdk-hosted.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/multi-sdk-hosted.md rename to ziti/cmd/demo/setup-scripts/multi-sdk-hosted.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/multi-tunneler-hosted.md b/ziti/cmd/demo/setup-scripts/multi-tunneler-hosted.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/multi-tunneler-hosted.md rename to ziti/cmd/demo/setup-scripts/multi-tunneler-hosted.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/router-tunneler-both-sides.md b/ziti/cmd/demo/setup-scripts/router-tunneler-both-sides.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/router-tunneler-both-sides.md rename to ziti/cmd/demo/setup-scripts/router-tunneler-both-sides.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/sdk-client.md b/ziti/cmd/demo/setup-scripts/sdk-client.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/sdk-client.md rename to ziti/cmd/demo/setup-scripts/sdk-client.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/single-router-tunneler-hosted.md b/ziti/cmd/demo/setup-scripts/single-router-tunneler-hosted.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/single-router-tunneler-hosted.md rename to ziti/cmd/demo/setup-scripts/single-router-tunneler-hosted.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/single-sdk-hosted.md b/ziti/cmd/demo/setup-scripts/single-sdk-hosted.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/single-sdk-hosted.md rename to ziti/cmd/demo/setup-scripts/single-sdk-hosted.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/update-config-addressable.md b/ziti/cmd/demo/setup-scripts/update-config-addressable.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/update-config-addressable.md rename to ziti/cmd/demo/setup-scripts/update-config-addressable.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-scripts/update-config-ha.md b/ziti/cmd/demo/setup-scripts/update-config-ha.md similarity index 100% rename from ziti/cmd/ziti/cmd/demo/setup-scripts/update-config-ha.md rename to ziti/cmd/demo/setup-scripts/update-config-ha.md diff --git a/ziti/cmd/ziti/cmd/demo/setup-single-router-tunneler-hosted-service.go b/ziti/cmd/demo/setup-single-router-tunneler-hosted-service.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-single-router-tunneler-hosted-service.go rename to ziti/cmd/demo/setup-single-router-tunneler-hosted-service.go index 485b6e011..36f5ea69c 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-single-router-tunneler-hosted-service.go +++ b/ziti/cmd/demo/setup-single-router-tunneler-hosted-service.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-single-sdk-service.go b/ziti/cmd/demo/setup-single-sdk-service.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-single-sdk-service.go rename to ziti/cmd/demo/setup-single-sdk-service.go index 19d108f8a..db95e1640 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-single-sdk-service.go +++ b/ziti/cmd/demo/setup-single-sdk-service.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-update-config-addressable.go b/ziti/cmd/demo/setup-update-config-addressable.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-update-config-addressable.go rename to ziti/cmd/demo/setup-update-config-addressable.go index bd083a9fb..aa7320e5e 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-update-config-addressable.go +++ b/ziti/cmd/demo/setup-update-config-addressable.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/setup-update-config-ha.go b/ziti/cmd/demo/setup-update-config-ha.go similarity index 92% rename from ziti/cmd/ziti/cmd/demo/setup-update-config-ha.go rename to ziti/cmd/demo/setup-update-config-ha.go index 9e2cac205..b0bc6e961 100644 --- a/ziti/cmd/ziti/cmd/demo/setup-update-config-ha.go +++ b/ziti/cmd/demo/setup-update-config-ha.go @@ -20,10 +20,10 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/tutorial" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/tutorial" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/demo/zcat.go b/ziti/cmd/demo/zcat.go similarity index 100% rename from ziti/cmd/ziti/cmd/demo/zcat.go rename to ziti/cmd/demo/zcat.go diff --git a/ziti/cmd/ziti/cmd/edge/common.go b/ziti/cmd/edge/common.go similarity index 98% rename from ziti/cmd/ziti/cmd/edge/common.go rename to ziti/cmd/edge/common.go index 670e56e8f..1cc7b694e 100644 --- a/ziti/cmd/ziti/cmd/edge/common.go +++ b/ziti/cmd/edge/common.go @@ -18,7 +18,7 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" "github.com/pkg/errors" "os" "strings" diff --git a/ziti/cmd/ziti/cmd/edge/create.go b/ziti/cmd/edge/create.go similarity index 92% rename from ziti/cmd/ziti/cmd/edge/create.go rename to ziti/cmd/edge/create.go index c0abb240c..55f3b376b 100644 --- a/ziti/cmd/ziti/cmd/edge/create.go +++ b/ziti/cmd/edge/create.go @@ -18,11 +18,11 @@ package edge import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_authenticator.go b/ziti/cmd/edge/create_authenticator.go similarity index 92% rename from ziti/cmd/ziti/cmd/edge/create_authenticator.go rename to ziti/cmd/edge/create_authenticator.go index 457228efc..f8356257e 100644 --- a/ziti/cmd/ziti/cmd/edge/create_authenticator.go +++ b/ziti/cmd/edge/create_authenticator.go @@ -17,8 +17,8 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_authenticator_updb.go b/ziti/cmd/edge/create_authenticator_updb.go similarity index 96% rename from ziti/cmd/ziti/cmd/edge/create_authenticator_updb.go rename to ziti/cmd/edge/create_authenticator_updb.go index 3b5894ab9..be118dd0e 100644 --- a/ziti/cmd/ziti/cmd/edge/create_authenticator_updb.go +++ b/ziti/cmd/edge/create_authenticator_updb.go @@ -23,9 +23,9 @@ import ( "github.com/Jeffail/gabs" "github.com/openziti/edge/rest_management_api_client/authenticator" "github.com/openziti/foundation/v2/term" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_ca.go b/ziti/cmd/edge/create_ca.go similarity index 96% rename from ziti/cmd/ziti/cmd/edge/create_ca.go rename to ziti/cmd/edge/create_ca.go index 198b22c55..565969ce0 100644 --- a/ziti/cmd/ziti/cmd/edge/create_ca.go +++ b/ziti/cmd/edge/create_ca.go @@ -20,10 +20,10 @@ import ( "fmt" "github.com/openziti/edge/rest_management_api_client/certificate_authority" "github.com/openziti/edge/rest_model" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" "os" diff --git a/ziti/cmd/ziti/cmd/edge/create_config.go b/ziti/cmd/edge/create_config.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/create_config.go rename to ziti/cmd/edge/create_config.go index bd3eadf6e..a41285990 100644 --- a/ziti/cmd/ziti/cmd/edge/create_config.go +++ b/ziti/cmd/edge/create_config.go @@ -19,15 +19,15 @@ package edge import ( "encoding/json" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "io/ioutil" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_config_type.go b/ziti/cmd/edge/create_config_type.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/create_config_type.go rename to ziti/cmd/edge/create_config_type.go index 03b28da4b..bae8fd95a 100644 --- a/ziti/cmd/ziti/cmd/edge/create_config_type.go +++ b/ziti/cmd/edge/create_config_type.go @@ -19,15 +19,15 @@ package edge import ( "encoding/json" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "io/ioutil" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_edge_router.go b/ziti/cmd/edge/create_edge_router.go similarity index 96% rename from ziti/cmd/ziti/cmd/edge/create_edge_router.go rename to ziti/cmd/edge/create_edge_router.go index 6df6c80c6..3b7922ef5 100644 --- a/ziti/cmd/ziti/cmd/edge/create_edge_router.go +++ b/ziti/cmd/edge/create_edge_router.go @@ -18,14 +18,13 @@ package edge import ( "fmt" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "io/ioutil" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go b/ziti/cmd/edge/create_edge_router_policy.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go rename to ziti/cmd/edge/create_edge_router_policy.go index 84e90418b..b6505dcf2 100644 --- a/ziti/cmd/ziti/cmd/edge/create_edge_router_policy.go +++ b/ziti/cmd/edge/create_edge_router_policy.go @@ -17,12 +17,12 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_enrollment.go b/ziti/cmd/edge/create_enrollment.go similarity index 96% rename from ziti/cmd/ziti/cmd/edge/create_enrollment.go rename to ziti/cmd/edge/create_enrollment.go index 05f23a89d..b00e23970 100644 --- a/ziti/cmd/ziti/cmd/edge/create_enrollment.go +++ b/ziti/cmd/edge/create_enrollment.go @@ -22,10 +22,10 @@ import ( "github.com/go-openapi/strfmt" "github.com/openziti/edge/rest_management_api_client/enrollment" "github.com/openziti/edge/rest_model" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" "time" diff --git a/ziti/cmd/ziti/cmd/edge/create_identity.go b/ziti/cmd/edge/create_identity.go similarity index 97% rename from ziti/cmd/ziti/cmd/edge/create_identity.go rename to ziti/cmd/edge/create_identity.go index 329a07114..036398376 100644 --- a/ziti/cmd/ziti/cmd/edge/create_identity.go +++ b/ziti/cmd/edge/create_identity.go @@ -18,7 +18,9 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" "io" "io/ioutil" @@ -27,8 +29,6 @@ import ( "strings" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_posture_check.go b/ziti/cmd/edge/create_posture_check.go similarity index 99% rename from ziti/cmd/ziti/cmd/edge/create_posture_check.go rename to ziti/cmd/edge/create_posture_check.go index 0b9dc9aa6..9b119ba33 100644 --- a/ziti/cmd/ziti/cmd/edge/create_posture_check.go +++ b/ziti/cmd/edge/create_posture_check.go @@ -21,10 +21,10 @@ import ( "github.com/Jeffail/gabs" "github.com/openziti/edge/rest_management_api_client/posture_checks" "github.com/openziti/edge/rest_model" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" "regexp" diff --git a/ziti/cmd/ziti/cmd/edge/create_service.go b/ziti/cmd/edge/create_service.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/create_service.go rename to ziti/cmd/edge/create_service.go index 75561f9dd..1a206fe63 100644 --- a/ziti/cmd/ziti/cmd/edge/create_service.go +++ b/ziti/cmd/edge/create_service.go @@ -18,9 +18,9 @@ package edge import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go b/ziti/cmd/edge/create_service_edge_router_policy.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go rename to ziti/cmd/edge/create_service_edge_router_policy.go index 7f0cf4b16..875dbfc97 100644 --- a/ziti/cmd/ziti/cmd/edge/create_service_edge_router_policy.go +++ b/ziti/cmd/edge/create_service_edge_router_policy.go @@ -17,12 +17,12 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_service_policy.go b/ziti/cmd/edge/create_service_policy.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/create_service_policy.go rename to ziti/cmd/edge/create_service_policy.go index bd65a0a47..e23c37d46 100644 --- a/ziti/cmd/ziti/cmd/edge/create_service_policy.go +++ b/ziti/cmd/edge/create_service_policy.go @@ -17,15 +17,15 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "strings" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/create_terminator.go b/ziti/cmd/edge/create_terminator.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/create_terminator.go rename to ziti/cmd/edge/create_terminator.go index 7a1a610a1..7e4b7be18 100644 --- a/ziti/cmd/ziti/cmd/edge/create_terminator.go +++ b/ziti/cmd/edge/create_terminator.go @@ -21,9 +21,9 @@ import ( "github.com/Jeffail/gabs" "github.com/openziti/edge/router/xgress_edge_transport" "github.com/openziti/foundation/v2/stringz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" "math" diff --git a/ziti/cmd/ziti/cmd/edge/db.go b/ziti/cmd/edge/db.go similarity index 88% rename from ziti/cmd/ziti/cmd/edge/db.go rename to ziti/cmd/edge/db.go index 907405bcb..b4b8f857f 100644 --- a/ziti/cmd/ziti/cmd/edge/db.go +++ b/ziti/cmd/edge/db.go @@ -1,7 +1,7 @@ package edge import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/db_check_integrity.go b/ziti/cmd/edge/db_check_integrity.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/db_check_integrity.go rename to ziti/cmd/edge/db_check_integrity.go index 910adf4ca..389946813 100644 --- a/ziti/cmd/ziti/cmd/edge/db_check_integrity.go +++ b/ziti/cmd/edge/db_check_integrity.go @@ -3,10 +3,10 @@ package edge import ( "fmt" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "github.com/spf13/cobra" "io" diff --git a/ziti/cmd/ziti/cmd/edge/db_snapshot.go b/ziti/cmd/edge/db_snapshot.go similarity index 87% rename from ziti/cmd/ziti/cmd/edge/db_snapshot.go rename to ziti/cmd/edge/db_snapshot.go index ad69263e2..e827491e1 100644 --- a/ziti/cmd/ziti/cmd/edge/db_snapshot.go +++ b/ziti/cmd/edge/db_snapshot.go @@ -17,10 +17,10 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" "net/http" diff --git a/ziti/cmd/ziti/cmd/edge/delete.go b/ziti/cmd/edge/delete.go similarity index 96% rename from ziti/cmd/ziti/cmd/edge/delete.go rename to ziti/cmd/edge/delete.go index 606a345b2..7908be24b 100644 --- a/ziti/cmd/ziti/cmd/edge/delete.go +++ b/ziti/cmd/edge/delete.go @@ -19,14 +19,14 @@ package edge import ( "github.com/fatih/color" "github.com/openziti/storage/boltz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "io" "net/url" "strings" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/detail.go b/ziti/cmd/edge/detail.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/detail.go rename to ziti/cmd/edge/detail.go index 03783f2b5..b01d5def8 100644 --- a/ziti/cmd/ziti/cmd/edge/detail.go +++ b/ziti/cmd/edge/detail.go @@ -18,7 +18,7 @@ package edge import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/util" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/encryption_var.go b/ziti/cmd/edge/encryption_var.go similarity index 100% rename from ziti/cmd/ziti/cmd/edge/encryption_var.go rename to ziti/cmd/edge/encryption_var.go diff --git a/ziti/cmd/ziti/cmd/edge/list.go b/ziti/cmd/edge/list.go similarity index 99% rename from ziti/cmd/ziti/cmd/edge/list.go rename to ziti/cmd/edge/list.go index a69268a32..2b122cc40 100644 --- a/ziti/cmd/ziti/cmd/edge/list.go +++ b/ziti/cmd/edge/list.go @@ -23,6 +23,10 @@ import ( "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" "github.com/openziti/foundation/v2/stringz" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "io" "net/url" "sort" @@ -32,10 +36,6 @@ import ( "github.com/Jeffail/gabs" "github.com/openziti/edge/rest_management_api_client/certificate_authority" "github.com/openziti/edge/rest_model" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/pkg/errors" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/login.go b/ziti/cmd/edge/login.go similarity index 97% rename from ziti/cmd/ziti/cmd/edge/login.go rename to ziti/cmd/edge/login.go index 0a9902678..f1fa783d3 100644 --- a/ziti/cmd/ziti/cmd/edge/login.go +++ b/ziti/cmd/edge/login.go @@ -20,10 +20,10 @@ import ( "fmt" "github.com/Jeffail/gabs" "github.com/openziti/foundation/v2/term" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "github.com/spf13/cobra" "io" diff --git a/ziti/cmd/ziti/cmd/edge/logout.go b/ziti/cmd/edge/logout.go similarity index 89% rename from ziti/cmd/ziti/cmd/edge/logout.go rename to ziti/cmd/edge/logout.go index 67cadfb51..10539ba67 100644 --- a/ziti/cmd/ziti/cmd/edge/logout.go +++ b/ziti/cmd/edge/logout.go @@ -17,10 +17,10 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/policy_advisor.go b/ziti/cmd/edge/policy_advisor.go similarity index 98% rename from ziti/cmd/ziti/cmd/edge/policy_advisor.go rename to ziti/cmd/edge/policy_advisor.go index d29b58148..6cabe3759 100644 --- a/ziti/cmd/ziti/cmd/edge/policy_advisor.go +++ b/ziti/cmd/edge/policy_advisor.go @@ -19,10 +19,10 @@ package edge import ( "fmt" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/root.go b/ziti/cmd/edge/root.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/root.go rename to ziti/cmd/edge/root.go index cf7137e42..b3beb2aee 100644 --- a/ziti/cmd/ziti/cmd/edge/root.go +++ b/ziti/cmd/edge/root.go @@ -17,12 +17,11 @@ package edge import ( + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/util" "io" "github.com/openziti/ziti/common/enrollment" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/show.go b/ziti/cmd/edge/show.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/show.go rename to ziti/cmd/edge/show.go index ba28936ad..eec144c6d 100644 --- a/ziti/cmd/ziti/cmd/edge/show.go +++ b/ziti/cmd/edge/show.go @@ -19,10 +19,10 @@ package edge import ( "encoding/json" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/trace_identity.go b/ziti/cmd/edge/trace_identity.go similarity index 94% rename from ziti/cmd/ziti/cmd/edge/trace_identity.go rename to ziti/cmd/edge/trace_identity.go index 0764f4818..384e94e73 100644 --- a/ziti/cmd/ziti/cmd/edge/trace_identity.go +++ b/ziti/cmd/edge/trace_identity.go @@ -19,9 +19,9 @@ package edge import ( "fmt" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/traceroute.go b/ziti/cmd/edge/traceroute.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/traceroute.go rename to ziti/cmd/edge/traceroute.go index 3f2396a88..25fe33c5b 100644 --- a/ziti/cmd/ziti/cmd/edge/traceroute.go +++ b/ziti/cmd/edge/traceroute.go @@ -4,9 +4,9 @@ import ( "fmt" "github.com/openziti/sdk-golang/ziti" "github.com/openziti/sdk-golang/ziti/config" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "io" diff --git a/ziti/cmd/ziti/cmd/edge/update.go b/ziti/cmd/edge/update.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update.go rename to ziti/cmd/edge/update.go index 73c14e297..903377156 100644 --- a/ziti/cmd/ziti/cmd/edge/update.go +++ b/ziti/cmd/edge/update.go @@ -18,9 +18,9 @@ package edge import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "gopkg.in/resty.v1" "io" diff --git a/ziti/cmd/ziti/cmd/edge/update_authenticator.go b/ziti/cmd/edge/update_authenticator.go similarity index 92% rename from ziti/cmd/ziti/cmd/edge/update_authenticator.go rename to ziti/cmd/edge/update_authenticator.go index 87fdb9e43..1c6e55b72 100644 --- a/ziti/cmd/ziti/cmd/edge/update_authenticator.go +++ b/ziti/cmd/edge/update_authenticator.go @@ -17,8 +17,8 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_authenticator_updb.go b/ziti/cmd/edge/update_authenticator_updb.go similarity index 97% rename from ziti/cmd/ziti/cmd/edge/update_authenticator_updb.go rename to ziti/cmd/edge/update_authenticator_updb.go index 60ea8f008..2cb48b99c 100644 --- a/ziti/cmd/ziti/cmd/edge/update_authenticator_updb.go +++ b/ziti/cmd/edge/update_authenticator_updb.go @@ -23,11 +23,11 @@ import ( "github.com/Jeffail/gabs" "github.com/openziti/edge/rest_management_api_client/authenticator" "github.com/openziti/foundation/v2/term" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" ) -import cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" type updateUpdbOptions struct { api.Options diff --git a/ziti/cmd/ziti/cmd/edge/update_ca.go b/ziti/cmd/edge/update_ca.go similarity index 97% rename from ziti/cmd/ziti/cmd/edge/update_ca.go rename to ziti/cmd/edge/update_ca.go index ab43471ac..1cad4385e 100644 --- a/ziti/cmd/ziti/cmd/edge/update_ca.go +++ b/ziti/cmd/edge/update_ca.go @@ -20,10 +20,10 @@ import ( "fmt" "github.com/openziti/edge/rest_management_api_client/certificate_authority" "github.com/openziti/edge/rest_model" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "github.com/spf13/cobra" "gopkg.in/resty.v1" diff --git a/ziti/cmd/ziti/cmd/edge/update_config.go b/ziti/cmd/edge/update_config.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_config.go rename to ziti/cmd/edge/update_config.go index 320943cae..04bd4a4da 100644 --- a/ziti/cmd/ziti/cmd/edge/update_config.go +++ b/ziti/cmd/edge/update_config.go @@ -19,15 +19,15 @@ package edge import ( "encoding/json" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "io/ioutil" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_config_type.go b/ziti/cmd/edge/update_config_type.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_config_type.go rename to ziti/cmd/edge/update_config_type.go index cfb3c0f04..df4665c0f 100644 --- a/ziti/cmd/ziti/cmd/edge/update_config_type.go +++ b/ziti/cmd/edge/update_config_type.go @@ -19,15 +19,15 @@ package edge import ( "encoding/json" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "os" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_edge_router.go b/ziti/cmd/edge/update_edge_router.go similarity index 96% rename from ziti/cmd/ziti/cmd/edge/update_edge_router.go rename to ziti/cmd/edge/update_edge_router.go index bb88af44a..711706685 100644 --- a/ziti/cmd/ziti/cmd/edge/update_edge_router.go +++ b/ziti/cmd/edge/update_edge_router.go @@ -18,15 +18,14 @@ package edge import ( "fmt" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go b/ziti/cmd/edge/update_edge_router_policy.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go rename to ziti/cmd/edge/update_edge_router_policy.go index 17fea861f..0a208ebfa 100644 --- a/ziti/cmd/ziti/cmd/edge/update_edge_router_policy.go +++ b/ziti/cmd/edge/update_edge_router_policy.go @@ -18,14 +18,14 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_identity.go b/ziti/cmd/edge/update_identity.go similarity index 97% rename from ziti/cmd/ziti/cmd/edge/update_identity.go rename to ziti/cmd/edge/update_identity.go index 547b30e37..5cda6d43c 100644 --- a/ziti/cmd/ziti/cmd/edge/update_identity.go +++ b/ziti/cmd/edge/update_identity.go @@ -19,7 +19,9 @@ package edge import ( "fmt" "github.com/openziti/sdk-golang/ziti" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "math" "strings" @@ -27,8 +29,6 @@ import ( "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_identity_configs.go b/ziti/cmd/edge/update_identity_configs.go similarity index 93% rename from ziti/cmd/ziti/cmd/edge/update_identity_configs.go rename to ziti/cmd/edge/update_identity_configs.go index 001199beb..3007b7492 100644 --- a/ziti/cmd/ziti/cmd/edge/update_identity_configs.go +++ b/ziti/cmd/edge/update_identity_configs.go @@ -18,12 +18,12 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_posture_check.go b/ziti/cmd/edge/update_posture_check.go similarity index 98% rename from ziti/cmd/ziti/cmd/edge/update_posture_check.go rename to ziti/cmd/edge/update_posture_check.go index 34ef82b6b..ffa47d162 100644 --- a/ziti/cmd/ziti/cmd/edge/update_posture_check.go +++ b/ziti/cmd/edge/update_posture_check.go @@ -18,14 +18,14 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_service.go b/ziti/cmd/edge/update_service.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_service.go rename to ziti/cmd/edge/update_service.go index 495b2dad2..bdeb93060 100644 --- a/ziti/cmd/ziti/cmd/edge/update_service.go +++ b/ziti/cmd/edge/update_service.go @@ -18,14 +18,14 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go b/ziti/cmd/edge/update_service_edge_router_policy.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go rename to ziti/cmd/edge/update_service_edge_router_policy.go index 8a34e3247..e24361a42 100644 --- a/ziti/cmd/ziti/cmd/edge/update_service_edge_router_policy.go +++ b/ziti/cmd/edge/update_service_edge_router_policy.go @@ -18,14 +18,14 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_service_policy.go b/ziti/cmd/edge/update_service_policy.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_service_policy.go rename to ziti/cmd/edge/update_service_policy.go index 731ddc333..e5336aaa7 100644 --- a/ziti/cmd/ziti/cmd/edge/update_service_policy.go +++ b/ziti/cmd/edge/update_service_policy.go @@ -18,14 +18,14 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/update_terminator.go b/ziti/cmd/edge/update_terminator.go similarity index 95% rename from ziti/cmd/ziti/cmd/edge/update_terminator.go rename to ziti/cmd/edge/update_terminator.go index bfa758894..b826942e9 100644 --- a/ziti/cmd/ziti/cmd/edge/update_terminator.go +++ b/ziti/cmd/edge/update_terminator.go @@ -21,9 +21,9 @@ import ( "fmt" "github.com/Jeffail/gabs" "github.com/openziti/foundation/v2/stringz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" errors2 "github.com/pkg/errors" "github.com/spf13/cobra" "io" diff --git a/ziti/cmd/ziti/cmd/edge/use.go b/ziti/cmd/edge/use.go similarity index 90% rename from ziti/cmd/ziti/cmd/edge/use.go rename to ziti/cmd/edge/use.go index 8d7b679bc..7fa1eee87 100644 --- a/ziti/cmd/ziti/cmd/edge/use.go +++ b/ziti/cmd/edge/use.go @@ -17,10 +17,10 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/edge/verify.go b/ziti/cmd/edge/verify.go similarity index 89% rename from ziti/cmd/ziti/cmd/edge/verify.go rename to ziti/cmd/edge/verify.go index c28cddeb0..14c79fe6a 100644 --- a/ziti/cmd/ziti/cmd/edge/verify.go +++ b/ziti/cmd/edge/verify.go @@ -17,11 +17,11 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/edge/verify_ca.go b/ziti/cmd/edge/verify_ca.go similarity index 97% rename from ziti/cmd/ziti/cmd/edge/verify_ca.go rename to ziti/cmd/edge/verify_ca.go index 505a17003..2a6ea51aa 100644 --- a/ziti/cmd/ziti/cmd/edge/verify_ca.go +++ b/ziti/cmd/edge/verify_ca.go @@ -28,10 +28,10 @@ import ( "fmt" nfpem "github.com/openziti/foundation/v2/pem" "github.com/openziti/foundation/v2/term" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "gopkg.in/resty.v1" "io" diff --git a/ziti/cmd/ziti/cmd/edge/version.go b/ziti/cmd/edge/version.go similarity index 89% rename from ziti/cmd/ziti/cmd/edge/version.go rename to ziti/cmd/edge/version.go index a2413ad23..8ac22309f 100644 --- a/ziti/cmd/ziti/cmd/edge/version.go +++ b/ziti/cmd/edge/version.go @@ -18,10 +18,10 @@ package edge import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/execute.go b/ziti/cmd/execute.go similarity index 93% rename from ziti/cmd/ziti/cmd/execute.go rename to ziti/cmd/execute.go index b31ac4c37..c52b3f066 100644 --- a/ziti/cmd/ziti/cmd/execute.go +++ b/ziti/cmd/execute.go @@ -17,12 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "io" "github.com/spf13/cobra" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" ) // ExecuteOptions contains the command line options diff --git a/ziti/cmd/ziti/cmd/execute_controller.go b/ziti/cmd/execute_controller.go similarity index 92% rename from ziti/cmd/ziti/cmd/execute_controller.go rename to ziti/cmd/execute_controller.go index 051fbc33d..3373bbd9a 100644 --- a/ziti/cmd/ziti/cmd/execute_controller.go +++ b/ziti/cmd/execute_controller.go @@ -17,15 +17,15 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/util" "io" "path/filepath" "github.com/spf13/cobra" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/viper" ) diff --git a/ziti/cmd/ziti/cmd/fabric/add_identity.go b/ziti/cmd/fabric/add_identity.go similarity index 96% rename from ziti/cmd/ziti/cmd/fabric/add_identity.go rename to ziti/cmd/fabric/add_identity.go index da88bf378..f70e03cf9 100644 --- a/ziti/cmd/ziti/cmd/fabric/add_identity.go +++ b/ziti/cmd/fabric/add_identity.go @@ -17,8 +17,8 @@ package fabric import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/create_router.go b/ziti/cmd/fabric/create_router.go similarity index 96% rename from ziti/cmd/ziti/cmd/fabric/create_router.go rename to ziti/cmd/fabric/create_router.go index c4a49feb2..30e229a34 100644 --- a/ziti/cmd/ziti/cmd/fabric/create_router.go +++ b/ziti/cmd/fabric/create_router.go @@ -19,11 +19,10 @@ package fabric import ( "crypto/sha1" "fmt" - "github.com/Jeffail/gabs" "github.com/openziti/identity/certtools" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/create_service.go b/ziti/cmd/fabric/create_service.go similarity index 95% rename from ziti/cmd/ziti/cmd/fabric/create_service.go rename to ziti/cmd/fabric/create_service.go index 296eaf5cd..cbde98cb4 100644 --- a/ziti/cmd/ziti/cmd/fabric/create_service.go +++ b/ziti/cmd/fabric/create_service.go @@ -18,8 +18,8 @@ package fabric import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/create_terminator.go b/ziti/cmd/fabric/create_terminator.go similarity index 94% rename from ziti/cmd/ziti/cmd/fabric/create_terminator.go rename to ziti/cmd/fabric/create_terminator.go index 704b2ed7d..f0babd273 100644 --- a/ziti/cmd/ziti/cmd/fabric/create_terminator.go +++ b/ziti/cmd/fabric/create_terminator.go @@ -21,10 +21,10 @@ import ( "github.com/Jeffail/gabs" "github.com/openziti/edge/router/xgress_edge_transport" "github.com/openziti/foundation/v2/stringz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "math" ) diff --git a/ziti/cmd/ziti/cmd/fabric/db.go b/ziti/cmd/fabric/db.go similarity index 80% rename from ziti/cmd/ziti/cmd/fabric/db.go rename to ziti/cmd/fabric/db.go index 849db59ff..fee817e91 100644 --- a/ziti/cmd/ziti/cmd/fabric/db.go +++ b/ziti/cmd/fabric/db.go @@ -1,8 +1,8 @@ package fabric import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/db_check_integrity.go b/ziti/cmd/fabric/db_check_integrity.go similarity index 94% rename from ziti/cmd/ziti/cmd/fabric/db_check_integrity.go rename to ziti/cmd/fabric/db_check_integrity.go index 46d9fb153..02bec1f33 100644 --- a/ziti/cmd/ziti/cmd/fabric/db_check_integrity.go +++ b/ziti/cmd/fabric/db_check_integrity.go @@ -3,10 +3,10 @@ package fabric import ( "fmt" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "github.com/spf13/cobra" "net/http" diff --git a/ziti/cmd/ziti/cmd/fabric/db_snapshot.go b/ziti/cmd/fabric/db_snapshot.go similarity index 87% rename from ziti/cmd/ziti/cmd/fabric/db_snapshot.go rename to ziti/cmd/fabric/db_snapshot.go index 75912a175..239215c0b 100644 --- a/ziti/cmd/ziti/cmd/fabric/db_snapshot.go +++ b/ziti/cmd/fabric/db_snapshot.go @@ -17,10 +17,10 @@ package fabric import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "net/http" ) diff --git a/ziti/cmd/ziti/cmd/fabric/delete.go b/ziti/cmd/fabric/delete.go similarity index 95% rename from ziti/cmd/ziti/cmd/fabric/delete.go rename to ziti/cmd/fabric/delete.go index 7c7a60e4c..2a514e180 100644 --- a/ziti/cmd/ziti/cmd/fabric/delete.go +++ b/ziti/cmd/fabric/delete.go @@ -18,10 +18,10 @@ package fabric import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/inspect.go b/ziti/cmd/fabric/inspect.go similarity index 96% rename from ziti/cmd/ziti/cmd/fabric/inspect.go rename to ziti/cmd/fabric/inspect.go index 8e07f9bd2..e39cdef71 100644 --- a/ziti/cmd/ziti/cmd/fabric/inspect.go +++ b/ziti/cmd/fabric/inspect.go @@ -7,9 +7,9 @@ import ( "github.com/openziti/fabric/rest_model" "github.com/openziti/foundation/v2/errorz" "github.com/openziti/foundation/v2/stringz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "io" "os" diff --git a/ziti/cmd/ziti/cmd/fabric/list.go b/ziti/cmd/fabric/list.go similarity index 97% rename from ziti/cmd/ziti/cmd/fabric/list.go rename to ziti/cmd/fabric/list.go index a8c19803a..d41e9ad70 100644 --- a/ziti/cmd/ziti/cmd/fabric/list.go +++ b/ziti/cmd/fabric/list.go @@ -18,15 +18,15 @@ package fabric import ( "fmt" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "strings" "github.com/Jeffail/gabs" "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/remove_identity.go b/ziti/cmd/fabric/remove_identity.go similarity index 91% rename from ziti/cmd/ziti/cmd/fabric/remove_identity.go rename to ziti/cmd/fabric/remove_identity.go index 6daa83260..9d4895ce4 100644 --- a/ziti/cmd/ziti/cmd/fabric/remove_identity.go +++ b/ziti/cmd/fabric/remove_identity.go @@ -17,9 +17,9 @@ package fabric import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/root.go b/ziti/cmd/fabric/root.go similarity index 94% rename from ziti/cmd/ziti/cmd/fabric/root.go rename to ziti/cmd/fabric/root.go index f5ddc17b0..8775a39ba 100644 --- a/ziti/cmd/ziti/cmd/fabric/root.go +++ b/ziti/cmd/fabric/root.go @@ -18,10 +18,10 @@ package fabric import ( "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/spf13/cobra" "gopkg.in/resty.v1" ) diff --git a/ziti/cmd/ziti/cmd/fabric/stream_circuits.go b/ziti/cmd/fabric/stream_circuits.go similarity index 96% rename from ziti/cmd/ziti/cmd/fabric/stream_circuits.go rename to ziti/cmd/fabric/stream_circuits.go index 8b12030fc..bde0ae5af 100644 --- a/ziti/cmd/ziti/cmd/fabric/stream_circuits.go +++ b/ziti/cmd/fabric/stream_circuits.go @@ -18,12 +18,12 @@ package fabric import ( "fmt" - "google.golang.org/protobuf/proto" "github.com/openziti/channel/v2" "github.com/openziti/fabric/pb/mgmt_pb" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" + "google.golang.org/protobuf/proto" "time" ) diff --git a/ziti/cmd/ziti/cmd/fabric/stream_metrics.go b/ziti/cmd/fabric/stream_metrics.go similarity index 97% rename from ziti/cmd/ziti/cmd/fabric/stream_metrics.go rename to ziti/cmd/fabric/stream_metrics.go index b590abaf9..bbb8082bf 100644 --- a/ziti/cmd/ziti/cmd/fabric/stream_metrics.go +++ b/ziti/cmd/fabric/stream_metrics.go @@ -20,8 +20,8 @@ import ( "fmt" "github.com/openziti/channel/v2" "github.com/openziti/fabric/pb/mgmt_pb" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/ziti/cmd/ziti/cmd/fabric/stream_toggle_pipe_traces.go b/ziti/cmd/fabric/stream_toggle_pipe_traces.go similarity index 96% rename from ziti/cmd/ziti/cmd/fabric/stream_toggle_pipe_traces.go rename to ziti/cmd/fabric/stream_toggle_pipe_traces.go index c4c14b51c..7113bee60 100644 --- a/ziti/cmd/ziti/cmd/fabric/stream_toggle_pipe_traces.go +++ b/ziti/cmd/fabric/stream_toggle_pipe_traces.go @@ -18,13 +18,13 @@ package fabric import ( "fmt" - "google.golang.org/protobuf/proto" "github.com/openziti/channel/v2" "github.com/openziti/channel/v2/trace/pb" "github.com/openziti/fabric/pb/mgmt_pb" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" + "google.golang.org/protobuf/proto" "time" ) diff --git a/ziti/cmd/ziti/cmd/fabric/stream_traces.go b/ziti/cmd/fabric/stream_traces.go similarity index 98% rename from ziti/cmd/ziti/cmd/fabric/stream_traces.go rename to ziti/cmd/fabric/stream_traces.go index f902e2e6e..a9691f833 100644 --- a/ziti/cmd/ziti/cmd/fabric/stream_traces.go +++ b/ziti/cmd/fabric/stream_traces.go @@ -19,15 +19,15 @@ package fabric import ( "encoding/json" "fmt" - "google.golang.org/protobuf/proto" "github.com/openziti/channel/v2" "github.com/openziti/channel/v2/trace/pb" "github.com/openziti/fabric/pb/ctrl_pb" "github.com/openziti/fabric/pb/mgmt_pb" "github.com/openziti/fabric/router/xgress" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" + "google.golang.org/protobuf/proto" "reflect" "sort" "time" diff --git a/ziti/cmd/ziti/cmd/fabric/update_link.go b/ziti/cmd/fabric/update_link.go similarity index 92% rename from ziti/cmd/ziti/cmd/fabric/update_link.go rename to ziti/cmd/fabric/update_link.go index adaafeccb..14c504386 100644 --- a/ziti/cmd/ziti/cmd/fabric/update_link.go +++ b/ziti/cmd/fabric/update_link.go @@ -18,12 +18,12 @@ package fabric import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/update_router.go b/ziti/cmd/fabric/update_router.go similarity index 93% rename from ziti/cmd/ziti/cmd/fabric/update_router.go rename to ziti/cmd/fabric/update_router.go index 4e8972183..693c9726a 100644 --- a/ziti/cmd/ziti/cmd/fabric/update_router.go +++ b/ziti/cmd/fabric/update_router.go @@ -18,14 +18,13 @@ package fabric import ( "fmt" - - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/update_service.go b/ziti/cmd/fabric/update_service.go similarity index 92% rename from ziti/cmd/ziti/cmd/fabric/update_service.go rename to ziti/cmd/fabric/update_service.go index 7459336da..a7d4dd007 100644 --- a/ziti/cmd/ziti/cmd/fabric/update_service.go +++ b/ziti/cmd/fabric/update_service.go @@ -18,13 +18,13 @@ package fabric import ( "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "github.com/pkg/errors" "github.com/Jeffail/gabs" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/fabric/update_terminator.go b/ziti/cmd/fabric/update_terminator.go similarity index 94% rename from ziti/cmd/ziti/cmd/fabric/update_terminator.go rename to ziti/cmd/fabric/update_terminator.go index 42e5e7a3a..9541f8d15 100644 --- a/ziti/cmd/ziti/cmd/fabric/update_terminator.go +++ b/ziti/cmd/fabric/update_terminator.go @@ -21,10 +21,10 @@ import ( "fmt" "github.com/Jeffail/gabs" "github.com/openziti/foundation/v2/stringz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" errors2 "github.com/pkg/errors" "github.com/spf13/cobra" "math" diff --git a/ziti/cmd/ziti/cmd/helpers/env_helpers.go b/ziti/cmd/helpers/env_helpers.go similarity index 99% rename from ziti/cmd/ziti/cmd/helpers/env_helpers.go rename to ziti/cmd/helpers/env_helpers.go index 21ee4d8e1..ba3afbfa2 100644 --- a/ziti/cmd/ziti/cmd/helpers/env_helpers.go +++ b/ziti/cmd/helpers/env_helpers.go @@ -18,7 +18,7 @@ package helpers import ( edge "github.com/openziti/edge/controller/config" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" + "github.com/openziti/ziti/ziti/constants" "github.com/pkg/errors" "os" "strconv" diff --git a/ziti/cmd/ziti/cmd/helpers/helpers.go b/ziti/cmd/helpers/helpers.go similarity index 100% rename from ziti/cmd/ziti/cmd/helpers/helpers.go rename to ziti/cmd/helpers/helpers.go diff --git a/ziti/cmd/ziti/cmd/helpers/helpers_test.go b/ziti/cmd/helpers/helpers_test.go similarity index 100% rename from ziti/cmd/ziti/cmd/helpers/helpers_test.go rename to ziti/cmd/helpers/helpers_test.go diff --git a/ziti/cmd/ziti/cmd/init.go b/ziti/cmd/init.go similarity index 92% rename from ziti/cmd/ziti/cmd/init.go rename to ziti/cmd/init.go index 73cb4d4b8..48c2b1815 100644 --- a/ziti/cmd/ziti/cmd/init.go +++ b/ziti/cmd/init.go @@ -17,9 +17,9 @@ package cmd import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/install.go b/ziti/cmd/install.go similarity index 94% rename from ziti/cmd/ziti/cmd/install.go rename to ziti/cmd/install.go index 283d037ac..753ae3e85 100644 --- a/ziti/cmd/ziti/cmd/install.go +++ b/ziti/cmd/install.go @@ -17,10 +17,10 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_terraform_provider_edge_controller.go b/ziti/cmd/install_terraform_provider_edge_controller.go similarity index 92% rename from ziti/cmd/ziti/cmd/install_terraform_provider_edge_controller.go rename to ziti/cmd/install_terraform_provider_edge_controller.go index 71b6b84e5..a90747874 100644 --- a/ziti/cmd/ziti/cmd/install_terraform_provider_edge_controller.go +++ b/ziti/cmd/install_terraform_provider_edge_controller.go @@ -17,13 +17,13 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_ziti_ALL.go b/ziti/cmd/install_ziti_ALL.go similarity index 92% rename from ziti/cmd/ziti/cmd/install_ziti_ALL.go rename to ziti/cmd/install_ziti_ALL.go index 0a1285df8..01fb32d7c 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_ALL.go +++ b/ziti/cmd/install_ziti_ALL.go @@ -17,14 +17,14 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_ziti_controller.go b/ziti/cmd/install_ziti_controller.go similarity index 91% rename from ziti/cmd/ziti/cmd/install_ziti_controller.go rename to ziti/cmd/install_ziti_controller.go index 48ec8b3c7..aa4f67bb6 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_controller.go +++ b/ziti/cmd/install_ziti_controller.go @@ -17,14 +17,14 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_ziti_edge_tunnel.go b/ziti/cmd/install_ziti_edge_tunnel.go similarity index 91% rename from ziti/cmd/ziti/cmd/install_ziti_edge_tunnel.go rename to ziti/cmd/install_ziti_edge_tunnel.go index 9d7d7a4a0..144ea72da 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_edge_tunnel.go +++ b/ziti/cmd/install_ziti_edge_tunnel.go @@ -17,13 +17,13 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_ziti_prox_c.go b/ziti/cmd/install_ziti_prox_c.go similarity index 91% rename from ziti/cmd/ziti/cmd/install_ziti_prox_c.go rename to ziti/cmd/install_ziti_prox_c.go index 5385d7ed5..0c87056aa 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_prox_c.go +++ b/ziti/cmd/install_ziti_prox_c.go @@ -17,13 +17,13 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_ziti_router.go b/ziti/cmd/install_ziti_router.go similarity index 91% rename from ziti/cmd/ziti/cmd/install_ziti_router.go rename to ziti/cmd/install_ziti_router.go index bebf4508b..1296e7b30 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_router.go +++ b/ziti/cmd/install_ziti_router.go @@ -17,14 +17,14 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/install_ziti_tunnel.go b/ziti/cmd/install_ziti_tunnel.go similarity index 91% rename from ziti/cmd/ziti/cmd/install_ziti_tunnel.go rename to ziti/cmd/install_ziti_tunnel.go index 2a635d8d5..4d5e4c1cc 100644 --- a/ziti/cmd/ziti/cmd/install_ziti_tunnel.go +++ b/ziti/cmd/install_ziti_tunnel.go @@ -17,14 +17,14 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" "io" "github.com/blang/semver" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/KeyTypeVar.go b/ziti/cmd/lets_encrypt/KeyTypeVar.go similarity index 100% rename from ziti/cmd/ziti/cmd/lets_encrypt/KeyTypeVar.go rename to ziti/cmd/lets_encrypt/KeyTypeVar.go diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/account.go b/ziti/cmd/lets_encrypt/account.go similarity index 100% rename from ziti/cmd/ziti/cmd/lets_encrypt/account.go rename to ziti/cmd/lets_encrypt/account.go diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/accounts_storage.go b/ziti/cmd/lets_encrypt/accounts_storage.go similarity index 81% rename from ziti/cmd/ziti/cmd/lets_encrypt/accounts_storage.go rename to ziti/cmd/lets_encrypt/accounts_storage.go index 64f8ffba4..45faf02c4 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/accounts_storage.go +++ b/ziti/cmd/lets_encrypt/accounts_storage.go @@ -23,6 +23,7 @@ import ( "encoding/pem" "errors" "fmt" + "github.com/openziti/ziti/ziti/internal/log" "io/ioutil" "net/url" "os" @@ -32,7 +33,6 @@ import ( "github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/registration" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" ) const ( @@ -45,36 +45,35 @@ const ( // // rootPath: // -// ./.path/accounts/ -// │ └── root accounts directory -// └── "path" option +// ./.path/accounts/ +// │ └── root accounts directory +// └── "path" option // // rootUserPath: // -// ./.path/accounts/localhost_14000/hubert@hubert.com/ -// │ │ │ └── userID ("email" option) -// │ │ └── CA server ("server" option) -// │ └── root accounts directory -// └── "path" option +// ./.path/accounts/localhost_14000/hubert@hubert.com/ +// │ │ │ └── userID ("email" option) +// │ │ └── CA server ("server" option) +// │ └── root accounts directory +// └── "path" option // // keysPath: // -// ./.path/accounts/localhost_14000/hubert@hubert.com/keys/ -// │ │ │ │ └── root keys directory -// │ │ │ └── userID ("email" option) -// │ │ └── CA server ("server" option) -// │ └── root accounts directory -// └── "path" option +// ./.path/accounts/localhost_14000/hubert@hubert.com/keys/ +// │ │ │ │ └── root keys directory +// │ │ │ └── userID ("email" option) +// │ │ └── CA server ("server" option) +// │ └── root accounts directory +// └── "path" option // // accountFilePath: // -// ./.path/accounts/localhost_14000/hubert@hubert.com/account.json -// │ │ │ │ └── account file -// │ │ │ └── userID ("email" option) -// │ │ └── CA server ("server" option) -// │ └── root accounts directory -// └── "path" option -// +// ./.path/accounts/localhost_14000/hubert@hubert.com/account.json +// │ │ │ │ └── account file +// │ │ │ └── userID ("email" option) +// │ │ └── CA server ("server" option) +// │ └── root accounts directory +// └── "path" option type AccountsStorage struct { userID string rootPath string diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/certs_storage.go b/ziti/cmd/lets_encrypt/certs_storage.go similarity index 95% rename from ziti/cmd/ziti/cmd/lets_encrypt/certs_storage.go rename to ziti/cmd/lets_encrypt/certs_storage.go index 18b36f8b1..c19e2f3ab 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/certs_storage.go +++ b/ziti/cmd/lets_encrypt/certs_storage.go @@ -20,6 +20,7 @@ import ( "bytes" "crypto/x509" "encoding/json" + "github.com/openziti/ziti/ziti/internal/log" "io/ioutil" "os" "path/filepath" @@ -29,7 +30,6 @@ import ( "github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certificate" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "golang.org/x/net/idna" ) @@ -44,16 +44,15 @@ const ( // // rootPath: // -// ./.path/certificates/ -// │ └── root certificates directory -// └── "path" option +// ./.path/certificates/ +// │ └── root certificates directory +// └── "path" option // // archivePath: // -// ./.path/archives/ -// │ └── archived certificates directory -// └── "path" option -// +// ./.path/archives/ +// │ └── archived certificates directory +// └── "path" option type CertificatesStorage struct { rootPath string archivePath string diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/create.go b/ziti/cmd/lets_encrypt/create.go similarity index 97% rename from ziti/cmd/ziti/cmd/lets_encrypt/create.go rename to ziti/cmd/lets_encrypt/create.go index ec921a8d8..4f34029b2 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/create.go +++ b/ziti/cmd/lets_encrypt/create.go @@ -21,8 +21,8 @@ import ( "github.com/go-acme/lego/v4/certificate" "github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/registration" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "github.com/spf13/cobra" "io" ) diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/list.go b/ziti/cmd/lets_encrypt/list.go similarity index 98% rename from ziti/cmd/ziti/cmd/lets_encrypt/list.go rename to ziti/cmd/lets_encrypt/list.go index 257be1231..20aac1cdf 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/list.go +++ b/ziti/cmd/lets_encrypt/list.go @@ -19,6 +19,7 @@ package lets_encrypt import ( "encoding/json" "fmt" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" "io/ioutil" "net/url" @@ -26,7 +27,6 @@ import ( "strings" "github.com/go-acme/lego/v4/certcrypto" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/renew.go b/ziti/cmd/lets_encrypt/renew.go similarity index 97% rename from ziti/cmd/ziti/cmd/lets_encrypt/renew.go rename to ziti/cmd/lets_encrypt/renew.go index 8bff1691f..75e811e9c 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/renew.go +++ b/ziti/cmd/lets_encrypt/renew.go @@ -22,8 +22,8 @@ import ( "github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certificate" "github.com/go-acme/lego/v4/lego" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "github.com/spf13/cobra" "io" "time" diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/revoke.go b/ziti/cmd/lets_encrypt/revoke.go similarity index 96% rename from ziti/cmd/ziti/cmd/lets_encrypt/revoke.go rename to ziti/cmd/lets_encrypt/revoke.go index 23e702b92..db2ccb288 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/revoke.go +++ b/ziti/cmd/lets_encrypt/revoke.go @@ -17,10 +17,10 @@ package lets_encrypt import ( - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/root.go b/ziti/cmd/lets_encrypt/root.go similarity index 97% rename from ziti/cmd/ziti/cmd/lets_encrypt/root.go rename to ziti/cmd/lets_encrypt/root.go index 3f9512d2f..d62f4d5a1 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/root.go +++ b/ziti/cmd/lets_encrypt/root.go @@ -17,9 +17,9 @@ package lets_encrypt import ( + "github.com/openziti/ziti/ziti/util" "io" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/lets_encrypt/setup.go b/ziti/cmd/lets_encrypt/setup.go similarity index 98% rename from ziti/cmd/ziti/cmd/lets_encrypt/setup.go rename to ziti/cmd/lets_encrypt/setup.go index eeeee2c08..c52bf3d4f 100644 --- a/ziti/cmd/ziti/cmd/lets_encrypt/setup.go +++ b/ziti/cmd/lets_encrypt/setup.go @@ -20,6 +20,7 @@ import ( "crypto/x509" "encoding/pem" "fmt" + "github.com/openziti/ziti/ziti/internal/log" "io/ioutil" "os" "time" @@ -27,7 +28,6 @@ import ( "github.com/go-acme/lego/v4/challenge/http01" "github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/registration" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" ) func setup(options *leOptions, accountsStorage *AccountsStorage) (*Account, *lego.Client) { diff --git a/ziti/cmd/ziti/cmd/log_filter.go b/ziti/cmd/log_filter.go similarity index 96% rename from ziti/cmd/ziti/cmd/log_filter.go rename to ziti/cmd/log_filter.go index b99df2006..ffff98bc1 100644 --- a/ziti/cmd/ziti/cmd/log_filter.go +++ b/ziti/cmd/log_filter.go @@ -18,7 +18,7 @@ package cmd import ( "github.com/michaelquigley/pfxlog" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "io" "os" diff --git a/ziti/cmd/ziti/cmd/pki.go b/ziti/cmd/pki.go similarity index 92% rename from ziti/cmd/ziti/cmd/pki.go rename to ziti/cmd/pki.go index 10924e24a..6eec79dfd 100644 --- a/ziti/cmd/ziti/cmd/pki.go +++ b/ziti/cmd/pki.go @@ -17,13 +17,12 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/lets_encrypt" + "github.com/openziti/ziti/ziti/cmd/templates" + "github.com/openziti/ziti/ziti/pki/pki" "github.com/spf13/cobra" "io" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/lets_encrypt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - "github.com/openziti/ziti/ziti/pki/pki" ) // PKIOptions contains the command line options diff --git a/ziti/cmd/ziti/cmd/pki_create.go b/ziti/cmd/pki_create.go similarity index 99% rename from ziti/cmd/ziti/cmd/pki_create.go rename to ziti/cmd/pki_create.go index 739e03f89..4ad54c0d4 100644 --- a/ziti/cmd/ziti/cmd/pki_create.go +++ b/ziti/cmd/pki_create.go @@ -22,6 +22,8 @@ import ( "encoding/asn1" "errors" "fmt" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/util" "io" "io/ioutil" "net" @@ -31,8 +33,6 @@ import ( "github.com/spf13/cobra" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/viper" ) diff --git a/ziti/cmd/ziti/cmd/pki_create_ca.go b/ziti/cmd/pki_create_ca.go similarity index 96% rename from ziti/cmd/ziti/cmd/pki_create_ca.go rename to ziti/cmd/pki_create_ca.go index 35c14d0b8..c263ef0ba 100644 --- a/ziti/cmd/ziti/cmd/pki_create_ca.go +++ b/ziti/cmd/pki_create_ca.go @@ -17,17 +17,16 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/pki/certificate" + "github.com/openziti/ziti/ziti/pki/pki" + "github.com/openziti/ziti/ziti/pki/store" "github.com/pkg/errors" "github.com/spf13/cobra" "io" "net/url" "strings" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/pki/certificate" - "github.com/openziti/ziti/ziti/pki/pki" - "github.com/openziti/ziti/ziti/pki/store" ) // PKICreateCAOptions the options for the create spring command diff --git a/ziti/cmd/ziti/cmd/pki_create_client.go b/ziti/cmd/pki_create_client.go similarity index 97% rename from ziti/cmd/ziti/cmd/pki_create_client.go rename to ziti/cmd/pki_create_client.go index 38f785c95..8ed3c145c 100644 --- a/ziti/cmd/ziti/cmd/pki_create_client.go +++ b/ziti/cmd/pki_create_client.go @@ -17,16 +17,15 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/pki/certificate" + "github.com/openziti/ziti/ziti/pki/pki" + "github.com/openziti/ziti/ziti/pki/store" "github.com/pkg/errors" "github.com/spf13/cobra" "io" "net/url" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/pki/certificate" - "github.com/openziti/ziti/ziti/pki/pki" - "github.com/openziti/ziti/ziti/pki/store" ) // PKICreateClientOptions the options for the create spring command diff --git a/ziti/cmd/ziti/cmd/pki_create_csr.go b/ziti/cmd/pki_create_csr.go similarity index 96% rename from ziti/cmd/ziti/cmd/pki_create_csr.go rename to ziti/cmd/pki_create_csr.go index 3a7599456..e45fac863 100644 --- a/ziti/cmd/ziti/cmd/pki_create_csr.go +++ b/ziti/cmd/pki_create_csr.go @@ -18,13 +18,12 @@ package cmd import ( "fmt" - "github.com/spf13/cobra" - "io" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "github.com/openziti/ziti/ziti/pki/pki" "github.com/openziti/ziti/ziti/pki/store" + "github.com/spf13/cobra" + "io" ) // PKICreateCSROptions the options for the create spring command diff --git a/ziti/cmd/ziti/cmd/pki_create_intermediate.go b/ziti/cmd/pki_create_intermediate.go similarity index 96% rename from ziti/cmd/ziti/cmd/pki_create_intermediate.go rename to ziti/cmd/pki_create_intermediate.go index d664c5bb2..21cad1e52 100644 --- a/ziti/cmd/ziti/cmd/pki_create_intermediate.go +++ b/ziti/cmd/pki_create_intermediate.go @@ -17,15 +17,14 @@ package cmd import ( - "github.com/pkg/errors" - "github.com/spf13/cobra" - "io" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "github.com/openziti/ziti/ziti/pki/certificate" "github.com/openziti/ziti/ziti/pki/pki" "github.com/openziti/ziti/ziti/pki/store" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "io" ) // PKICreateIntermediateOptions the options for the create spring command diff --git a/ziti/cmd/ziti/cmd/pki_create_key.go b/ziti/cmd/pki_create_key.go similarity index 96% rename from ziti/cmd/ziti/cmd/pki_create_key.go rename to ziti/cmd/pki_create_key.go index 29c721f7f..07954d88a 100644 --- a/ziti/cmd/ziti/cmd/pki_create_key.go +++ b/ziti/cmd/pki_create_key.go @@ -18,14 +18,13 @@ package cmd import ( "fmt" - "github.com/spf13/cobra" - "io" - - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "github.com/openziti/ziti/ziti/pki/certificate" "github.com/openziti/ziti/ziti/pki/pki" "github.com/openziti/ziti/ziti/pki/store" + "github.com/spf13/cobra" + "io" ) // PKICreateKeyOptions the options for the create spring command diff --git a/ziti/cmd/ziti/cmd/pki_create_server.go b/ziti/cmd/pki_create_server.go similarity index 97% rename from ziti/cmd/ziti/cmd/pki_create_server.go rename to ziti/cmd/pki_create_server.go index e1b64a2f4..469248d58 100644 --- a/ziti/cmd/ziti/cmd/pki_create_server.go +++ b/ziti/cmd/pki_create_server.go @@ -17,8 +17,8 @@ package cmd import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/internal/log" "github.com/openziti/ziti/ziti/pki/certificate" "github.com/openziti/ziti/ziti/pki/pki" "github.com/openziti/ziti/ziti/pki/store" diff --git a/ziti/cmd/ziti/cmd/table/padding.go b/ziti/cmd/table/padding.go similarity index 100% rename from ziti/cmd/ziti/cmd/table/padding.go rename to ziti/cmd/table/padding.go diff --git a/ziti/cmd/ziti/cmd/table/table.go b/ziti/cmd/table/table.go similarity index 100% rename from ziti/cmd/ziti/cmd/table/table.go rename to ziti/cmd/table/table.go diff --git a/ziti/cmd/ziti/cmd/templates/command_groups.go b/ziti/cmd/templates/command_groups.go similarity index 100% rename from ziti/cmd/ziti/cmd/templates/command_groups.go rename to ziti/cmd/templates/command_groups.go diff --git a/ziti/cmd/ziti/cmd/templates/markdown.go b/ziti/cmd/templates/markdown.go similarity index 100% rename from ziti/cmd/ziti/cmd/templates/markdown.go rename to ziti/cmd/templates/markdown.go diff --git a/ziti/cmd/ziti/cmd/templates/normalizers.go b/ziti/cmd/templates/normalizers.go similarity index 100% rename from ziti/cmd/ziti/cmd/templates/normalizers.go rename to ziti/cmd/templates/normalizers.go diff --git a/ziti/cmd/ziti/cmd/templates/templater.go b/ziti/cmd/templates/templater.go similarity index 99% rename from ziti/cmd/ziti/cmd/templates/templater.go rename to ziti/cmd/templates/templater.go index ca1f76e71..deae8e1c2 100644 --- a/ziti/cmd/ziti/cmd/templates/templater.go +++ b/ziti/cmd/templates/templater.go @@ -19,7 +19,7 @@ package templates import ( "bytes" "fmt" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/table" + "github.com/openziti/ziti/ziti/cmd/table" "io" "strings" "text/template" diff --git a/ziti/cmd/ziti/cmd/templates/templates.go b/ziti/cmd/templates/templates.go similarity index 100% rename from ziti/cmd/ziti/cmd/templates/templates.go rename to ziti/cmd/templates/templates.go diff --git a/ziti/cmd/ziti/cmd/tutorial/first-service-tutorial.go b/ziti/cmd/tutorial/first-service-tutorial.go similarity index 96% rename from ziti/cmd/ziti/cmd/tutorial/first-service-tutorial.go rename to ziti/cmd/tutorial/first-service-tutorial.go index 69e2f5650..3e37f9830 100644 --- a/ziti/cmd/ziti/cmd/tutorial/first-service-tutorial.go +++ b/ziti/cmd/tutorial/first-service-tutorial.go @@ -20,9 +20,9 @@ import ( _ "embed" "github.com/openziti/runzmd" "github.com/openziti/runzmd/actionz" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/api" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "time" diff --git a/ziti/cmd/ziti/cmd/tutorial/plain_echo_client.go b/ziti/cmd/tutorial/plain_echo_client.go similarity index 100% rename from ziti/cmd/ziti/cmd/tutorial/plain_echo_client.go rename to ziti/cmd/tutorial/plain_echo_client.go diff --git a/ziti/cmd/ziti/cmd/tutorial/plain_echo_client_cmd.go b/ziti/cmd/tutorial/plain_echo_client_cmd.go similarity index 93% rename from ziti/cmd/ziti/cmd/tutorial/plain_echo_client_cmd.go rename to ziti/cmd/tutorial/plain_echo_client_cmd.go index f15cf546d..39e4a2729 100644 --- a/ziti/cmd/ziti/cmd/tutorial/plain_echo_client_cmd.go +++ b/ziti/cmd/tutorial/plain_echo_client_cmd.go @@ -17,8 +17,8 @@ package tutorial import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "strings" ) diff --git a/ziti/cmd/ziti/cmd/tutorial/plain_echo_server.go b/ziti/cmd/tutorial/plain_echo_server.go similarity index 100% rename from ziti/cmd/ziti/cmd/tutorial/plain_echo_server.go rename to ziti/cmd/tutorial/plain_echo_server.go diff --git a/ziti/cmd/ziti/cmd/tutorial/plain_echo_server_cmd.go b/ziti/cmd/tutorial/plain_echo_server_cmd.go similarity index 93% rename from ziti/cmd/ziti/cmd/tutorial/plain_echo_server_cmd.go rename to ziti/cmd/tutorial/plain_echo_server_cmd.go index 514a95fd5..e76b7788e 100644 --- a/ziti/cmd/ziti/cmd/tutorial/plain_echo_server_cmd.go +++ b/ziti/cmd/tutorial/plain_echo_server_cmd.go @@ -17,8 +17,8 @@ package tutorial import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/tutorial/root.go b/ziti/cmd/tutorial/root.go similarity index 90% rename from ziti/cmd/ziti/cmd/tutorial/root.go rename to ziti/cmd/tutorial/root.go index 190a54fa9..2a735ce8f 100644 --- a/ziti/cmd/ziti/cmd/tutorial/root.go +++ b/ziti/cmd/tutorial/root.go @@ -17,9 +17,9 @@ package tutorial import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/edge" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/edge" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/tutorial/tutorials/first-service.md b/ziti/cmd/tutorial/tutorials/first-service.md similarity index 100% rename from ziti/cmd/ziti/cmd/tutorial/tutorials/first-service.md rename to ziti/cmd/tutorial/tutorials/first-service.md diff --git a/ziti/cmd/ziti/cmd/tutorial/tutorials/more-info.md b/ziti/cmd/tutorial/tutorials/more-info.md similarity index 100% rename from ziti/cmd/ziti/cmd/tutorial/tutorials/more-info.md rename to ziti/cmd/tutorial/tutorials/more-info.md diff --git a/ziti/cmd/ziti/cmd/tutorial/ziti_echo_client.go b/ziti/cmd/tutorial/ziti_echo_client.go similarity index 100% rename from ziti/cmd/ziti/cmd/tutorial/ziti_echo_client.go rename to ziti/cmd/tutorial/ziti_echo_client.go diff --git a/ziti/cmd/ziti/cmd/tutorial/ziti_echo_client_cmd.go b/ziti/cmd/tutorial/ziti_echo_client_cmd.go similarity index 93% rename from ziti/cmd/ziti/cmd/tutorial/ziti_echo_client_cmd.go rename to ziti/cmd/tutorial/ziti_echo_client_cmd.go index 2b089680e..2a0561db8 100644 --- a/ziti/cmd/ziti/cmd/tutorial/ziti_echo_client_cmd.go +++ b/ziti/cmd/tutorial/ziti_echo_client_cmd.go @@ -17,8 +17,8 @@ package tutorial import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "strings" diff --git a/ziti/cmd/ziti/cmd/tutorial/ziti_echo_server.go b/ziti/cmd/tutorial/ziti_echo_server.go similarity index 100% rename from ziti/cmd/ziti/cmd/tutorial/ziti_echo_server.go rename to ziti/cmd/tutorial/ziti_echo_server.go diff --git a/ziti/cmd/ziti/cmd/tutorial/ziti_echo_server_cmd.go b/ziti/cmd/tutorial/ziti_echo_server_cmd.go similarity index 93% rename from ziti/cmd/ziti/cmd/tutorial/ziti_echo_server_cmd.go rename to ziti/cmd/tutorial/ziti_echo_server_cmd.go index 274803227..7e6dcd30a 100644 --- a/ziti/cmd/ziti/cmd/tutorial/ziti_echo_server_cmd.go +++ b/ziti/cmd/tutorial/ziti_echo_server_cmd.go @@ -17,8 +17,8 @@ package tutorial import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/spf13/cobra" "time" ) diff --git a/ziti/cmd/ziti/cmd/uninstall.go b/ziti/cmd/uninstall.go similarity index 94% rename from ziti/cmd/ziti/cmd/uninstall.go rename to ziti/cmd/uninstall.go index 452455e42..b3ce667ff 100644 --- a/ziti/cmd/ziti/cmd/uninstall.go +++ b/ziti/cmd/uninstall.go @@ -17,10 +17,10 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/uninstall_ziti_controller.go b/ziti/cmd/uninstall_ziti_controller.go similarity index 91% rename from ziti/cmd/ziti/cmd/uninstall_ziti_controller.go rename to ziti/cmd/uninstall_ziti_controller.go index 94f7db23a..3ddd344f3 100644 --- a/ziti/cmd/ziti/cmd/uninstall_ziti_controller.go +++ b/ziti/cmd/uninstall_ziti_controller.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/uninstall_ziti_edge_tunnel.go b/ziti/cmd/uninstall_ziti_edge_tunnel.go similarity index 91% rename from ziti/cmd/ziti/cmd/uninstall_ziti_edge_tunnel.go rename to ziti/cmd/uninstall_ziti_edge_tunnel.go index 0d9aa5423..3df0be1c4 100644 --- a/ziti/cmd/ziti/cmd/uninstall_ziti_edge_tunnel.go +++ b/ziti/cmd/uninstall_ziti_edge_tunnel.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/uninstall_ziti_proxy_c.go b/ziti/cmd/uninstall_ziti_proxy_c.go similarity index 91% rename from ziti/cmd/ziti/cmd/uninstall_ziti_proxy_c.go rename to ziti/cmd/uninstall_ziti_proxy_c.go index 98120ce79..e77ae62e4 100644 --- a/ziti/cmd/ziti/cmd/uninstall_ziti_proxy_c.go +++ b/ziti/cmd/uninstall_ziti_proxy_c.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/uninstall_ziti_router.go b/ziti/cmd/uninstall_ziti_router.go similarity index 91% rename from ziti/cmd/ziti/cmd/uninstall_ziti_router.go rename to ziti/cmd/uninstall_ziti_router.go index 9561cd97d..1e3e24ce2 100644 --- a/ziti/cmd/ziti/cmd/uninstall_ziti_router.go +++ b/ziti/cmd/uninstall_ziti_router.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/uninstall_ziti_tunnel.go b/ziti/cmd/uninstall_ziti_tunnel.go similarity index 91% rename from ziti/cmd/ziti/cmd/uninstall_ziti_tunnel.go rename to ziti/cmd/uninstall_ziti_tunnel.go index 2a87951ec..3ed6af63d 100644 --- a/ziti/cmd/ziti/cmd/uninstall_ziti_tunnel.go +++ b/ziti/cmd/uninstall_ziti_tunnel.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/unwrap_identity.go b/ziti/cmd/unwrap_identity.go similarity index 100% rename from ziti/cmd/ziti/cmd/unwrap_identity.go rename to ziti/cmd/unwrap_identity.go diff --git a/ziti/cmd/ziti/cmd/upgrade.go b/ziti/cmd/upgrade.go similarity index 94% rename from ziti/cmd/ziti/cmd/upgrade.go rename to ziti/cmd/upgrade.go index 35539fc7c..d118a825a 100644 --- a/ziti/cmd/ziti/cmd/upgrade.go +++ b/ziti/cmd/upgrade.go @@ -17,10 +17,10 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti.go b/ziti/cmd/upgrade_ziti.go similarity index 92% rename from ziti/cmd/ziti/cmd/upgrade_ziti.go rename to ziti/cmd/upgrade_ziti.go index 6ed2ddfd1..b841946b0 100644 --- a/ziti/cmd/ziti/cmd/upgrade_ziti.go +++ b/ziti/cmd/upgrade_ziti.go @@ -17,12 +17,12 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti_controller.go b/ziti/cmd/upgrade_ziti_controller.go similarity index 93% rename from ziti/cmd/ziti/cmd/upgrade_ziti_controller.go rename to ziti/cmd/upgrade_ziti_controller.go index 6465a3531..e4acce6c0 100644 --- a/ziti/cmd/ziti/cmd/upgrade_ziti_controller.go +++ b/ziti/cmd/upgrade_ziti_controller.go @@ -17,12 +17,12 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti_edge_tunnel.go b/ziti/cmd/upgrade_ziti_edge_tunnel.go similarity index 92% rename from ziti/cmd/ziti/cmd/upgrade_ziti_edge_tunnel.go rename to ziti/cmd/upgrade_ziti_edge_tunnel.go index 5001d904e..4de2689e7 100644 --- a/ziti/cmd/ziti/cmd/upgrade_ziti_edge_tunnel.go +++ b/ziti/cmd/upgrade_ziti_edge_tunnel.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti_prox_c.go b/ziti/cmd/upgrade_ziti_prox_c.go similarity index 92% rename from ziti/cmd/ziti/cmd/upgrade_ziti_prox_c.go rename to ziti/cmd/upgrade_ziti_prox_c.go index f6e542a03..a71baad45 100644 --- a/ziti/cmd/ziti/cmd/upgrade_ziti_prox_c.go +++ b/ziti/cmd/upgrade_ziti_prox_c.go @@ -17,11 +17,11 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti_router.go b/ziti/cmd/upgrade_ziti_router.go similarity index 92% rename from ziti/cmd/ziti/cmd/upgrade_ziti_router.go rename to ziti/cmd/upgrade_ziti_router.go index faee574ad..a1bf3aad6 100644 --- a/ziti/cmd/ziti/cmd/upgrade_ziti_router.go +++ b/ziti/cmd/upgrade_ziti_router.go @@ -17,12 +17,12 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/upgrade_ziti_tunnel.go b/ziti/cmd/upgrade_ziti_tunnel.go similarity index 92% rename from ziti/cmd/ziti/cmd/upgrade_ziti_tunnel.go rename to ziti/cmd/upgrade_ziti_tunnel.go index 4db8fbd76..349957bf7 100644 --- a/ziti/cmd/ziti/cmd/upgrade_ziti_tunnel.go +++ b/ziti/cmd/upgrade_ziti_tunnel.go @@ -17,12 +17,12 @@ package cmd import ( + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" "io" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/use.go b/ziti/cmd/use.go similarity index 94% rename from ziti/cmd/ziti/cmd/use.go rename to ziti/cmd/use.go index 53fd343a3..5a15854d5 100644 --- a/ziti/cmd/ziti/cmd/use.go +++ b/ziti/cmd/use.go @@ -18,14 +18,14 @@ package cmd import ( "fmt" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/util" "io" "github.com/blang/semver" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" - "github.com/openziti/ziti/ziti/cmd/ziti/util" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/cmd/version.go b/ziti/cmd/version.go similarity index 95% rename from ziti/cmd/ziti/cmd/version.go rename to ziti/cmd/version.go index dae16dadb..268e6da81 100644 --- a/ziti/cmd/ziti/cmd/version.go +++ b/ziti/cmd/version.go @@ -19,18 +19,17 @@ package cmd import ( "fmt" "github.com/blang/semver" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/table" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/table" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/util" "io" "os" // "strings" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/util" - "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/main.go b/ziti/cmd/ziti/main.go deleted file mode 100644 index 366090131..000000000 --- a/ziti/cmd/ziti/main.go +++ /dev/null @@ -1,25 +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 main - -import ( - "github.com/openziti/ziti/ziti/cmd/ziti/cmd" -) - -func main() { - cmd.Execute() -} diff --git a/ziti/cmd/ziti/constants/constants.go b/ziti/constants/constants.go similarity index 100% rename from ziti/cmd/ziti/constants/constants.go rename to ziti/constants/constants.go diff --git a/ziti-controller/subcmd/delete_sessions.go b/ziti/controller/delete_sessions.go similarity index 99% rename from ziti-controller/subcmd/delete_sessions.go rename to ziti/controller/delete_sessions.go index 8e990e501..d157f09e2 100644 --- a/ziti-controller/subcmd/delete_sessions.go +++ b/ziti/controller/delete_sessions.go @@ -14,7 +14,7 @@ limitations under the License. */ -package subcmd +package controller import ( "github.com/michaelquigley/pfxlog" diff --git a/ziti-controller/subcmd/root.go b/ziti/controller/root.go similarity index 95% rename from ziti-controller/subcmd/root.go rename to ziti/controller/root.go index cdaba127d..169dc140d 100644 --- a/ziti-controller/subcmd/root.go +++ b/ziti/controller/root.go @@ -14,15 +14,15 @@ limitations under the License. */ -package subcmd +package controller import ( "fmt" "github.com/michaelquigley/pfxlog" edgeSubCmd "github.com/openziti/edge/controller/subcmd" "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/util" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/ziti-controller/subcmd/run.go b/ziti/controller/run.go similarity index 99% rename from ziti-controller/subcmd/run.go rename to ziti/controller/run.go index 04039297a..d38812aed 100644 --- a/ziti-controller/subcmd/run.go +++ b/ziti/controller/run.go @@ -14,7 +14,7 @@ limitations under the License. */ -package subcmd +package controller import ( "fmt" diff --git a/ziti-controller/subcmd/version.go b/ziti/controller/version.go similarity index 97% rename from ziti-controller/subcmd/version.go rename to ziti/controller/version.go index a89b8e9b7..e93fd9d7d 100644 --- a/ziti-controller/subcmd/version.go +++ b/ziti/controller/version.go @@ -14,11 +14,11 @@ limitations under the License. */ -package subcmd +package controller import ( - "github.com/openziti/ziti/common/version" "fmt" + "github.com/openziti/ziti/common/version" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/internal/log/log.go b/ziti/internal/log/log.go similarity index 100% rename from ziti/cmd/ziti/internal/log/log.go rename to ziti/internal/log/log.go diff --git a/ziti/main.go b/ziti/main.go new file mode 100644 index 000000000..b49542760 --- /dev/null +++ b/ziti/main.go @@ -0,0 +1,52 @@ +/* + 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 ( + "github.com/michaelquigley/pfxlog" + "github.com/openziti/fabric/build" + "github.com/openziti/transport/v2" + "github.com/openziti/transport/v2/tcp" + "github.com/openziti/transport/v2/tls" + "github.com/openziti/transport/v2/transwarp" + "github.com/openziti/transport/v2/transwarptls" + "github.com/openziti/transport/v2/udp" + "github.com/openziti/transport/v2/ws" + "github.com/openziti/transport/v2/wss" + "github.com/openziti/ziti/common/version" + "github.com/openziti/ziti/ziti/cmd" + "github.com/sirupsen/logrus" +) + +func init() { + options := pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").NoColor() + pfxlog.GlobalInit(logrus.InfoLevel, options) + + transport.AddAddressParser(tls.AddressParser{}) + transport.AddAddressParser(tcp.AddressParser{}) + transport.AddAddressParser(transwarp.AddressParser{}) + transport.AddAddressParser(transwarptls.AddressParser{}) + transport.AddAddressParser(ws.AddressParser{}) + transport.AddAddressParser(wss.AddressParser{}) + transport.AddAddressParser(udp.AddressParser{}) + + build.InitBuildInfo(version.GetCmdBuildInfo()) +} + +func main() { + cmd.Execute() +} diff --git a/ziti/pki/pki/pki.go b/ziti/pki/pki/pki.go index 4b6143488..232daed0a 100644 --- a/ziti/pki/pki/pki.go +++ b/ziti/pki/pki/pki.go @@ -25,10 +25,10 @@ import ( "crypto/x509" "errors" "fmt" - "time" - "github.com/openziti/ziti/ziti/pki/certificate" "github.com/openziti/ziti/ziti/pki/store" + "time" + "github.com/openziti/identity/certtools" ) diff --git a/ziti/pki/store/local.go b/ziti/pki/store/local.go index 256a27834..3611ad3c3 100644 --- a/ziti/pki/store/local.go +++ b/ziti/pki/store/local.go @@ -21,6 +21,7 @@ import ( "crypto/x509/pkix" "encoding/pem" "fmt" + "github.com/openziti/ziti/ziti/pki/certificate" "io" "io/ioutil" "math/big" @@ -31,8 +32,6 @@ import ( "time" "crypto/x509" - - "github.com/openziti/ziti/ziti/pki/certificate" ) // Predifined directory names. @@ -424,16 +423,16 @@ func (l *Local) Revoked(caName string) ([]pkix.RevokedCertificate, error) { // InitCADir creates the basic structure of a CA subdirectory. // -// |- crlnumber -// |- index.txt -// |- index.txt.attr -// |- serial -// |- certs/ -// |- ca.cert -// |- name.cert -// |- keys/ -// |- ca.key -// |- name.key +// |- crlnumber +// |- index.txt +// |- index.txt.attr +// |- serial +// |- certs/ +// |- ca.cert +// |- name.cert +// |- keys/ +// |- ca.key +// |- name.key func InitCADir(path string) error { if _, err := os.Stat(path); err == nil { return nil diff --git a/ziti/pki/store/store.go b/ziti/pki/store/store.go index 9395c210c..d0aff3cfa 100644 --- a/ziti/pki/store/store.go +++ b/ziti/pki/store/store.go @@ -19,9 +19,8 @@ package store import ( "crypto/x509/pkix" - "math/big" - "github.com/openziti/ziti/ziti/pki/certificate" + "math/big" ) // Store reprents a way to store a Certificate Authority. diff --git a/ziti-router/subcmd/enrollgw.go b/ziti/router/enrollgw.go similarity index 99% rename from ziti-router/subcmd/enrollgw.go rename to ziti/router/enrollgw.go index 84b8b1a60..c35114636 100644 --- a/ziti-router/subcmd/enrollgw.go +++ b/ziti/router/enrollgw.go @@ -14,7 +14,7 @@ limitations under the License. */ -package subcmd +package router import ( "github.com/michaelquigley/pfxlog" diff --git a/ziti-router/subcmd/root.go b/ziti/router/root.go similarity index 94% rename from ziti-router/subcmd/root.go rename to ziti/router/root.go index aacb61535..36541e87d 100644 --- a/ziti-router/subcmd/root.go +++ b/ziti/router/root.go @@ -14,13 +14,13 @@ limitations under the License. */ -package subcmd +package router import ( "fmt" "github.com/michaelquigley/pfxlog" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/util" + "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/util" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/ziti-router/subcmd/run.go b/ziti/router/run.go similarity index 99% rename from ziti-router/subcmd/run.go rename to ziti/router/run.go index c9085fa07..d82fbfebb 100644 --- a/ziti-router/subcmd/run.go +++ b/ziti/router/run.go @@ -14,7 +14,7 @@ limitations under the License. */ -package subcmd +package router import ( "fmt" diff --git a/ziti-router/subcmd/version.go b/ziti/router/version.go similarity index 98% rename from ziti-router/subcmd/version.go rename to ziti/router/version.go index a89b8e9b7..54180f00c 100644 --- a/ziti-router/subcmd/version.go +++ b/ziti/router/version.go @@ -14,11 +14,11 @@ limitations under the License. */ -package subcmd +package router import ( - "github.com/openziti/ziti/common/version" "fmt" + "github.com/openziti/ziti/common/version" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/ziti/util/certs.go b/ziti/util/certs.go similarity index 98% rename from ziti/cmd/ziti/util/certs.go rename to ziti/util/certs.go index adb7df84c..c72622361 100644 --- a/ziti/cmd/ziti/util/certs.go +++ b/ziti/util/certs.go @@ -7,6 +7,7 @@ import ( "encoding/base64" "encoding/pem" "fmt" + "github.com/openziti/ziti/ziti/cmd/common" "io/ioutil" "net/http" "net/url" @@ -17,7 +18,6 @@ import ( "strings" "github.com/fullsailor/pkcs7" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" "github.com/pkg/errors" ) diff --git a/ziti/cmd/ziti/util/colors.go b/ziti/util/colors.go similarity index 100% rename from ziti/cmd/ziti/util/colors.go rename to ziti/util/colors.go diff --git a/ziti/cmd/ziti/util/commands.go b/ziti/util/commands.go similarity index 98% rename from ziti/cmd/ziti/util/commands.go rename to ziti/util/commands.go index a0aa3e733..7135774d4 100644 --- a/ziti/cmd/ziti/util/commands.go +++ b/ziti/util/commands.go @@ -18,13 +18,12 @@ package util import ( "fmt" + "github.com/openziti/ziti/ziti/internal/log" "github.com/spf13/cobra" "github.com/spf13/viper" "os" "os/exec" "strings" - - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" ) const ( diff --git a/ziti/cmd/ziti/util/dirs.go b/ziti/util/dirs.go similarity index 100% rename from ziti/cmd/ziti/util/dirs.go rename to ziti/util/dirs.go diff --git a/ziti/cmd/ziti/util/files.go b/ziti/util/files.go similarity index 100% rename from ziti/cmd/ziti/util/files.go rename to ziti/util/files.go diff --git a/ziti/cmd/ziti/util/identities.go b/ziti/util/identities.go similarity index 99% rename from ziti/cmd/ziti/util/identities.go rename to ziti/util/identities.go index 7011d54ce..f56b4ad29 100644 --- a/ziti/cmd/ziti/util/identities.go +++ b/ziti/util/identities.go @@ -10,7 +10,7 @@ import ( fabric_rest_client "github.com/openziti/fabric/rest_client" "github.com/openziti/identity" "github.com/openziti/sdk-golang/ziti/constants" - "github.com/openziti/ziti/ziti/cmd/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/common" "github.com/pkg/errors" "gopkg.in/resty.v1" "io/ioutil" diff --git a/ziti/cmd/ziti/util/pickers.go b/ziti/util/pickers.go similarity index 98% rename from ziti/cmd/ziti/util/pickers.go rename to ziti/util/pickers.go index 91cc17fb3..2099bfb05 100644 --- a/ziti/cmd/ziti/util/pickers.go +++ b/ziti/util/pickers.go @@ -18,10 +18,10 @@ package util import ( "fmt" + "github.com/openziti/ziti/ziti/internal/log" "sort" "strings" - "github.com/openziti/ziti/ziti/cmd/ziti/internal/log" "gopkg.in/AlecAivazis/survey.v1" ) diff --git a/ziti/cmd/ziti/util/rest.go b/ziti/util/rest.go similarity index 99% rename from ziti/cmd/ziti/util/rest.go rename to ziti/util/rest.go index 0665d40e2..350660fb4 100644 --- a/ziti/cmd/ziti/util/rest.go +++ b/ziti/util/rest.go @@ -31,8 +31,8 @@ import ( "github.com/openziti/edge/rest_model" fabric_rest_client "github.com/openziti/fabric/rest_client" "github.com/openziti/ziti/common/version" - cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers" - c "github.com/openziti/ziti/ziti/cmd/ziti/constants" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + c "github.com/openziti/ziti/ziti/constants" "github.com/pkg/errors" "gopkg.in/resty.v1" "io" diff --git a/ziti/cmd/ziti/util/session.go b/ziti/util/session.go similarity index 100% rename from ziti/cmd/ziti/util/session.go rename to ziti/util/session.go diff --git a/ziti/cmd/ziti/util/strings.go b/ziti/util/strings.go similarity index 100% rename from ziti/cmd/ziti/util/strings.go rename to ziti/util/strings.go diff --git a/ziti/cmd/ziti/util/suggestions.go b/ziti/util/suggestions.go similarity index 100% rename from ziti/cmd/ziti/util/suggestions.go rename to ziti/util/suggestions.go diff --git a/ziti/cmd/ziti/util/updates.go b/ziti/util/updates.go similarity index 98% rename from ziti/cmd/ziti/util/updates.go rename to ziti/util/updates.go index f8ab1fe80..7df9ca388 100644 --- a/ziti/cmd/ziti/util/updates.go +++ b/ziti/util/updates.go @@ -18,6 +18,7 @@ package util import ( "fmt" + "github.com/openziti/ziti/ziti/constants" "os" "github.com/fatih/color" @@ -25,7 +26,6 @@ import ( "github.com/blang/semver" "github.com/michaelquigley/pfxlog" "github.com/openziti/ziti/common/version" - "github.com/openziti/ziti/ziti/cmd/ziti/constants" ) func LogReleaseVersionCheck(ziti_component string) { From 3becfa8fd0ac72d47bca97c4b6ee1a2b5418b083 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 11:05:04 -0500 Subject: [PATCH 06/46] Allow controller and router to be run from ziti --- CHANGELOG.md | 3 + ziti/cmd/cmd.go | 8 ++- ziti/cmd/execute.go | 82 --------------------- ziti/cmd/execute_controller.go | 112 ----------------------------- ziti/controller/delete_sessions.go | 16 ++--- ziti/controller/root.go | 62 ++++++++-------- ziti/controller/run.go | 16 ++--- ziti/controller/version.go | 18 +++-- ziti/router/enrollgw.go | 17 ++--- ziti/router/root.go | 60 +++++++++------- ziti/router/run.go | 17 +++-- ziti/router/version.go | 18 +++-- 12 files changed, 123 insertions(+), 306 deletions(-) delete mode 100644 ziti/cmd/execute.go delete mode 100644 ziti/cmd/execute_controller.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 7112ac11f..9a41247ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * The adhoc, ping and playbook commands have been removed. These were ansible and vagrant commands that were not widely used. * Make the art command hidden, doesn't need to be removed, leave it as an easter egg * Move ziti ps command under ziti agent. Remove all ziti ps subcommands, as they already exist as ziti agent subcommands +* Add `ziti controller` and `ziti router` commands + * They should work exactly the same as `ziti-controller` and `ziti router` + * The standalone binaries for `ziti-controller` and `ziti-router` are deprecated and will be removed in a future release # Release 0.26.11 diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 53edfd8c3..774f5d836 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -28,7 +28,9 @@ import ( "github.com/openziti/ziti/ziti/cmd/templates" "github.com/openziti/ziti/ziti/cmd/tutorial" c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/controller" "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/router" "github.com/openziti/ziti/ziti/util" "io" "os" @@ -121,7 +123,8 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com initCommands := NewCmdInit(out, err) createCommands := NewCmdCreate(out, err) - executeCommands := NewCmdExecute(out, err) + controllerCmd := controller.NewRunCmd() + routerCmd := router.NewRunCmd() agentCommands := agentcli.NewAgentCmd(p) pkiCommands := NewCmdPKI(out, err) fabricCommand := fabric.NewFabricCmd(p) @@ -153,8 +156,9 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com { Message: "Executing Ziti components:", Commands: []*cobra.Command{ - executeCommands, agentCommands, + controllerCmd, + routerCmd, pkiCommands, unwrapIdentityFileCommand, }, diff --git a/ziti/cmd/execute.go b/ziti/cmd/execute.go deleted file mode 100644 index c52b3f066..000000000 --- a/ziti/cmd/execute.go +++ /dev/null @@ -1,82 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - "io" - - "github.com/spf13/cobra" -) - -// ExecuteOptions contains the command line options -type ExecuteOptions struct { - CommonOptions - - Flags ExecuteFlags - - DisableImport bool - OutDir string -} - -type ExecuteFlags struct { - Identity string -} - -var ( - executeLong = templates.LongDesc(` - Executes a component. - `) -) - -// NewCmdExecute Executes a command object for the "Execute" command -func NewCmdExecute(out io.Writer, errOut io.Writer) *cobra.Command { - options := &ExecuteOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "run", - Short: "Execute a Ziti component/app", - Long: executeLong, - Aliases: []string{}, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - - cmd.AddCommand(NewCmdExecuteController(out, errOut)) - - options.addExecuteFlags(cmd) - return cmd -} - -func (options *ExecuteOptions) addExecuteFlags(cmd *cobra.Command) { - cmd.Flags().StringVarP(&options.Flags.Identity, "identity", "", "", "Which identity to use.") -} - -// Run implements this command -func (o *ExecuteOptions) Run() error { - return o.Cmd.Help() -} diff --git a/ziti/cmd/execute_controller.go b/ziti/cmd/execute_controller.go deleted file mode 100644 index 3373bbd9a..000000000 --- a/ziti/cmd/execute_controller.go +++ /dev/null @@ -1,112 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/util" - "io" - "path/filepath" - - "github.com/spf13/cobra" - - "github.com/spf13/viper" -) - -var ( - executeControllerLong = templates.LongDesc(` - Executes the ziti-controller component - `) - - executeControllerExample = templates.Examples(` - # Execute the ziti-controller component - ziti execute ziti-controller - - `) -) - -// ExecuteControllerOptions the options for the create spring command -type ExecuteControllerOptions struct { - ExecuteOptions - - CtrlListener string -} - -// NewCmdExecuteController creates a command object for the "create" command -func NewCmdExecuteController(out io.Writer, errOut io.Writer) *cobra.Command { - options := &ExecuteControllerOptions{ - ExecuteOptions: ExecuteOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "controller", - Short: "'Execute the ziti-controller component'", - Aliases: []string{"c", "ctrl"}, - Long: executeControllerLong, - Example: executeControllerExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - - cmd.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", false, "Enable CLI Agent (use in dev only)") - - options.AddCommonFlags(cmd) - - return cmd -} - -// Run implements the command -func (o *ExecuteControllerOptions) Run() error { - - viper := viper.New() - viper.SetConfigType("json") - viper.SetConfigName(c.CONFIGFILENAME) - zitiConfigDir, err := util.ZitiAppConfigDir(c.ZITI) - if err != nil { - return err - } - viper.AddConfigPath(zitiConfigDir) - err = viper.ReadInConfig() - if err != nil { - return err - } - - zitiControllerConfigDir, err := util.ZitiAppConfigDir(c.ZITI_CONTROLLER) - if err != nil { - return err - } - - zitiControllerConfigFileName := filepath.Join(zitiControllerConfigDir, c.CONFIGFILENAME) + ".yml" - - err = o.startCommandFromDir(viper.GetString("bin"), c.ZITI_CONTROLLER, "run", zitiControllerConfigFileName) - if err != nil { - return err - } - - return nil -} diff --git a/ziti/controller/delete_sessions.go b/ziti/controller/delete_sessions.go index d157f09e2..2b8b30d64 100644 --- a/ziti/controller/delete_sessions.go +++ b/ziti/controller/delete_sessions.go @@ -26,15 +26,13 @@ import ( "go.etcd.io/bbolt" ) -func init() { - root.AddCommand(deleteSessionsCmd) -} - -var deleteSessionsCmd = &cobra.Command{ - Use: "delete-sessions ", - Short: "Delete all API Sessions and Edge Sessions, controller must be shutdown", - Args: cobra.ExactArgs(1), - Run: deleteSessions, +func NewDeleteSessionsCmd() *cobra.Command { + return &cobra.Command{ + Use: "delete-sessions ", + Short: "Delete all API Sessions and Edge Sessions, controller must be shutdown", + Args: cobra.ExactArgs(1), + Run: deleteSessions, + } } const ( diff --git a/ziti/controller/root.go b/ziti/controller/root.go index 169dc140d..13396951b 100644 --- a/ziti/controller/root.go +++ b/ziti/controller/root.go @@ -27,37 +27,43 @@ import ( "github.com/spf13/cobra" ) -func init() { - root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") - root.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", true, "Enable/disabled CLI Agent (enabled by default)") - root.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)") - root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]") - root.PersistentFlags().BoolVar(&syncRaftToDb, "sync-raft-to-db", false, "Sync the current database state to raft as a snapshot. Use when moving an existing controller to run in HA/Raft") +func NewControllerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "ziti-controller", + Short: "Ziti Fabric Controller", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + if verbose { + logrus.SetLevel(logrus.DebugLevel) + } - edgeSubCmd.AddCommands(root, version.GetCmdBuildInfo()) -} + switch logFormatter { + case "pfxlog": + pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday())) + case "json": + pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}) + case "text": + pfxlog.SetFormatter(&logrus.TextFormatter{}) + default: + // let logrus do its own thing + } + util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER) -var root = &cobra.Command{ - Use: "ziti-controller", - Short: "Ziti Fabric Controller", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - if verbose { - logrus.SetLevel(logrus.DebugLevel) - } + }, + } - switch logFormatter { - case "pfxlog": - pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday())) - case "json": - pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}) - case "text": - pfxlog.SetFormatter(&logrus.TextFormatter{}) - default: - // let logrus do its own thing - } - util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER) + cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") + cmd.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", true, "Enable/disabled CLI Agent (enabled by default)") + cmd.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)") + cmd.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]") + cmd.PersistentFlags().BoolVar(&syncRaftToDb, "sync-raft-to-db", false, "Sync the current database state to raft as a snapshot. Use when moving an existing controller to run in HA/Raft") - }, + cmd.AddCommand(NewRunCmd()) + cmd.AddCommand(NewDeleteSessionsCmd()) + cmd.AddCommand(NewVersionCmd()) + + edgeSubCmd.AddCommands(cmd, version.GetCmdBuildInfo()) + + return cmd } var verbose bool @@ -67,7 +73,7 @@ var logFormatter string var syncRaftToDb bool func Execute() { - if err := root.Execute(); err != nil { + if err := NewControllerCmd().Execute(); err != nil { fmt.Printf("error: %s\n", err) } } diff --git a/ziti/controller/run.go b/ziti/controller/run.go index d38812aed..a0292969e 100644 --- a/ziti/controller/run.go +++ b/ziti/controller/run.go @@ -32,15 +32,13 @@ import ( "github.com/spf13/cobra" ) -func init() { - root.AddCommand(runCmd) -} - -var runCmd = &cobra.Command{ - Use: "run ", - Short: "Run controller configuration", - Args: cobra.ExactArgs(1), - Run: run, +func NewRunCmd() *cobra.Command { + return &cobra.Command{ + Use: "run ", + Short: "Run controller configuration", + Args: cobra.ExactArgs(1), + Run: run, + } } func run(cmd *cobra.Command, args []string) { diff --git a/ziti/controller/version.go b/ziti/controller/version.go index e93fd9d7d..99128008e 100644 --- a/ziti/controller/version.go +++ b/ziti/controller/version.go @@ -22,14 +22,12 @@ import ( "github.com/spf13/cobra" ) -func init() { - root.AddCommand(versionCmd) -} - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Show component version", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println(version.GetBuildMetadata(verbose)) - }, +func NewVersionCmd() *cobra.Command { + return &cobra.Command{ + Use: "version", + Short: "Show component version", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(version.GetBuildMetadata(verbose)) + }, + } } diff --git a/ziti/router/enrollgw.go b/ziti/router/enrollgw.go index c35114636..58b39b062 100644 --- a/ziti/router/enrollgw.go +++ b/ziti/router/enrollgw.go @@ -29,19 +29,20 @@ var jwtPath *string var engine *string var keyAlg config.KeyAlgVar -func init() { +func NewEnrollGwCmd() *cobra.Command { + var enrollEdgeRouterCmd = &cobra.Command{ + Use: "enroll ", + Short: "Enroll a router as an edge router", + Args: cobra.ExactArgs(1), + Run: enrollGw, + } + 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 enrollEdgeRouterCmd.Flags().VarP(&keyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key") - root.AddCommand(enrollEdgeRouterCmd) -} -var enrollEdgeRouterCmd = &cobra.Command{ - Use: "enroll ", - Short: "Enroll a router as an edge router", - Args: cobra.ExactArgs(1), - Run: enrollGw, + return enrollEdgeRouterCmd } func enrollGw(cmd *cobra.Command, args []string) { diff --git a/ziti/router/root.go b/ziti/router/root.go index 36541e87d..43cf57712 100644 --- a/ziti/router/root.go +++ b/ziti/router/root.go @@ -25,35 +25,41 @@ import ( "github.com/spf13/cobra" ) -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().BoolVar(&cliAgentEnabled, "cli-agent", true, "Enable/disable CLI Agent (enabled by default)") - root.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)") - root.PersistentFlags().BoolVar(&enableDebugOps, "debug-ops", false, "Enable/disable debug agent operations (disabled by default)") -} +func NewRouterCmd() *cobra.Command { + var routerCmd = &cobra.Command{ + Use: "ziti-router", + Short: "Ziti Fabric Router", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + if verbose { + logrus.SetLevel(logrus.DebugLevel) + } -var root = &cobra.Command{ - Use: "ziti-router", - Short: "Ziti Fabric Router", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - if verbose { - logrus.SetLevel(logrus.DebugLevel) - } + switch logFormatter { + case "pfxlog": + pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday())) + case "json": + pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}) + case "text": + pfxlog.SetFormatter(&logrus.TextFormatter{}) + default: + // let logrus do its own thing + } + util.LogReleaseVersionCheck(constants.ZITI_ROUTER) - switch logFormatter { - case "pfxlog": - pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday())) - case "json": - pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}) - case "text": - pfxlog.SetFormatter(&logrus.TextFormatter{}) - default: - // let logrus do its own thing - } - util.LogReleaseVersionCheck(constants.ZITI_ROUTER) + }, + } - }, + routerCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") + routerCmd.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]") + routerCmd.PersistentFlags().BoolVar(&cliAgentEnabled, "cli-agent", true, "Enable/disable CLI Agent (enabled by default)") + routerCmd.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)") + routerCmd.PersistentFlags().BoolVar(&enableDebugOps, "debug-ops", false, "Enable/disable debug agent operations (disabled by default)") + + routerCmd.AddCommand(NewRunCmd()) + routerCmd.AddCommand(NewEnrollGwCmd()) + routerCmd.AddCommand(NewVersionCmd()) + + return routerCmd } var verbose bool @@ -63,7 +69,7 @@ var enableDebugOps bool var cliAgentAddr string func Execute() { - if err := root.Execute(); err != nil { + if err := NewRouterCmd().Execute(); err != nil { fmt.Printf("error: %s\n", err) } } diff --git a/ziti/router/run.go b/ziti/router/run.go index d82fbfebb..9bab59655 100644 --- a/ziti/router/run.go +++ b/ziti/router/run.go @@ -39,19 +39,18 @@ import ( "syscall" ) -var forceEnrollmentExtension *bool +func NewRunCmd() *cobra.Command { + var runCmd = &cobra.Command{ + Use: "run ", + Short: "Run router configuration", + Args: cobra.ExactArgs(1), + Run: run, + } -func init() { //flags are added to an internal map and read later on, see getFlags() runCmd.Flags().BoolP("extend", "e", false, "force the router on startup to extend enrollment certificates") - root.AddCommand(runCmd) -} -var runCmd = &cobra.Command{ - Use: "run ", - Short: "Run router configuration", - Args: cobra.ExactArgs(1), - Run: run, + return runCmd } func run(cmd *cobra.Command, args []string) { diff --git a/ziti/router/version.go b/ziti/router/version.go index 54180f00c..8dad7e7e1 100644 --- a/ziti/router/version.go +++ b/ziti/router/version.go @@ -22,14 +22,12 @@ import ( "github.com/spf13/cobra" ) -func init() { - root.AddCommand(versionCmd) -} - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Show component version", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println(version.GetBuildMetadata(verbose)) - }, +func NewVersionCmd() *cobra.Command { + return &cobra.Command{ + Use: "version", + Short: "Show component version", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(version.GetBuildMetadata(verbose)) + }, + } } From ea3940bbfe23f2ef72e7c3c744bce789a09b59d6 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 11:26:51 -0500 Subject: [PATCH 07/46] Add `ziti tunnel` command --- CHANGELOG.md | 4 +++ ziti-tunnel/cmd/ziti-tunnel/main.go | 4 +-- ziti/cmd/cmd.go | 3 +++ .../subcmd => ziti/tunnel}/host.go | 25 +++++++++-------- .../subcmd => ziti/tunnel}/proxy.go | 25 +++++++++-------- .../subcmd => ziti/tunnel}/root.go | 27 ++++++++++++------- .../ziti-tunnel/subcmd => ziti/tunnel}/run.go | 23 ++++++++-------- .../subcmd => ziti/tunnel}/tproxy.go | 22 +++++++-------- .../subcmd => ziti/tunnel}/version.go | 22 +++++++-------- 9 files changed, 82 insertions(+), 73 deletions(-) rename {ziti-tunnel/cmd/ziti-tunnel/subcmd => ziti/tunnel}/host.go (70%) rename {ziti-tunnel/cmd/ziti-tunnel/subcmd => ziti/tunnel}/proxy.go (73%) rename {ziti-tunnel/cmd/ziti-tunnel/subcmd => ziti/tunnel}/root.go (92%) rename {ziti-tunnel/cmd/ziti-tunnel/subcmd => ziti/tunnel}/run.go (78%) rename {ziti-tunnel/cmd/ziti-tunnel/subcmd => ziti/tunnel}/tproxy.go (76%) rename {ziti-tunnel/cmd/ziti-tunnel/subcmd => ziti/tunnel}/version.go (73%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a41247ba..315c83f40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ * Add `ziti controller` and `ziti router` commands * They should work exactly the same as `ziti-controller` and `ziti router` * The standalone binaries for `ziti-controller` and `ziti-router` are deprecated and will be removed in a future release +* Add hidden `ziti tunnel` command + * Should work exactly the same as `ziti-tunnel` + * Is hidden as `ziti-edge-tunnel` is the preferred tunnelling application + * The standalone binary `ziti-tunnel` is deprecated and will be removed in a future release # Release 0.26.11 diff --git a/ziti-tunnel/cmd/ziti-tunnel/main.go b/ziti-tunnel/cmd/ziti-tunnel/main.go index f70c3f392..9b8d8c7de 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/main.go +++ b/ziti-tunnel/cmd/ziti-tunnel/main.go @@ -19,7 +19,7 @@ package main import ( "github.com/michaelquigley/pfxlog" "github.com/openziti/foundation/v2/debugz" - "github.com/openziti/ziti/ziti-tunnel/cmd/ziti-tunnel/subcmd" + "github.com/openziti/ziti/ziti/tunnel" "github.com/sirupsen/logrus" ) @@ -29,5 +29,5 @@ func init() { func main() { debugz.AddStackDumpHandler() - subcmd.Execute() + tunnel.Execute() } diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 774f5d836..e4166eace 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -31,6 +31,7 @@ import ( "github.com/openziti/ziti/ziti/controller" "github.com/openziti/ziti/ziti/internal/log" "github.com/openziti/ziti/ziti/router" + "github.com/openziti/ziti/ziti/tunnel" "github.com/openziti/ziti/ziti/util" "io" "os" @@ -124,6 +125,7 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com initCommands := NewCmdInit(out, err) createCommands := NewCmdCreate(out, err) controllerCmd := controller.NewRunCmd() + tunnelCmd := tunnel.NewTunnelCmd() routerCmd := router.NewRunCmd() agentCommands := agentcli.NewAgentCmd(p) pkiCommands := NewCmdPKI(out, err) @@ -159,6 +161,7 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com agentCommands, controllerCmd, routerCmd, + tunnelCmd, pkiCommands, unwrapIdentityFileCommand, }, diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/host.go b/ziti/tunnel/host.go similarity index 70% rename from ziti-tunnel/cmd/ziti-tunnel/subcmd/host.go rename to ziti/tunnel/host.go index dea77cf03..9adf17130 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/host.go +++ b/ziti/tunnel/host.go @@ -14,27 +14,26 @@ limitations under the License. */ -package subcmd +package tunnel import ( "github.com/openziti/edge/tunnel/intercept/host" "github.com/spf13/cobra" ) -var runHostCmd = &cobra.Command{ - Use: "host", - Short: "Run in 'host' mode", - Long: "The 'host' mode will only host services", - Args: cobra.ExactArgs(0), - RunE: runHost, - PostRun: rootPostRun, +func NewHostCmd() *cobra.Command { + return &cobra.Command{ + Use: "host", + Short: "Run in 'host' mode", + Long: "The 'host' mode will only host services", + Args: cobra.ExactArgs(0), + RunE: runHost, + PostRun: rootPostRun, + } } -func init() { - root.AddCommand(runHostCmd) -} - -func runHost(_ *cobra.Command, args []string) error { +func runHost(cmd *cobra.Command, args []string) error { + root := cmd.Root() if !root.Flag(resolverCfgFlag).Changed { _ = root.PersistentFlags().Set(resolverCfgFlag, "") } diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/proxy.go b/ziti/tunnel/proxy.go similarity index 73% rename from ziti-tunnel/cmd/ziti-tunnel/subcmd/proxy.go rename to ziti/tunnel/proxy.go index f2f465c7d..33eb8a6ea 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/proxy.go +++ b/ziti/tunnel/proxy.go @@ -14,7 +14,7 @@ limitations under the License. */ -package subcmd +package tunnel import ( "github.com/openziti/edge/tunnel/intercept/proxy" @@ -25,20 +25,19 @@ import ( "strconv" ) -var runProxyCmd = &cobra.Command{ - Use: "proxy [sevice-name:port]", - Short: "Run in 'proxy' mode", - Long: "The 'proxy' intercept mode creates a network listener for each service that is intercepted.", - Args: cobra.MinimumNArgs(1), - RunE: runProxy, - PostRun: rootPostRun, +func NewProxyCmd() *cobra.Command { + return &cobra.Command{ + Use: "proxy [sevice-name:port]", + Short: "Run in 'proxy' mode", + Long: "The 'proxy' intercept mode creates a network listener for each service that is intercepted.", + Args: cobra.MinimumNArgs(1), + RunE: runProxy, + PostRun: rootPostRun, + } } -func init() { - root.AddCommand(runProxyCmd) -} - -func runProxy(_ *cobra.Command, args []string) error { +func runProxy(cmd *cobra.Command, args []string) error { + root := cmd.Root() // Fiddle with the poll rate and resolver settings if the user didn't wan't anything special. if !root.Flag(svcPollRateFlag).Changed { _ = root.PersistentFlags().Set(svcPollRateFlag, strconv.FormatUint(math.MaxUint32, 10)) diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go b/ziti/tunnel/root.go similarity index 92% rename from ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go rename to ziti/tunnel/root.go index f3c737526..0bef0a567 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/root.go +++ b/ziti/tunnel/root.go @@ -14,13 +14,12 @@ limitations under the License. */ -package subcmd +package tunnel import ( "github.com/openziti/ziti/ziti/cmd/common" "github.com/openziti/ziti/ziti/constants" "github.com/openziti/ziti/ziti/util" - "io/ioutil" "os" "path/filepath" "time" @@ -45,7 +44,14 @@ const ( dnsSvcIpRangeFlag = "dnsSvcIpRange" ) -func init() { +func NewTunnelCmd() *cobra.Command { + var root = &cobra.Command{ + Use: filepath.Base(os.Args[0]), + Short: "Ziti Tunnel", + PersistentPreRun: rootPreRun, + Hidden: true, + } + root.PersistentFlags().BoolP("verbose", "v", false, "Enable verbose mode") root.PersistentFlags().StringP("identity", "i", "", "Path to JSON file that contains an enrolled identity") root.PersistentFlags().String("identity-dir", "", "Path to directory file that contains one or more enrolled identities") @@ -58,12 +64,13 @@ func init() { p := common.NewOptionsProvider(os.Stdout, os.Stderr) root.AddCommand(enrollment.NewEnrollCommand(p)) -} + root.AddCommand(NewHostCmd()) + root.AddCommand(NewProxyCmd()) + root.AddCommand(NewRunCmd()) + root.AddCommand(NewTProxyCmd()) + root.AddCommand(NewVersionCmd()) -var root = &cobra.Command{ - Use: filepath.Base(os.Args[0]), - Short: "Ziti Tunnel", - PersistentPreRun: rootPreRun, + return root } var interceptor intercept.Interceptor @@ -72,7 +79,7 @@ var cliAgentEnabled bool var cliAgentAddr string func Execute() { - if err := root.Execute(); err != nil { + if err := NewTunnelCmd().Execute(); err != nil { pfxlog.Logger().Errorf("error: %s", err) os.Exit(1) } @@ -125,7 +132,7 @@ func rootPostRun(cmd *cobra.Command, _ []string) { } if idDir := cmd.Flag("identity-dir").Value.String(); idDir != "" { - files, err := ioutil.ReadDir(idDir) + files, err := os.ReadDir(idDir) if err != nil { log.Fatalf("failed to scan directory %s: %v", idDir, err) } diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/run.go b/ziti/tunnel/run.go similarity index 78% rename from ziti-tunnel/cmd/ziti-tunnel/subcmd/run.go rename to ziti/tunnel/run.go index cc833ec10..d776936b1 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/run.go +++ b/ziti/tunnel/run.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux /* @@ -16,7 +17,7 @@ limitations under the License. */ -package subcmd +package tunnel import ( "github.com/michaelquigley/pfxlog" @@ -25,17 +26,15 @@ import ( "github.com/spf13/cobra" ) -var runCmd = &cobra.Command{ - Use: "run ", - Short: "Auto-select interceptor", - Long: "Provided for backwards compatibility with scripts that were coded around older ziti-tunnel versions.", - Args: cobra.MaximumNArgs(1), - Run: run, - PostRun: rootPostRun, -} - -func init() { - root.AddCommand(runCmd) +func NewRunCmd() *cobra.Command { + return &cobra.Command{ + Use: "run ", + Short: "Auto-select interceptor", + Long: "Provided for backwards compatibility with scripts that were coded around older ziti-tunnel versions.", + Args: cobra.MaximumNArgs(1), + Run: run, + PostRun: rootPostRun, + } } func run(cmd *cobra.Command, args []string) { diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/tproxy.go b/ziti/tunnel/tproxy.go similarity index 76% rename from ziti-tunnel/cmd/ziti-tunnel/subcmd/tproxy.go rename to ziti/tunnel/tproxy.go index 36e4a5f58..2b58102d7 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/tproxy.go +++ b/ziti/tunnel/tproxy.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux /* @@ -16,7 +17,7 @@ limitations under the License. */ -package subcmd +package tunnel import ( "fmt" @@ -24,17 +25,16 @@ import ( "github.com/spf13/cobra" ) -var runTProxyCmd = &cobra.Command{ - Use: "tproxy", - Short: "Use the 'tproxy' interceptor", - Long: "The 'tproxy' interceptor captures packets by using the TPROXY iptables target.", - RunE: runTProxy, - PostRun: rootPostRun, -} - -func init() { +func NewTProxyCmd() *cobra.Command { + var runTProxyCmd = &cobra.Command{ + Use: "tproxy", + Short: "Use the 'tproxy' interceptor", + Long: "The 'tproxy' interceptor captures packets by using the TPROXY iptables target.", + RunE: runTProxy, + PostRun: rootPostRun, + } runTProxyCmd.PersistentFlags().String("lanIf", "", "if specified, INPUT rules for intercepted service addresses are assigned to this interface ") - root.AddCommand(runTProxyCmd) + return runTProxyCmd } func runTProxy(cmd *cobra.Command, args []string) error { diff --git a/ziti-tunnel/cmd/ziti-tunnel/subcmd/version.go b/ziti/tunnel/version.go similarity index 73% rename from ziti-tunnel/cmd/ziti-tunnel/subcmd/version.go rename to ziti/tunnel/version.go index b490914ee..947ac932a 100644 --- a/ziti-tunnel/cmd/ziti-tunnel/subcmd/version.go +++ b/ziti/tunnel/version.go @@ -14,22 +14,20 @@ limitations under the License. */ -package subcmd +package tunnel import ( - "github.com/openziti/ziti/common/version" "fmt" + "github.com/openziti/ziti/common/version" "github.com/spf13/cobra" ) -func init() { - root.AddCommand(versionCmd) -} - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Show component version", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println(version.GetVersion()) - }, +func NewVersionCmd() *cobra.Command { + return &cobra.Command{ + Use: "version", + Short: "Show component version", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(version.GetVersion()) + }, + } } From ccad024523843a7f3856e93c3e9e6876df16fc35 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 11:32:45 -0500 Subject: [PATCH 08/46] Remove most of install/upgrade/uninstall commands as well as use and version --- ziti/cmd/cmd.go | 4 - ziti/cmd/create.go | 1 - ziti/cmd/create_environment.go | 83 -------- ziti/cmd/install.go | 10 - ziti/cmd/install_ziti_ALL.go | 122 ------------ ziti/cmd/install_ziti_controller.go | 92 --------- ziti/cmd/install_ziti_edge_tunnel.go | 97 ---------- ziti/cmd/install_ziti_prox_c.go | 97 ---------- ziti/cmd/install_ziti_router.go | 92 --------- ziti/cmd/install_ziti_tunnel.go | 92 --------- ziti/cmd/uninstall.go | 79 -------- ziti/cmd/uninstall_ziti_controller.go | 77 -------- ziti/cmd/uninstall_ziti_edge_tunnel.go | 77 -------- ziti/cmd/uninstall_ziti_proxy_c.go | 77 -------- ziti/cmd/uninstall_ziti_router.go | 77 -------- ziti/cmd/uninstall_ziti_tunnel.go | 77 -------- ziti/cmd/upgrade.go | 80 -------- ziti/cmd/upgrade_ziti.go | 90 --------- ziti/cmd/upgrade_ziti_controller.go | 90 --------- ziti/cmd/upgrade_ziti_edge_tunnel.go | 89 --------- ziti/cmd/upgrade_ziti_prox_c.go | 89 --------- ziti/cmd/upgrade_ziti_router.go | 90 --------- ziti/cmd/upgrade_ziti_tunnel.go | 90 --------- ziti/cmd/use.go | 153 --------------- ziti/cmd/version.go | 250 ------------------------- 25 files changed, 2175 deletions(-) delete mode 100644 ziti/cmd/create_environment.go delete mode 100644 ziti/cmd/install_ziti_ALL.go delete mode 100644 ziti/cmd/install_ziti_controller.go delete mode 100644 ziti/cmd/install_ziti_edge_tunnel.go delete mode 100644 ziti/cmd/install_ziti_prox_c.go delete mode 100644 ziti/cmd/install_ziti_router.go delete mode 100644 ziti/cmd/install_ziti_tunnel.go delete mode 100644 ziti/cmd/uninstall.go delete mode 100644 ziti/cmd/uninstall_ziti_controller.go delete mode 100644 ziti/cmd/uninstall_ziti_edge_tunnel.go delete mode 100644 ziti/cmd/uninstall_ziti_proxy_c.go delete mode 100644 ziti/cmd/uninstall_ziti_router.go delete mode 100644 ziti/cmd/uninstall_ziti_tunnel.go delete mode 100644 ziti/cmd/upgrade.go delete mode 100644 ziti/cmd/upgrade_ziti.go delete mode 100644 ziti/cmd/upgrade_ziti_controller.go delete mode 100644 ziti/cmd/upgrade_ziti_edge_tunnel.go delete mode 100644 ziti/cmd/upgrade_ziti_prox_c.go delete mode 100644 ziti/cmd/upgrade_ziti_router.go delete mode 100644 ziti/cmd/upgrade_ziti_tunnel.go delete mode 100644 ziti/cmd/use.go delete mode 100644 ziti/cmd/version.go diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index e4166eace..99a457269 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -139,8 +139,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com installCommands := []*cobra.Command{ NewCmdInstall(out, err), - NewCmdUnInstall(out, err), - NewCmdUpgrade(out, err), } groups := templates.CommandGroups{ @@ -191,11 +189,9 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com groups.Add(cmd) - cmd.AddCommand(NewCmdVersion(out, err)) cmd.Version = version.GetVersion() cmd.SetVersionTemplate("{{printf .Version}}\n") cmd.AddCommand(NewCmdArt(out, err)) - cmd.AddCommand(NewCmdUse(out, err)) return cmd } diff --git a/ziti/cmd/create.go b/ziti/cmd/create.go index 03e786054..3fde148bd 100644 --- a/ziti/cmd/create.go +++ b/ziti/cmd/create.go @@ -42,7 +42,6 @@ func NewCmdCreate(out io.Writer, errOut io.Writer) *cobra.Command { } cmd.AddCommand(NewCmdCreateConfig()) - cmd.AddCommand(NewCmdCreateEnvironment(out, errOut)) cmd.AddCommand(NewCmdPKICreateCA(out, errOut)) cmd.AddCommand(NewCmdPKICreateIntermediate(out, errOut)) diff --git a/ziti/cmd/create_environment.go b/ziti/cmd/create_environment.go deleted file mode 100644 index 37e35a481..000000000 --- a/ziti/cmd/create_environment.go +++ /dev/null @@ -1,83 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/internal/log" - "github.com/openziti/ziti/ziti/util" - "io" - - "github.com/spf13/cobra" -) - -// CreateEnvironmentOptions the options for the create spring command -type CreateEnvironmentOptions struct { - CommonOptions - - EnvName string -} - -// NewCmdCreateEnvironment creates a command object for the "create" command -func NewCmdCreateEnvironment(out io.Writer, errOut io.Writer) *cobra.Command { - options := &CreateEnvironmentOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "environment", - Short: "Creates a 'deployment environment' directory, and seed files", - Aliases: []string{"env"}, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - - options.addFlags(cmd, "", "") - return cmd -} - -// Add flags that are global to all "create config" commands -func (o *CreateEnvironmentOptions) addFlags(cmd *cobra.Command, defaultNamespace string, defaultOptionRelease string) { - cmd.Flags().StringVarP(&o.EnvName, "name", "", "", "Name of new 'environment'") - cmd.MarkFlagRequired("name") -} - -// Run implements this command -func (o *CreateEnvironmentOptions) Run() error { - deps := make([]string, 0) - deps = append(deps, "ansible") - err := o.installMissingDependencies(deps) - if err != nil { - return err - } - - envDir, err := util.NewEnvironmentDir(o.EnvName) - if err != nil { - return err - } - - log.Infoln(envDir + " successfully created") - - return nil -} diff --git a/ziti/cmd/install.go b/ziti/cmd/install.go index 753ae3e85..a098b1109 100644 --- a/ziti/cmd/install.go +++ b/ziti/cmd/install.go @@ -64,16 +64,6 @@ func NewCmdInstall(out io.Writer, errOut io.Writer) *cobra.Command { SuggestFor: []string{"up"}, } - cmd.AddCommand(NewCmdInstallZitiALL(out, errOut)) - - cmd.AddCommand(NewCmdInstallZitiController(out, errOut)) - cmd.AddCommand(NewCmdInstallZitiRouter(out, errOut)) - cmd.AddCommand(NewCmdInstallZitiTunnel(out, errOut)) - cmd.AddCommand(NewCmdInstallZitiEdgeTunnel(out, errOut)) - cmd.AddCommand(NewCmdInstallZitiProxC(out, errOut)) - - // cmd.AddCommand(NewCmdInstallAnsible(out, errOut)) // Disable/hide this for now - cmd.AddCommand(NewCmdInstallTerraformProviderEdgeController(out, errOut)) options.AddCommonFlags(cmd) diff --git a/ziti/cmd/install_ziti_ALL.go b/ziti/cmd/install_ziti_ALL.go deleted file mode 100644 index 01fb32d7c..000000000 --- a/ziti/cmd/install_ziti_ALL.go +++ /dev/null @@ -1,122 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "io" - - "github.com/blang/semver" - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - installZitiALLLong = templates.LongDesc(` - Installs all Ziti apps that have not been installed already -`) - - installZitiALLExample = templates.Examples(` - # Install all the Ziti apps - ziti install all - `) -) - -// InstallZitiALLOptions the options for the upgrade ziti-channel command -type InstallZitiALLOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiALL defines the command -func NewCmdInstallZitiALL(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiALLOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "all", - Short: "Installs all the Ziti apps that have not been installed already", - Aliases: []string{"*"}, - Long: installZitiALLLong, - Example: installZitiALLExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -func (o *InstallZitiALLOptions) install(zitiApp string) error { - - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), zitiApp) - if err != nil { - return err - } - - if o.Version != "" { - newVersion, err = semver.Make(o.Version) - } - - log.Infoln("Attempting to install '" + zitiApp + "' version: " + newVersion.String()) - - return o.installZitiApp(version.GetBranch(), zitiApp, false, newVersion.String()) -} - -// Run implements the command -func (o *InstallZitiALLOptions) Run() error { - err := o.install(c.ZITI_CONTROLLER) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - err = o.install(c.ZITI_PROX_C) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - err = o.install(c.ZITI_ROUTER) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - err = o.install(c.ZITI_TUNNEL) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - err = o.install(c.ZITI_EDGE_TUNNEL) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - return nil -} diff --git a/ziti/cmd/install_ziti_controller.go b/ziti/cmd/install_ziti_controller.go deleted file mode 100644 index aa4f67bb6..000000000 --- a/ziti/cmd/install_ziti_controller.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "io" - - "github.com/blang/semver" - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - installZitiControllerLong = templates.LongDesc(` - Installs the Ziti Controller app if it has not been installed already -`) - - installZitiControllerExample = templates.Examples(` - # Install the Ziti Controller app - ziti install ziti-controller - `) -) - -// InstallZitiControllerOptions the options for the upgrade ziti-controller command -type InstallZitiControllerOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiController defines the command -func NewCmdInstallZitiController(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiControllerOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-controller", - Short: "Installs the Ziti Controller app - if it has not been installed already", - Aliases: []string{"controller"}, - Long: installZitiControllerLong, - Example: installZitiControllerExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *InstallZitiControllerOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) - if err != nil { - return err - } - - if o.Version != "" { - newVersion, err = semver.Make(o.Version) - } - - log.Infoln("Attempting to install '" + c.ZITI_CONTROLLER + "' version: " + newVersion.String()) - - return o.installZitiApp(version.GetBranch(), c.ZITI_CONTROLLER, false, newVersion.String()) -} diff --git a/ziti/cmd/install_ziti_edge_tunnel.go b/ziti/cmd/install_ziti_edge_tunnel.go deleted file mode 100644 index 144ea72da..000000000 --- a/ziti/cmd/install_ziti_edge_tunnel.go +++ /dev/null @@ -1,97 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "io" - - "github.com/blang/semver" - "github.com/spf13/cobra" -) - -var ( - installZitiEdgeTunnelLong = templates.LongDesc(` - Installs the Ziti Edge Tunnel app if it has not been installed already -`) - - installZitiEdgeTunnelExample = templates.Examples(` - # Install the Ziti Edge Tunnel app - ziti install ziti-edge-tunnel - `) -) - -// InstallZitiEdgeTunnelOptions the options for the upgrade ziti-edge-tunnel command -type InstallZitiEdgeTunnelOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiEdgeTunnel defines the command -func NewCmdInstallZitiEdgeTunnel(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiEdgeTunnelOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-edge-tunnel", - Short: "Installs the Ziti Edge Tunnel app - if it has not been installed already", - Aliases: []string{"edge-tunnel"}, - Long: installZitiEdgeTunnelLong, - Example: installZitiEdgeTunnelExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *InstallOptions) installZitiEdgeTunnel(targetVersion string) error { - newVersion, err := o.getLatestGitHubReleaseVersion(c.ZITI_EDGE_TUNNEL_GITHUB) - if err != nil { - return err - } - - if targetVersion != "" { - newVersion, err = semver.Make(targetVersion) - } - - log.Infoln("Attempting to install '" + c.ZITI_EDGE_TUNNEL + "' version: " + newVersion.String()) - - return o.findVersionAndInstallGitHubRelease(c.ZITI_EDGE_TUNNEL, c.ZITI_EDGE_TUNNEL_GITHUB, false, newVersion.String()) - -} - -// Run implements the command -func (o *InstallZitiEdgeTunnelOptions) Run() error { - return o.installZitiEdgeTunnel(o.Version) -} diff --git a/ziti/cmd/install_ziti_prox_c.go b/ziti/cmd/install_ziti_prox_c.go deleted file mode 100644 index 0c87056aa..000000000 --- a/ziti/cmd/install_ziti_prox_c.go +++ /dev/null @@ -1,97 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "io" - - "github.com/blang/semver" - "github.com/spf13/cobra" -) - -var ( - installZitiProxCLong = templates.LongDesc(` - Installs the Ziti ProxC app if it has not been installed already -`) - - installZitiProxCExample = templates.Examples(` - # Install the Ziti ProxC app - ziti install ziti-prox-c - `) -) - -// InstallZitiProxCOptions the options for the upgrade ziti-prox-c command -type InstallZitiProxCOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiProxC defines the command -func NewCmdInstallZitiProxC(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiProxCOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-prox-c", - Short: "Installs the Ziti ProxC app - if it has not been installed already", - Aliases: []string{"proxc"}, - Long: installZitiProxCLong, - Example: installZitiProxCExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -func (o *InstallOptions) installZitiProxC(targetVersion string) error { - if targetVersion != "" { - version, err := semver.Make(targetVersion) - if err != nil { - return err - } - return o.findVersionAndInstallGitHubRelease(c.ZITI_PROX_C, c.ZITI_SDK_C_GITHUB, false, version.String()) - } - - release, err := o.getHighestVersionGitHubReleaseInfo(c.ZITI_SDK_C_GITHUB) - if err != nil { - return err - } - log.Infoln("Attempting to install '" + c.ZITI_PROX_C + "' version: " + release.SemVer.String()) - return o.installGitHubRelease(c.ZITI_PROX_C, false, release) -} - -// Run implements the command -func (o *InstallZitiProxCOptions) Run() error { - return o.installZitiProxC(o.Version) -} diff --git a/ziti/cmd/install_ziti_router.go b/ziti/cmd/install_ziti_router.go deleted file mode 100644 index 1296e7b30..000000000 --- a/ziti/cmd/install_ziti_router.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "io" - - "github.com/blang/semver" - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - installZitiRouterLong = templates.LongDesc(` - Installs the Ziti Router app if it has not been installed already -`) - - installZitiRouterExample = templates.Examples(` - # Install the Ziti Router app - ziti install ziti-router - `) -) - -// InstallZitiRouterOptions the options for the upgrade ziti-router command -type InstallZitiRouterOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiRouter defines the command -func NewCmdInstallZitiRouter(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiRouterOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-router", - Short: "Installs the Ziti Router app - if it has not been installed already", - Aliases: []string{"router"}, - Long: installZitiRouterLong, - Example: installZitiRouterExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *InstallZitiRouterOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_ROUTER) - if err != nil { - return err - } - - if o.Version != "" { - newVersion, err = semver.Make(o.Version) - } - - log.Infoln("Attempting to install '" + c.ZITI_ROUTER + "' version: " + newVersion.String()) - - return o.installZitiApp(version.GetBranch(), c.ZITI_ROUTER, false, newVersion.String()) -} diff --git a/ziti/cmd/install_ziti_tunnel.go b/ziti/cmd/install_ziti_tunnel.go deleted file mode 100644 index 4d5e4c1cc..000000000 --- a/ziti/cmd/install_ziti_tunnel.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "io" - - "github.com/blang/semver" - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - installZitiTunnelLong = templates.LongDesc(` - Installs the Ziti Tunnel app if it has not been installed already -`) - - installZitiTunnelExample = templates.Examples(` - # Install the Ziti Tunnel app - ziti install ziti-tunnel - `) -) - -// InstallZitiTunnelOptions the options for the upgrade ziti-tunnel command -type InstallZitiTunnelOptions struct { - InstallOptions - - Version string -} - -// NewCmdInstallZitiTunnel defines the command -func NewCmdInstallZitiTunnel(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InstallZitiTunnelOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-tunnel", - Short: "Installs the Ziti Tunnel app - if it has not been installed already", - Aliases: []string{"tunnel"}, - Long: installZitiTunnelLong, - Example: installZitiTunnelExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *InstallZitiTunnelOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_TUNNEL) - if err != nil { - return err - } - - if o.Version != "" { - newVersion, err = semver.Make(o.Version) - } - - log.Infoln("Attempting to install '" + c.ZITI_TUNNEL + "' version: " + newVersion.String()) - - return o.installZitiApp(version.GetBranch(), c.ZITI_TUNNEL, false, newVersion.String()) -} diff --git a/ziti/cmd/uninstall.go b/ziti/cmd/uninstall.go deleted file mode 100644 index b3ce667ff..000000000 --- a/ziti/cmd/uninstall.go +++ /dev/null @@ -1,79 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - "io" - - "github.com/spf13/cobra" -) - -// UnInstallOptions are the flags for delete commands -type UnInstallOptions struct { - CommonOptions -} - -var ( - uninstall_long = templates.LongDesc(` - UnInstall the Ziti platform binaries. -`) - - uninstall_example = templates.Examples(` - # uninstall the Ziti router - ziti uninstall ziti-router - `) -) - -// NewCmdUnInstall creates the command -func NewCmdUnInstall(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallOptions{ - CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "uninstall [flags]", - Short: "Un-Installs a Ziti component/app", - Long: uninstall_long, - Example: uninstall_example, - Aliases: []string{"uninstall"}, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - SuggestFor: []string{"up"}, - } - - cmd.AddCommand(NewCmdUnInstallZitiController(out, errOut)) - cmd.AddCommand(NewCmdUnInstallZitiRouter(out, errOut)) - cmd.AddCommand(NewCmdUnInstallZitiTunnel(out, errOut)) - cmd.AddCommand(NewCmdUnInstallZitiEdgeTunnel(out, errOut)) - cmd.AddCommand(NewCmdUnInstallZitiProxC(out, errOut)) - - return cmd -} - -// Run implements this command -func (o *UnInstallOptions) Run() error { - return o.Cmd.Help() -} diff --git a/ziti/cmd/uninstall_ziti_controller.go b/ziti/cmd/uninstall_ziti_controller.go deleted file mode 100644 index 3ddd344f3..000000000 --- a/ziti/cmd/uninstall_ziti_controller.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - uninstallZitiControllerLong = templates.LongDesc(` - UnInstalls the Ziti Controller app if it has previously been installed -`) - - uninstallZitiControllerExample = templates.Examples(` - # UnInstall the Ziti Controller app - ziti uninstall ziti-controller - `) -) - -// UnInstallZitiControllerOptions the options for the upgrade ziti-controller command -type UnInstallZitiControllerOptions struct { - UnInstallOptions - - Version string -} - -// NewCmdUnInstallZitiController defines the command -func NewCmdUnInstallZitiController(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallZitiControllerOptions{ - UnInstallOptions: UnInstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-controller", - Short: "UnInstalls the Ziti Controller app - if it has previously been installed", - Aliases: []string{"controller"}, - Long: uninstallZitiControllerLong, - Example: uninstallZitiControllerExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - return cmd -} - -// Run implements the command -func (o *UnInstallZitiControllerOptions) Run() error { - o.deleteInstalledBinary(c.ZITI_CONTROLLER) - return nil -} diff --git a/ziti/cmd/uninstall_ziti_edge_tunnel.go b/ziti/cmd/uninstall_ziti_edge_tunnel.go deleted file mode 100644 index 3df0be1c4..000000000 --- a/ziti/cmd/uninstall_ziti_edge_tunnel.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - uninstallZitiEdgeTunnelLong = templates.LongDesc(` - UnInstalls the Ziti Edge Tunnel app if it has previously been installed -`) - - uninstallZitiEdgeTunnelExample = templates.Examples(` - # UnInstall the Ziti Edge Tunnel app - ziti uninstall ziti-edge-tunnel - `) -) - -// UnInstallZitiEdgeTunnelOptions the options for the upgrade ziti-edge-tunnel command -type UnInstallZitiEdgeTunnelOptions struct { - UnInstallOptions - - Version string -} - -// NewCmdUnInstallZitiEdgeTunnel defines the command -func NewCmdUnInstallZitiEdgeTunnel(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallZitiEdgeTunnelOptions{ - UnInstallOptions: UnInstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-edge-tunnel", - Short: "UnInstalls the Ziti Edge Tunnel app - if it has previously been installed", - Aliases: []string{"edge-tunnel"}, - Long: uninstallZitiEdgeTunnelLong, - Example: uninstallZitiEdgeTunnelExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - return cmd -} - -// Run implements the command -func (o *UnInstallZitiEdgeTunnelOptions) Run() error { - o.deleteInstalledBinary(c.ZITI_EDGE_TUNNEL) - return nil -} diff --git a/ziti/cmd/uninstall_ziti_proxy_c.go b/ziti/cmd/uninstall_ziti_proxy_c.go deleted file mode 100644 index e77ae62e4..000000000 --- a/ziti/cmd/uninstall_ziti_proxy_c.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - uninstallZitiProxCLong = templates.LongDesc(` - UnInstalls the Ziti ProxC app if it has previously been installed -`) - - uninstallZitiProxCExample = templates.Examples(` - # UnInstall the Ziti ProxC app - ziti uninstall ziti-prox-c - `) -) - -// UnInstallZitiProxCOptions the options for the upgrade ziti-prox-c command -type UnInstallZitiProxCOptions struct { - UnInstallOptions - - Version string -} - -// NewCmdUnInstallZitiProxC defines the command -func NewCmdUnInstallZitiProxC(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallZitiProxCOptions{ - UnInstallOptions: UnInstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-prox-c", - Short: "UnInstalls the Ziti ProxC app - if it has previously been installed", - Aliases: []string{"proxc"}, - Long: uninstallZitiProxCLong, - Example: uninstallZitiProxCExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - return cmd -} - -// Run implements the command -func (o *UnInstallZitiProxCOptions) Run() error { - o.deleteInstalledBinary(c.ZITI_PROX_C) - return nil -} diff --git a/ziti/cmd/uninstall_ziti_router.go b/ziti/cmd/uninstall_ziti_router.go deleted file mode 100644 index 1e3e24ce2..000000000 --- a/ziti/cmd/uninstall_ziti_router.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - uninstallZitiRouterLong = templates.LongDesc(` - UnInstalls the Ziti Router app if it has previously been installed -`) - - uninstallZitiRouterExample = templates.Examples(` - # UnInstall the Ziti Router app - ziti uninstall ziti-router - `) -) - -// UnInstallZitiRouterOptions the options for the upgrade ziti-router command -type UnInstallZitiRouterOptions struct { - UnInstallOptions - - Version string -} - -// NewCmdUnInstallZitiRouter defines the command -func NewCmdUnInstallZitiRouter(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallZitiRouterOptions{ - UnInstallOptions: UnInstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-router", - Short: "UnInstalls the Ziti Router app - if it has previously been installed", - Aliases: []string{"router"}, - Long: uninstallZitiRouterLong, - Example: uninstallZitiRouterExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - return cmd -} - -// Run implements the command -func (o *UnInstallZitiRouterOptions) Run() error { - o.deleteInstalledBinary(c.ZITI_ROUTER) - return nil -} diff --git a/ziti/cmd/uninstall_ziti_tunnel.go b/ziti/cmd/uninstall_ziti_tunnel.go deleted file mode 100644 index 3ed6af63d..000000000 --- a/ziti/cmd/uninstall_ziti_tunnel.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - uninstallZitiTunnelLong = templates.LongDesc(` - UnInstalls the Ziti Tunnel app if it has previously been installed -`) - - uninstallZitiTunnelExample = templates.Examples(` - # UnInstall the Ziti Tunnel app - ziti uninstall ziti-tunnel - `) -) - -// UnInstallZitiTunnelOptions the options for the upgrade ziti-tunnel command -type UnInstallZitiTunnelOptions struct { - UnInstallOptions - - Version string -} - -// NewCmdUnInstallZitiTunnel defines the command -func NewCmdUnInstallZitiTunnel(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UnInstallZitiTunnelOptions{ - UnInstallOptions: UnInstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-tunnel", - Short: "UnInstalls the Ziti Tunnel app - if it has previously been installed", - Aliases: []string{"tunnel"}, - Long: uninstallZitiTunnelLong, - Example: uninstallZitiTunnelExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - return cmd -} - -// Run implements the command -func (o *UnInstallZitiTunnelOptions) Run() error { - o.deleteInstalledBinary(c.ZITI_TUNNEL) - return nil -} diff --git a/ziti/cmd/upgrade.go b/ziti/cmd/upgrade.go deleted file mode 100644 index d118a825a..000000000 --- a/ziti/cmd/upgrade.go +++ /dev/null @@ -1,80 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - "io" - - "github.com/spf13/cobra" -) - -// UpgradeOptions are the flags for delete commands -type UpgradeOptions struct { - CommonOptions -} - -var ( - upgrade_long = templates.LongDesc(` - Upgrade the Ziti platform binaries. -`) - - upgrade_example = templates.Examples(` - # upgrade the command line tool - ziti upgrade cli - `) -) - -// NewCmdUpgrade creates the command -func NewCmdUpgrade(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeOptions{ - CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "upgrade [flags]", - Short: "Upgrades a Ziti component/app", - Long: upgrade_long, - Example: upgrade_example, - Aliases: []string{"bump"}, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - SuggestFor: []string{"up"}, - } - - cmd.AddCommand(NewCmdUpgradeZiti(out, errOut)) - cmd.AddCommand(NewCmdUpgradeZitiController(out, errOut)) - cmd.AddCommand(NewCmdUpgradeZitiRouter(out, errOut)) - cmd.AddCommand(NewCmdUpgradeZitiTunnel(out, errOut)) - cmd.AddCommand(NewCmdUpgradeZitiProxC(out, errOut)) - cmd.AddCommand(NewCmdUpgradeZitiEdgeTunnel(out, errOut)) - - return cmd -} - -// Run implements this command -func (o *UpgradeOptions) Run() error { - return o.Cmd.Help() -} diff --git a/ziti/cmd/upgrade_ziti.go b/ziti/cmd/upgrade_ziti.go deleted file mode 100644 index b841946b0..000000000 --- a/ziti/cmd/upgrade_ziti.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - upgradeCLILong = templates.LongDesc(` - Upgrades the Ziti command line tools if there is a newer release -`) - - upgradeCLIExample = templates.Examples(` - # Upgrades the Ziti CLI tools - ziti upgrade cli - `) -) - -// UpgradeZitiOptions the options for the create spring command -type UpgradeZitiOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZiti defines the command -func NewCmdUpgradeZiti(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti", - Short: "Upgrades the ziti CLI - if there is a new version available", - Aliases: []string{"z", "cli"}, - Long: upgradeCLILong, - Example: upgradeCLIExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI) - - return o.installZitiApp(version.GetBranch(), c.ZITI, true, newVersionStr) -} diff --git a/ziti/cmd/upgrade_ziti_controller.go b/ziti/cmd/upgrade_ziti_controller.go deleted file mode 100644 index e4acce6c0..000000000 --- a/ziti/cmd/upgrade_ziti_controller.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - upgradeZitiControllerLong = templates.LongDesc(` - Upgrades the Ziti Controller app if there is a newer release -`) - - upgradeZitiControllerExample = templates.Examples(` - # Upgrades the Ziti Controller app - ziti upgrade ziti-controller - `) -) - -// UpgradeZitiControllerOptions the options for the upgrade ziti-controller command -type UpgradeZitiControllerOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZitiController defines the command -func NewCmdUpgradeZitiController(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiControllerOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-controller", - Short: "Upgrades the Ziti Controller app - if there is a new version available", - Aliases: []string{"controller", "ctrl", "zc"}, - Long: upgradeZitiControllerLong, - Example: upgradeZitiControllerExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiControllerOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI_CONTROLLER) - - return o.installZitiApp(version.GetBranch(), c.ZITI_CONTROLLER, true, newVersionStr) -} diff --git a/ziti/cmd/upgrade_ziti_edge_tunnel.go b/ziti/cmd/upgrade_ziti_edge_tunnel.go deleted file mode 100644 index 4de2689e7..000000000 --- a/ziti/cmd/upgrade_ziti_edge_tunnel.go +++ /dev/null @@ -1,89 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - upgradeZitiEdgeTunnelLong = templates.LongDesc(` - Upgrades the Ziti Edge Tunnel app if there is a newer release -`) - - upgradeZitiEdgeTunnelExample = templates.Examples(` - # Upgrades the Ziti Edge Tunnel app - ziti upgrade ziti-edge-tunnel - `) -) - -// UpgradeZitiEdgeTunnelOptions the options for the upgrade ziti-edge-tunnel command -type UpgradeZitiEdgeTunnelOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZitiEdgeTunnel defines the command -func NewCmdUpgradeZitiEdgeTunnel(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiEdgeTunnelOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-edge-tunnel", - Short: "Upgrades the Ziti Edge Tunnel app - if there is a new version available", - Aliases: []string{"edge-tunnel", "et"}, - Long: upgradeZitiEdgeTunnelLong, - Example: upgradeZitiEdgeTunnelExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiEdgeTunnelOptions) Run() error { - newVersion, err := o.getLatestGitHubReleaseVersion(c.ZITI_EDGE_TUNNEL_GITHUB) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI_EDGE_TUNNEL) - - return o.findVersionAndInstallGitHubRelease(c.ZITI_EDGE_TUNNEL, c.ZITI_EDGE_TUNNEL_GITHUB, true, newVersionStr) -} diff --git a/ziti/cmd/upgrade_ziti_prox_c.go b/ziti/cmd/upgrade_ziti_prox_c.go deleted file mode 100644 index a71baad45..000000000 --- a/ziti/cmd/upgrade_ziti_prox_c.go +++ /dev/null @@ -1,89 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/spf13/cobra" -) - -var ( - upgradeZitiProxCLong = templates.LongDesc(` - Upgrades the Ziti ProxC app if there is a newer release -`) - - upgradeZitiProxCExample = templates.Examples(` - # Upgrades the Ziti ProxC app - ziti upgrade ziti-prox-c - `) -) - -// UpgradeZitiProxCOptions the options for the upgrade ziti-prox-c command -type UpgradeZitiProxCOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZitiProxC defines the command -func NewCmdUpgradeZitiProxC(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiProxCOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-prox-c", - Short: "Upgrades the Ziti ProxC app - if there is a new version available", - Aliases: []string{"proxc"}, - Long: upgradeZitiProxCLong, - Example: upgradeZitiProxCExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiProxCOptions) Run() error { - newVersion, err := o.getLatestGitHubReleaseVersion(c.ZITI_SDK_C_GITHUB) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI_PROX_C) - - return o.findVersionAndInstallGitHubRelease(c.ZITI_PROX_C, c.ZITI_SDK_C_GITHUB, true, newVersionStr) -} diff --git a/ziti/cmd/upgrade_ziti_router.go b/ziti/cmd/upgrade_ziti_router.go deleted file mode 100644 index a1bf3aad6..000000000 --- a/ziti/cmd/upgrade_ziti_router.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - upgradeZitiRouterLong = templates.LongDesc(` - Upgrades the Ziti Router app if there is a newer release -`) - - upgradeZitiRouterExample = templates.Examples(` - # Upgrades the Ziti Router app - ziti upgrade ziti-router - `) -) - -// UpgradeZitiRouterOptions the options for the upgrade ziti-router command -type UpgradeZitiRouterOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZitiRouter defines the command -func NewCmdUpgradeZitiRouter(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiRouterOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-router", - Short: "Upgrades the Ziti Router app - if there is a new version available", - Aliases: []string{"router", "rtr", "r"}, - Long: upgradeZitiRouterLong, - Example: upgradeZitiRouterExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiRouterOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_ROUTER) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI_ROUTER) - - return o.installZitiApp(version.GetBranch(), c.ZITI_ROUTER, true, newVersionStr) -} diff --git a/ziti/cmd/upgrade_ziti_tunnel.go b/ziti/cmd/upgrade_ziti_tunnel.go deleted file mode 100644 index 349957bf7..000000000 --- a/ziti/cmd/upgrade_ziti_tunnel.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "io" - - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -var ( - upgradeZitiTunnelLong = templates.LongDesc(` - Upgrades the Ziti Tunnel app if there is a newer release -`) - - upgradeZitiTunnelExample = templates.Examples(` - # Upgrades the Ziti Tunnel app - ziti upgrade ziti-tunnel - `) -) - -// UpgradeZitiTunnelOptions the options for the upgrade ziti-tunnel command -type UpgradeZitiTunnelOptions struct { - CommonOptions - - Version string -} - -// NewCmdUpgradeZitiTunnel defines the command -func NewCmdUpgradeZitiTunnel(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UpgradeZitiTunnelOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "ziti-tunnel", - Short: "Upgrades the Ziti Tunnel app - if there is a new version available", - Aliases: []string{"tunnel", "rtr", "r"}, - Long: upgradeZitiTunnelLong, - Example: upgradeZitiTunnelExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") - options.AddCommonFlags(cmd) - return cmd -} - -// Run implements the command -func (o *UpgradeZitiTunnelOptions) Run() error { - newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_TUNNEL) - if err != nil { - return err - } - - newVersionStr := newVersion.String() - - if o.Version != "" { - newVersionStr = o.Version - } - - o.deleteInstalledBinary(c.ZITI_TUNNEL) - - return o.installZitiApp(version.GetBranch(), c.ZITI_TUNNEL, true, newVersionStr) -} diff --git a/ziti/cmd/use.go b/ziti/cmd/use.go deleted file mode 100644 index 5a15854d5..000000000 --- a/ziti/cmd/use.go +++ /dev/null @@ -1,153 +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" - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "github.com/openziti/ziti/ziti/util" - "io" - - "github.com/blang/semver" - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -// UseOptions are the flags for delete commands -type UseOptions struct { - InstallOptions - - Version string - Branch string -} - -// NewCmdUse creates the command -func NewCmdUse(out io.Writer, errOut io.Writer) *cobra.Command { - options := &UseOptions{ - InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - }, - } - - cmd := &cobra.Command{ - Use: "use [branch]", - Short: "switch between branches of Ziti", - Long: ` -'ziti use' fetches the list of currently available branch-build names from artifactory, -presents them in a chooser-list, and once one is selected, will switch the current 'ziti' binary for the -chosen one. This is useful for swapping between different feature branches, or back and forth from a release -build to a feature-branch build. -`, - Aliases: []string{}, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - SuggestFor: []string{}, - } - - cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to use") - cmd.Flags().BoolVarP(&options.Verbose, "verbose", "", false, "Enable verbose logging") - cmd.Flags().StringVarP(&options.Branch, "branch", "b", "", "Name of branch to switch to") - cmd.Flags().BoolVarP(&options.Staging, "staging", "", false, "Install/Upgrade components from the ziti-staging repo") - - return cmd -} - -func (o *UseOptions) install(branch string, zitiApp string) error { - newVersion, err := o.getLatestZitiAppVersionForBranch(branch, zitiApp) - if err != nil { - log.Infoln("Attempt to fetch latest version of '" + zitiApp + "' for branch '" + branch + "' failed: " + err.Error()) - - // Special-case branch fallback (to master) when dealing with ziti-prox-c - if zitiApp == c.ZITI_PROX_C || zitiApp == c.ZITI_EDGE_TUNNEL { - branch = "master" - newVersion, err = o.getLatestZitiAppVersionForBranch(branch, zitiApp) - if err != nil { - return err - } - } else { - return err - } - } - - if o.Version != "" { - newVersion, err = semver.Make(o.Version) - } - - log.Infoln("Attempting to install '" + zitiApp + "' version: " + newVersion.String() + " from branch '" + branch + "'") - - return o.installZitiApp(branch, zitiApp, true, newVersion.String()) -} - -// Run implements the command -func (o *UseOptions) Run() error { - - fmt.Println("Current source branch is: ", version.GetBranch()) - - branch := o.Branch - if branch == "" { - list, err := o.getCurrentZitiSnapshotList() - branch, err = util.PickName(list, "Which Branch would you like to switch to: ") - if err != nil { - return err - } - } - - if o.Staging { - if o.Branch != "main" { - log.Errorf("Error: --staging can only be used with --branch of 'main'. You specified '%s'", branch) - return nil - } - } - - err := o.install(branch, c.ZITI) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - err = o.install(branch, c.ZITI_CONTROLLER) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - err = o.install(branch, c.ZITI_ROUTER) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - err = o.install(branch, c.ZITI_TUNNEL) - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - err = o.installZitiProxC("") - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - err = o.installZitiEdgeTunnel("") - if err != nil { - log.Errorf("Error: install failed %s \n", err.Error()) - } - - return nil -} diff --git a/ziti/cmd/version.go b/ziti/cmd/version.go deleted file mode 100644 index 268e6da81..000000000 --- a/ziti/cmd/version.go +++ /dev/null @@ -1,250 +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/blang/semver" - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/table" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/internal/log" - "github.com/openziti/ziti/ziti/util" - "io" - "os" - - // "strings" - - "github.com/openziti/ziti/common/version" - "github.com/spf13/cobra" -) - -const () - -type VersionOptions struct { - CommonOptions - - Container string - NoVersionCheck bool -} - -func NewCmdVersion(out io.Writer, errOut io.Writer) *cobra.Command { - options := &VersionOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "version", - Short: "Print the version information", - Aliases: []string{"ver", "v"}, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - options.AddCommonFlags(cmd) - - cmd.Flags().BoolVarP(&options.NoVersionCheck, "no-update", "n", false, - "disable update check") - - return cmd -} - -// Run ... -func (o *VersionOptions) Run() error { - - util.ConfigDir() - - info := util.ColorInfo - - t := table.CreateTable(os.Stdout) - t.AddRow("NAME", "VERSION") - - t.AddRow(c.ZITI, info(version.GetBuildMetadata(o.Verbose))) - - o.versionPrintZitiApp(c.ZITI_CONTROLLER, &t) - o.versionPrintZitiApp(c.ZITI_PROX_C, &t) - o.versionPrintZitiApp(c.ZITI_ROUTER, &t) - o.versionPrintZitiApp(c.ZITI_TUNNEL, &t) - o.versionPrintZitiApp(c.ZITI_EDGE_TUNNEL, &t) - - t.Render() - - if !o.NoVersionCheck && !o.Verbose { - return o.versionCheck() - } - - return nil -} - -func (o *VersionOptions) getVersionFromZitiApp(zitiApp string, versionArg string) (string, error) { - if o.Verbose { - return o.getCommandOutput("", zitiApp, versionArg, "--verbose") - } - return o.getCommandOutput("", zitiApp, versionArg) -} - -func (o *VersionOptions) getVersionFromZitiAppMultiArg(zitiApp string) (string, error) { - var varsionArg string - if zitiApp == c.ZITI { - varsionArg = "--version" - } else { - varsionArg = "version" - } - return o.getVersionFromZitiApp(zitiApp, varsionArg) -} - -func (o *VersionOptions) versionPrintZitiApp(zitiApp string, table *table.Table) { - output, err := o.getVersionFromZitiAppMultiArg(zitiApp) - if err == nil { - table.AddRow(zitiApp, util.ColorInfo(output)) - } else { - if !isBinaryInstalled(zitiApp) { - table.AddRow(zitiApp, util.ColorWarning("not installed")) - } - } -} - -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) - return nil -} - -func (o *VersionOptions) versionCheckZitiApp(zitiApp string) error { - var currentVersion semver.Version - var newVersion semver.Version - var err error - - if !isBinaryInstalled(zitiApp) { - return nil - } - - switch zitiApp { - case c.ZITI: - newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI) - case c.ZITI_CONTROLLER: - newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) - case c.ZITI_PROX_C: - newVersion, err = o.getLatestGitHubReleaseVersion(c.ZITI_SDK_C_GITHUB) - case c.ZITI_ROUTER: - newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_ROUTER) - case c.ZITI_TUNNEL: - newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_TUNNEL) - case c.ZITI_EDGE_TUNNEL: - newVersion, err = o.getLatestGitHubReleaseVersion(c.ZITI_EDGE_TUNNEL_GITHUB) - default: - return nil - } - if err != nil { - return err - } - - app := util.ColorInfo(zitiApp) - output, err := o.getVersionFromZitiAppMultiArg(zitiApp) - if err != nil { - log.Warnf("\nAn err occurred: %s", err) - } else { - currentVersion, err = semver.ParseTolerant(output) - if err != nil { - log.Warnf("Failed to get %s version: %s\n", zitiApp, err) - return err - } - if newVersion.GT(currentVersion) { - log.Warnf("\nA new %s version is available: %s\n", app, util.ColorInfo(newVersion.String())) - - if o.BatchMode { - log.Warnf("To upgrade to this new version use: %s\n", util.ColorInfo("ziti upgrade "+zitiApp)) - } else { - message := fmt.Sprintf("Would you like to upgrade to the new %s version?", app) - if util.Confirm(message, true, "Please indicate if you would like to upgrade the binary version.") { - switch zitiApp { - case c.ZITI: - err = o.upgradeZiti() - case c.ZITI_CONTROLLER: - err = o.upgradeZitiController() - case c.ZITI_PROX_C: - err = o.upgradeZitiProxC() - case c.ZITI_ROUTER: - err = o.upgradeZitiRouter() - case c.ZITI_TUNNEL: - err = o.upgradeZitiTunnel() - case c.ZITI_EDGE_TUNNEL: - err = o.upgradeZitiEdgeTunnel() - default: - } - if err != nil { - return err - } - } - } - } - } - - return nil -} - -func (o *VersionOptions) upgradeZiti() error { - options := &UpgradeZitiOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} - -func (o *VersionOptions) upgradeZitiController() error { - options := &UpgradeZitiControllerOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} - -func (o *VersionOptions) upgradeZitiProxC() error { - options := &UpgradeZitiProxCOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} - -func (o *VersionOptions) upgradeZitiRouter() error { - options := &UpgradeZitiRouterOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} - -func (o *VersionOptions) upgradeZitiTunnel() error { - options := &UpgradeZitiTunnelOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} - -func (o *VersionOptions) upgradeZitiEdgeTunnel() error { - options := &UpgradeZitiEdgeTunnelOptions{ - CommonOptions: o.CommonOptions, - } - return options.Run() -} From d73cb54f60fb322406cb208410457000b28b3980 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 11:36:46 -0500 Subject: [PATCH 09/46] Fix controller/router commands --- ziti/cmd/cmd.go | 4 ++-- ziti/controller/root.go | 6 +++--- ziti/router/root.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 99a457269..dc3f8545e 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -124,9 +124,9 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com initCommands := NewCmdInit(out, err) createCommands := NewCmdCreate(out, err) - controllerCmd := controller.NewRunCmd() + controllerCmd := controller.NewControllerCmd() tunnelCmd := tunnel.NewTunnelCmd() - routerCmd := router.NewRunCmd() + routerCmd := router.NewRouterCmd() agentCommands := agentcli.NewAgentCmd(p) pkiCommands := NewCmdPKI(out, err) fabricCommand := fabric.NewFabricCmd(p) diff --git a/ziti/controller/root.go b/ziti/controller/root.go index 13396951b..01ec3ac3e 100644 --- a/ziti/controller/root.go +++ b/ziti/controller/root.go @@ -29,8 +29,8 @@ import ( func NewControllerCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "ziti-controller", - Short: "Ziti Fabric Controller", + Use: "controller", + Short: "Ziti Controller", PersistentPreRun: func(cmd *cobra.Command, args []string) { if verbose { logrus.SetLevel(logrus.DebugLevel) @@ -46,8 +46,8 @@ func NewControllerCmd() *cobra.Command { default: // let logrus do its own thing } - util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER) + util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER) }, } diff --git a/ziti/router/root.go b/ziti/router/root.go index 43cf57712..eb962e88a 100644 --- a/ziti/router/root.go +++ b/ziti/router/root.go @@ -27,8 +27,8 @@ import ( func NewRouterCmd() *cobra.Command { var routerCmd = &cobra.Command{ - Use: "ziti-router", - Short: "Ziti Fabric Router", + Use: "router", + Short: "Ziti Router", PersistentPreRun: func(cmd *cobra.Command, args []string) { if verbose { logrus.SetLevel(logrus.DebugLevel) @@ -44,8 +44,8 @@ func NewRouterCmd() *cobra.Command { default: // let logrus do its own thing } - util.LogReleaseVersionCheck(constants.ZITI_ROUTER) + util.LogReleaseVersionCheck(constants.ZITI_ROUTER) }, } From 0d1846defcc5225d2ec35254d9193f1189704071 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 11:43:07 -0500 Subject: [PATCH 10/46] Move db, log-filter and unwrap under ops command --- CHANGELOG.md | 1 + ziti/cmd/cmd.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 315c83f40..d3b2ad411 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * Should work exactly the same as `ziti-tunnel` * Is hidden as `ziti-edge-tunnel` is the preferred tunnelling application * The standalone binary `ziti-tunnel` is deprecated and will be removed in a future release +* The db, log-format and unwrap commands have been moved under a new ops command # Release 0.26.11 diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index dc3f8545e..999d6a03e 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -133,9 +133,15 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com edgeCommand := edge.NewCmdEdge(out, err) tutorialCmd := tutorial.NewTutorialCmd(p) demoCmd := demo.NewDemoCmd(p) - logFilter := NewCmdLogFormat(out, err) - unwrapIdentityFileCommand := NewUnwrapIdentityFileCommand(out, err) - dbCommand := database.NewCmdDb(out, err) + + opsCommands := &cobra.Command{ + Use: "ops ", + Short: "Various utilities useful when operating a Ziti network", + } + + opsCommands.AddCommand(database.NewCmdDb(out, err)) + opsCommands.AddCommand(NewCmdLogFormat(out, err)) + opsCommands.AddCommand(NewUnwrapIdentityFileCommand(out, err)) installCommands := []*cobra.Command{ NewCmdInstall(out, err), @@ -161,7 +167,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com routerCmd, tunnelCmd, pkiCommands, - unwrapIdentityFileCommand, }, }, { @@ -174,8 +179,7 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com { Message: "Utilities", Commands: []*cobra.Command{ - logFilter, - dbCommand, + opsCommands, }, }, { From fc2ddda738464c97b08c213d6a5daf3f6e559390 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 12:15:08 -0500 Subject: [PATCH 11/46] Move demo and tutorial under a new learn subcommand --- CHANGELOG.md | 3 ++ ziti/cmd/cmd.go | 13 ++++-- ziti/cmd/init.go | 109 ----------------------------------------------- 3 files changed, 12 insertions(+), 113 deletions(-) delete mode 100644 ziti/cmd/init.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b2ad411..58342a875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ * Is hidden as `ziti-edge-tunnel` is the preferred tunnelling application * The standalone binary `ziti-tunnel` is deprecated and will be removed in a future release * The db, log-format and unwrap commands have been moved under a new ops command +* The init, install, upgrade, uninstall, use and version commands have been removed + * These were used mange downloads of ziti executables and were not widely used +* The demo and tutorial commands have been moved under the new learn subcommand # Release 0.26.11 diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 999d6a03e..595c056aa 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -122,7 +122,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com p := common.NewOptionsProvider(out, err) - initCommands := NewCmdInit(out, err) createCommands := NewCmdCreate(out, err) controllerCmd := controller.NewControllerCmd() tunnelCmd := tunnel.NewTunnelCmd() @@ -143,6 +142,14 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com opsCommands.AddCommand(NewCmdLogFormat(out, err)) opsCommands.AddCommand(NewUnwrapIdentityFileCommand(out, err)) + learnCommands := &cobra.Command{ + Use: "learn ", + Short: "Tutorials and demos to help you learn about Ziti", + } + + learnCommands.AddCommand(demoCmd) + learnCommands.AddCommand(tutorialCmd) + installCommands := []*cobra.Command{ NewCmdInstall(out, err), } @@ -155,7 +162,6 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com { Message: "Working with Ziti resources:", Commands: []*cobra.Command{ - initCommands, createCommands, }, }, @@ -185,8 +191,7 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com { Message: "Learning Ziti", Commands: []*cobra.Command{ - demoCmd, - tutorialCmd, + learnCommands, }, }, } diff --git a/ziti/cmd/init.go b/ziti/cmd/init.go deleted file mode 100644 index 48c2b1815..000000000 --- a/ziti/cmd/init.go +++ /dev/null @@ -1,109 +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 ( - cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/cmd/templates" - c "github.com/openziti/ziti/ziti/constants" - "github.com/spf13/cobra" - "io" -) - -// InitOptions the flags for running init -type InitOptions struct { - CommonOptions - Flags InitFlags -} - -type InitFlags struct { - Component string -} - -var ( - initLong = templates.LongDesc(` - This command installs a Ziti configuration template for a selected Ziti component - `) - - initExample = templates.Examples(` - ziti init - `) -) - -// NewCmdInit creates a command object for the generic "init" action -func NewCmdInit(out io.Writer, errOut io.Writer) *cobra.Command { - options := &InitOptions{ - CommonOptions: CommonOptions{ - Out: out, - Err: errOut, - }, - } - - cmd := &cobra.Command{ - Use: "init", - Short: "Initialize a Ziti Configuration", - Long: initLong, - Example: initExample, - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := options.Run() - cmdhelper.CheckErr(err) - }, - } - - options.AddCommonFlags(cmd) - - options.addInitFlags(cmd) - return cmd -} - -func (options *InitOptions) addInitFlags(cmd *cobra.Command) { - cmd.Flags().StringVarP(&options.Flags.Component, "component", "", "", "Ziti component being initialized.") -} - -func (o *InitOptions) Run() error { - - var err error - if o.Flags.Component == "" { - o.Flags.Component, err = o.GetZitiComponent(o.Flags.Component) - if err != nil { - return err - } - } - - err = o.installRequirements("") - if err != nil { - return err - } - - switch o.Flags.Component { - case c.ZITI_CONTROLLER: - err = o.createInitialControllerConfig() - case c.ZITI_ROUTER: - return nil - case c.ZITI: - err = o.createInitialZitiConfig() - default: - } - - if err != nil { - return err - } - - return nil -} From c8eeb57824f6e03be06a6a71b035e3b6ce499fed Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 13:21:22 -0500 Subject: [PATCH 12/46] Fix non-linux builds --- ziti/cmd/cmd.go | 2 +- ziti/tunnel/root.go | 15 ++++++++++----- ziti/tunnel/run.go | 4 ++++ ziti/tunnel/tproxy.go | 4 ++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 595c056aa..4bf467cae 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -124,7 +124,7 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com createCommands := NewCmdCreate(out, err) controllerCmd := controller.NewControllerCmd() - tunnelCmd := tunnel.NewTunnelCmd() + tunnelCmd := tunnel.NewTunnelCmd(false) routerCmd := router.NewRouterCmd() agentCommands := agentcli.NewAgentCmd(p) pkiCommands := NewCmdPKI(out, err) diff --git a/ziti/tunnel/root.go b/ziti/tunnel/root.go index 0bef0a567..d2b59e63c 100644 --- a/ziti/tunnel/root.go +++ b/ziti/tunnel/root.go @@ -44,9 +44,15 @@ const ( dnsSvcIpRangeFlag = "dnsSvcIpRange" ) -func NewTunnelCmd() *cobra.Command { +var hostSpecificCmds []*cobra.Command + +func NewTunnelCmd(standalone bool) *cobra.Command { + use := "tunnel " + if standalone { + use = filepath.Base(os.Args[0]) + } var root = &cobra.Command{ - Use: filepath.Base(os.Args[0]), + Use: use, Short: "Ziti Tunnel", PersistentPreRun: rootPreRun, Hidden: true, @@ -66,8 +72,7 @@ func NewTunnelCmd() *cobra.Command { root.AddCommand(enrollment.NewEnrollCommand(p)) root.AddCommand(NewHostCmd()) root.AddCommand(NewProxyCmd()) - root.AddCommand(NewRunCmd()) - root.AddCommand(NewTProxyCmd()) + root.AddCommand(hostSpecificCmds...) root.AddCommand(NewVersionCmd()) return root @@ -79,7 +84,7 @@ var cliAgentEnabled bool var cliAgentAddr string func Execute() { - if err := NewTunnelCmd().Execute(); err != nil { + if err := NewTunnelCmd(true).Execute(); err != nil { pfxlog.Logger().Errorf("error: %s", err) os.Exit(1) } diff --git a/ziti/tunnel/run.go b/ziti/tunnel/run.go index d776936b1..55a2841b7 100644 --- a/ziti/tunnel/run.go +++ b/ziti/tunnel/run.go @@ -26,6 +26,10 @@ import ( "github.com/spf13/cobra" ) +func init() { + hostSpecificCmds = append(hostSpecificCmds, NewRunCmd()) +} + func NewRunCmd() *cobra.Command { return &cobra.Command{ Use: "run ", diff --git a/ziti/tunnel/tproxy.go b/ziti/tunnel/tproxy.go index 2b58102d7..1d884dde0 100644 --- a/ziti/tunnel/tproxy.go +++ b/ziti/tunnel/tproxy.go @@ -25,6 +25,10 @@ import ( "github.com/spf13/cobra" ) +func init() { + hostSpecificCmds = append(hostSpecificCmds, NewTProxyCmd()) +} + func NewTProxyCmd() *cobra.Command { var runTProxyCmd = &cobra.Command{ Use: "tproxy", From cfaf402c03e80633728cf0efc36635f680dac7de Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 14 Nov 2022 13:35:19 -0500 Subject: [PATCH 13/46] Update edge and fabric command descriptions --- ziti/cmd/edge/root.go | 2 +- ziti/cmd/fabric/root.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ziti/cmd/edge/root.go b/ziti/cmd/edge/root.go index b3beb2aee..d488a170e 100644 --- a/ziti/cmd/edge/root.go +++ b/ziti/cmd/edge/root.go @@ -29,7 +29,7 @@ var ExtraEdgeCommands []func(p common.OptionsProvider) *cobra.Command // NewCmdEdge creates a command object for the "controller" command func NewCmdEdge(out io.Writer, errOut io.Writer) *cobra.Command { - cmd := util.NewEmptyParentCmd("edge", "Interact with Ziti Edge Components") + cmd := util.NewEmptyParentCmd("edge", "Manage the Edge components of a Ziti network using the Ziti Edge REST API") populateEdgeCommands(out, errOut, cmd) return cmd } diff --git a/ziti/cmd/fabric/root.go b/ziti/cmd/fabric/root.go index 8775a39ba..ec26a7335 100644 --- a/ziti/cmd/fabric/root.go +++ b/ziti/cmd/fabric/root.go @@ -28,7 +28,7 @@ import ( // NewFabricCmd creates a command object for the fabric command func NewFabricCmd(p common.OptionsProvider) *cobra.Command { - fabricCmd := util.NewEmptyParentCmd("fabric", "Interact with Ziti Fabric Components") + fabricCmd := util.NewEmptyParentCmd("fabric", "Manage the Fabric components of a Ziti network using the Ziti Fabric REST and WebSocket APIs") fabricCmd.AddCommand(newAddIdentityCmd(p), newRemoveIdentityCmd(p)) fabricCmd.AddCommand(newCreateCommand(p), newListCmd(p), newUpdateCommand(p), newDeleteCmd(p)) From 32372405d5ce4a9d86c6e2bf1b4b7a16a8c9341c Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 15 Nov 2022 09:27:45 -0500 Subject: [PATCH 14/46] Add back install, upgrade, version and use, but hide them. --- CHANGELOG.md | 7 +- ziti/cmd/cmd.go | 6 +- ziti/cmd/common/options.go | 9 + ziti/cmd/{ => install}/common_install.go | 40 +-- ziti/cmd/{ => install}/install.go | 37 ++- ...tall_terraform_provider_edge_controller.go | 5 +- ziti/cmd/install/install_ziti_ALL.go | 123 ++++++++ ziti/cmd/install/install_ziti_controller.go | 93 +++++++ ziti/cmd/install/install_ziti_edge_tunnel.go | 98 +++++++ ziti/cmd/install/install_ziti_prox_c.go | 98 +++++++ ziti/cmd/install/install_ziti_router.go | 93 +++++++ ziti/cmd/install/install_ziti_tunnel.go | 93 +++++++ ziti/cmd/install/upgrade.go | 77 +++++ ziti/cmd/install/upgrade_ziti.go | 93 +++++++ ziti/cmd/install/upgrade_ziti_controller.go | 93 +++++++ ziti/cmd/install/upgrade_ziti_edge_tunnel.go | 92 ++++++ ziti/cmd/install/upgrade_ziti_prox_c.go | 92 ++++++ ziti/cmd/install/upgrade_ziti_router.go | 93 +++++++ ziti/cmd/install/upgrade_ziti_tunnel.go | 93 +++++++ ziti/cmd/install/use.go | 155 +++++++++++ ziti/cmd/install/version.go | 263 ++++++++++++++++++ 21 files changed, 1724 insertions(+), 29 deletions(-) rename ziti/cmd/{ => install}/common_install.go (83%) rename ziti/cmd/{ => install}/install.go (62%) rename ziti/cmd/{ => install}/install_terraform_provider_edge_controller.go (96%) create mode 100644 ziti/cmd/install/install_ziti_ALL.go create mode 100644 ziti/cmd/install/install_ziti_controller.go create mode 100644 ziti/cmd/install/install_ziti_edge_tunnel.go create mode 100644 ziti/cmd/install/install_ziti_prox_c.go create mode 100644 ziti/cmd/install/install_ziti_router.go create mode 100644 ziti/cmd/install/install_ziti_tunnel.go create mode 100644 ziti/cmd/install/upgrade.go create mode 100644 ziti/cmd/install/upgrade_ziti.go create mode 100644 ziti/cmd/install/upgrade_ziti_controller.go create mode 100644 ziti/cmd/install/upgrade_ziti_edge_tunnel.go create mode 100644 ziti/cmd/install/upgrade_ziti_prox_c.go create mode 100644 ziti/cmd/install/upgrade_ziti_router.go create mode 100644 ziti/cmd/install/upgrade_ziti_tunnel.go create mode 100644 ziti/cmd/install/use.go create mode 100644 ziti/cmd/install/version.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 58342a875..7934c17d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## What's New * Ziti CLI - * The CLI has been cleaned up and unused, unusable and underused components have been removed + * The CLI has been cleaned up and unused, unusable and underused components have been removed or hidden ## Ziti CLI @@ -19,8 +19,9 @@ * Is hidden as `ziti-edge-tunnel` is the preferred tunnelling application * The standalone binary `ziti-tunnel` is deprecated and will be removed in a future release * The db, log-format and unwrap commands have been moved under a new ops command -* The init, install, upgrade, uninstall, use and version commands have been removed - * These were used mange downloads of ziti executables and were not widely used +* ziti executable download management has been deprecated + * The init and uninstall commands have been removed + * The install, upgrade, use and version commands have been hidden and will be hidden once tests using them are updated or replaced * The demo and tutorial commands have been moved under the new learn subcommand # Release 0.26.11 diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 4bf467cae..36422f450 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -25,6 +25,7 @@ import ( "github.com/openziti/ziti/ziti/cmd/demo" "github.com/openziti/ziti/ziti/cmd/edge" "github.com/openziti/ziti/ziti/cmd/fabric" + "github.com/openziti/ziti/ziti/cmd/install" "github.com/openziti/ziti/ziti/cmd/templates" "github.com/openziti/ziti/ziti/cmd/tutorial" c "github.com/openziti/ziti/ziti/constants" @@ -151,7 +152,10 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com learnCommands.AddCommand(tutorialCmd) installCommands := []*cobra.Command{ - NewCmdInstall(out, err), + install.NewCmdInstall(out, err), + install.NewCmdUpgrade(out, err), + install.NewCmdUse(out, err), + install.NewCmdVersion(out, err), } groups := templates.CommandGroups{ diff --git a/ziti/cmd/common/options.go b/ziti/cmd/common/options.go index 8cf0c3832..116b797e1 100644 --- a/ziti/cmd/common/options.go +++ b/ziti/cmd/common/options.go @@ -54,6 +54,15 @@ type CommonOptions struct { Identity string } +func (options *CommonOptions) AddCommonFlags(cmd *cobra.Command) { + cmd.Flags().BoolVarP(&options.BatchMode, "batch-mode", "b", false, "In batch mode the command never prompts for user input") + cmd.Flags().BoolVarP(&options.Verbose, "verbose", "", false, "Enable verbose logging") + cmd.Flags().BoolVarP(&options.Staging, "staging", "", false, "Install/Upgrade components from the ziti-staging repo") + cmd.Flags().StringVarP(&options.ConfigIdentity, "configIdentity", "i", "", "Which configIdentity to use") + cmd.Flags().IntVarP(&options.Timeout, "timeout", "t", 5, "Timeout for REST operations (specified in seconds)") + options.Cmd = cmd +} + func (options *CommonOptions) TimeoutContext() (context.Context, context.CancelFunc) { timeout := time.Duration(options.Timeout) * time.Second diff --git a/ziti/cmd/common_install.go b/ziti/cmd/install/common_install.go similarity index 83% rename from ziti/cmd/common_install.go rename to ziti/cmd/install/common_install.go index 243d339ae..bcc915817 100644 --- a/ziti/cmd/common_install.go +++ b/ziti/cmd/install/common_install.go @@ -14,7 +14,7 @@ limitations under the License. */ -package cmd +package install import ( "fmt" @@ -32,7 +32,7 @@ import ( ) // installRequirements installs any requirements needed to run the ziti CLI -func (o *CommonOptions) installRequirements(extraDependencies ...string) error { +func (o *InstallOptions) installRequirements(extraDependencies ...string) error { var deps []string for _, dep := range extraDependencies { @@ -42,7 +42,7 @@ func (o *CommonOptions) installRequirements(extraDependencies ...string) error { return o.installMissingDependencies(deps) } -func (o *CommonOptions) addRequiredBinary(binName string, deps []string) []string { +func (o *InstallOptions) addRequiredBinary(binName string, deps []string) []string { d := binaryShouldBeInstalled(binName) if d != "" && util.StringArrayIndex(deps, d) < 0 { deps = append(deps, d) @@ -87,7 +87,7 @@ func isBinaryInstalled(d string) bool { return false } -func (o *CommonOptions) deleteInstalledBinary(d string) bool { +func (o *InstallOptions) deleteInstalledBinary(d string) bool { binDir, err := util.BinaryLocation() if err == nil { exists, err := util.FileExists(filepath.Join(binDir, d)) @@ -103,7 +103,7 @@ func (o *CommonOptions) deleteInstalledBinary(d string) bool { return false } -func (o *CommonOptions) installMissingDependencies(deps []string) error { +func (o *InstallOptions) installMissingDependencies(deps []string) error { if len(deps) == 0 { return nil @@ -123,7 +123,7 @@ func (o *CommonOptions) installMissingDependencies(deps []string) error { return o.doInstallMissingDependencies(install) } -func (o *CommonOptions) doInstallMissingDependencies(install []string) error { +func (o *InstallOptions) doInstallMissingDependencies(install []string) error { for _, i := range install { var err error @@ -140,11 +140,11 @@ func (o *CommonOptions) doInstallMissingDependencies(install []string) error { return nil } -func (o *CommonOptions) installAWSCli() error { +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 *CommonOptions) shouldInstallBinary(binDir string, name string) (fileName string, download bool, err error) { +func (o *InstallOptions) shouldInstallBinary(binDir string, name string) (fileName string, download bool, err error) { fileName = name download = false if runtime.GOOS == "windows" { @@ -169,7 +169,7 @@ func (o *CommonOptions) shouldInstallBinary(binDir string, name string) (fileNam return } -func (o *CommonOptions) downloadFile(clientURL string, fullPath string) error { +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 { @@ -179,23 +179,23 @@ func (o *CommonOptions) downloadFile(clientURL string, fullPath string) error { return nil } -func (o *CommonOptions) getLatestZitiVersion(branch string) (semver.Version, error) { +func (o *InstallOptions) getLatestZitiVersion(branch string) (semver.Version, error) { return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, c.ZITI) } -func (o *CommonOptions) getLatestZitiAppVersion(branch string, zitiApp string) (semver.Version, error) { +func (o *InstallOptions) getLatestZitiAppVersion(branch string, zitiApp string) (semver.Version, error) { return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, zitiApp) } -func (o *CommonOptions) getLatestZitiAppVersionForBranch(branch string, zitiApp string) (semver.Version, error) { +func (o *InstallOptions) getLatestZitiAppVersionForBranch(branch string, zitiApp string) (semver.Version, error) { return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, zitiApp) } -func (o *CommonOptions) getLatestTerraformProviderVersion(branch string, provider string) (semver.Version, error) { +func (o *InstallOptions) getLatestTerraformProviderVersion(branch string, provider string) (semver.Version, error) { return util.GetLatestTerraformProviderVersionFromArtifactory(branch, provider) } -func (o *CommonOptions) getLatestGitHubReleaseVersion(zitiApp string) (semver.Version, error) { +func (o *InstallOptions) getLatestGitHubReleaseVersion(zitiApp string) (semver.Version, error) { var result semver.Version release, err := util.GetHighestVersionGitHubReleaseInfo(o.Verbose, zitiApp) if release != nil { @@ -204,11 +204,11 @@ func (o *CommonOptions) getLatestGitHubReleaseVersion(zitiApp string) (semver.Ve return result, err } -func (o *CommonOptions) getHighestVersionGitHubReleaseInfo(zitiApp string) (*util.GitHubReleasesData, error) { +func (o *InstallOptions) getHighestVersionGitHubReleaseInfo(zitiApp string) (*util.GitHubReleasesData, error) { return util.GetHighestVersionGitHubReleaseInfo(o.Verbose, zitiApp) } -func (o *CommonOptions) getCurrentZitiSnapshotList() ([]string, error) { +func (o *InstallOptions) getCurrentZitiSnapshotList() ([]string, error) { children, err := util.GetCurrentSnapshotListFromArtifactory(o.Verbose) list := make([]string, 0) @@ -222,7 +222,7 @@ func (o *CommonOptions) getCurrentZitiSnapshotList() ([]string, error) { return list, err } -func (o *CommonOptions) installZitiApp(branch string, zitiApp string, upgrade bool, version string) error { +func (o *InstallOptions) installZitiApp(branch string, zitiApp string, upgrade bool, version string) error { binDir, err := util.BinaryLocation() if err != nil { return err @@ -280,7 +280,7 @@ func (o *CommonOptions) installZitiApp(branch string, zitiApp string, upgrade bo return os.Chmod(fullPath, 0755) } -func (o *CommonOptions) installTerraformProvider(branch string, provider string, upgrade bool, version string) error { +func (o *InstallOptions) installTerraformProvider(branch string, provider string, upgrade bool, version string) error { resty.SetDebug(o.Verbose) binDir, err := util.TerraformProviderBinaryLocation() if err != nil { @@ -330,7 +330,7 @@ func (o *CommonOptions) installTerraformProvider(branch string, provider string, return os.Chmod(fileToChmod, 0755) } -func (o *CommonOptions) findVersionAndInstallGitHubRelease(zitiApp string, zitiAppGitHub string, upgrade bool, version string) error { +func (o *InstallOptions) findVersionAndInstallGitHubRelease(zitiApp string, zitiAppGitHub string, upgrade bool, version string) error { var latestVersion semver.Version var err error if version != "" { @@ -356,7 +356,7 @@ func (o *CommonOptions) findVersionAndInstallGitHubRelease(zitiApp string, zitiA return o.installGitHubRelease(zitiApp, upgrade, release) } -func (o *CommonOptions) installGitHubRelease(zitiApp string, upgrade bool, release *util.GitHubReleasesData) error { +func (o *InstallOptions) installGitHubRelease(zitiApp string, upgrade bool, release *util.GitHubReleasesData) error { binDir, err := util.BinaryLocation() if err != nil { return err diff --git a/ziti/cmd/install.go b/ziti/cmd/install/install.go similarity index 62% rename from ziti/cmd/install.go rename to ziti/cmd/install/install.go index a098b1109..1873aa1b6 100644 --- a/ziti/cmd/install.go +++ b/ziti/cmd/install/install.go @@ -14,19 +14,25 @@ limitations under the License. */ -package cmd +package install import ( + "fmt" + "github.com/openziti/ziti/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/cmd/templates" + "github.com/openziti/ziti/ziti/util" "io" + "os" + "os/exec" + "strings" "github.com/spf13/cobra" ) // InstallOptions are the flags for delete commands type InstallOptions struct { - CommonOptions + common.CommonOptions } var ( @@ -40,10 +46,26 @@ var ( `) ) +// GetCommandOutput evaluates the given command and returns the trimmed output +func (options *InstallOptions) 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 +} + // NewCmdInstall creates the command func NewCmdInstall(out io.Writer, errOut io.Writer) *cobra.Command { options := &InstallOptions{ - CommonOptions{ + common.CommonOptions{ Out: out, Err: errOut, }, @@ -62,8 +84,17 @@ func NewCmdInstall(out io.Writer, errOut io.Writer) *cobra.Command { cmdhelper.CheckErr(err) }, SuggestFor: []string{"up"}, + Hidden: true, } + cmd.AddCommand(NewCmdInstallZitiALL(out, errOut)) + + cmd.AddCommand(NewCmdInstallZitiController(out, errOut)) + cmd.AddCommand(NewCmdInstallZitiRouter(out, errOut)) + cmd.AddCommand(NewCmdInstallZitiTunnel(out, errOut)) + cmd.AddCommand(NewCmdInstallZitiEdgeTunnel(out, errOut)) + cmd.AddCommand(NewCmdInstallZitiProxC(out, errOut)) + cmd.AddCommand(NewCmdInstallTerraformProviderEdgeController(out, errOut)) options.AddCommonFlags(cmd) diff --git a/ziti/cmd/install_terraform_provider_edge_controller.go b/ziti/cmd/install/install_terraform_provider_edge_controller.go similarity index 96% rename from ziti/cmd/install_terraform_provider_edge_controller.go rename to ziti/cmd/install/install_terraform_provider_edge_controller.go index a90747874..56c7f0557 100644 --- a/ziti/cmd/install_terraform_provider_edge_controller.go +++ b/ziti/cmd/install/install_terraform_provider_edge_controller.go @@ -14,9 +14,10 @@ limitations under the License. */ -package cmd +package install import ( + "github.com/openziti/ziti/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/cmd/templates" c "github.com/openziti/ziti/ziti/constants" @@ -50,7 +51,7 @@ type InstallTerraformProviderEdgeControllerOptions struct { func NewCmdInstallTerraformProviderEdgeController(out io.Writer, errOut io.Writer) *cobra.Command { options := &InstallTerraformProviderEdgeControllerOptions{ InstallOptions: InstallOptions{ - CommonOptions: CommonOptions{ + CommonOptions: common.CommonOptions{ Out: out, Err: errOut, }, diff --git a/ziti/cmd/install/install_ziti_ALL.go b/ziti/cmd/install/install_ziti_ALL.go new file mode 100644 index 000000000..5416d7960 --- /dev/null +++ b/ziti/cmd/install/install_ziti_ALL.go @@ -0,0 +1,123 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "io" + + "github.com/blang/semver" + "github.com/openziti/ziti/common/version" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/spf13/cobra" +) + +var ( + installZitiALLLong = templates.LongDesc(` + Installs all Ziti apps that have not been installed already +`) + + installZitiALLExample = templates.Examples(` + # Install all the Ziti apps + ziti install all + `) +) + +// InstallZitiALLOptions the options for the upgrade ziti-channel command +type InstallZitiALLOptions struct { + InstallOptions + + Version string +} + +// NewCmdInstallZitiALL defines the command +func NewCmdInstallZitiALL(out io.Writer, errOut io.Writer) *cobra.Command { + options := &InstallZitiALLOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "all", + Short: "Installs all the Ziti apps that have not been installed already", + Aliases: []string{"*"}, + Long: installZitiALLLong, + Example: installZitiALLExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") + options.AddCommonFlags(cmd) + return cmd +} + +func (o *InstallZitiALLOptions) install(zitiApp string) error { + + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), zitiApp) + if err != nil { + return err + } + + if o.Version != "" { + newVersion, err = semver.Make(o.Version) + } + + log.Infoln("Attempting to install '" + zitiApp + "' version: " + newVersion.String()) + + return o.installZitiApp(version.GetBranch(), zitiApp, false, newVersion.String()) +} + +// Run implements the command +func (o *InstallZitiALLOptions) Run() error { + err := o.install(c.ZITI_CONTROLLER) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + err = o.install(c.ZITI_PROX_C) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + err = o.install(c.ZITI_ROUTER) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + err = o.install(c.ZITI_TUNNEL) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + err = o.install(c.ZITI_EDGE_TUNNEL) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + return nil +} diff --git a/ziti/cmd/install/install_ziti_controller.go b/ziti/cmd/install/install_ziti_controller.go new file mode 100644 index 000000000..fd84463cc --- /dev/null +++ b/ziti/cmd/install/install_ziti_controller.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + "io" + + "github.com/blang/semver" + "github.com/openziti/ziti/common/version" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/spf13/cobra" +) + +var ( + installZitiControllerLong = templates.LongDesc(` + Installs the Ziti Controller app if it has not been installed already +`) + + installZitiControllerExample = templates.Examples(` + # Install the Ziti Controller app + ziti install ziti-controller + `) +) + +// InstallZitiControllerOptions the options for the upgrade ziti-controller command +type InstallZitiControllerOptions struct { + InstallOptions + + Version string +} + +// NewCmdInstallZitiController defines the command +func NewCmdInstallZitiController(out io.Writer, errOut io.Writer) *cobra.Command { + options := &InstallZitiControllerOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-controller", + Short: "Installs the Ziti Controller app - if it has not been installed already", + Aliases: []string{"controller"}, + Long: installZitiControllerLong, + Example: installZitiControllerExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *InstallZitiControllerOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) + if err != nil { + return err + } + + if o.Version != "" { + newVersion, err = semver.Make(o.Version) + } + + log.Infoln("Attempting to install '" + c.ZITI_CONTROLLER + "' version: " + newVersion.String()) + + return o.installZitiApp(version.GetBranch(), c.ZITI_CONTROLLER, false, newVersion.String()) +} diff --git a/ziti/cmd/install/install_ziti_edge_tunnel.go b/ziti/cmd/install/install_ziti_edge_tunnel.go new file mode 100644 index 000000000..bf42c6143 --- /dev/null +++ b/ziti/cmd/install/install_ziti_edge_tunnel.go @@ -0,0 +1,98 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + "io" + + "github.com/blang/semver" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/spf13/cobra" +) + +var ( + installZitiEdgeTunnelLong = templates.LongDesc(` + Installs the Ziti Edge Tunnel app if it has not been installed already +`) + + installZitiEdgeTunnelExample = templates.Examples(` + # Install the Ziti Edge Tunnel app + ziti install ziti-edge-tunnel + `) +) + +// InstallZitiEdgeTunnelOptions the options for the upgrade ziti-edge-tunnel command +type InstallZitiEdgeTunnelOptions struct { + InstallOptions + + Version string +} + +// NewCmdInstallZitiEdgeTunnel defines the command +func NewCmdInstallZitiEdgeTunnel(out io.Writer, errOut io.Writer) *cobra.Command { + options := &InstallZitiEdgeTunnelOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-edge-tunnel", + Short: "Installs the Ziti Edge Tunnel app - if it has not been installed already", + Aliases: []string{"edge-tunnel"}, + Long: installZitiEdgeTunnelLong, + Example: installZitiEdgeTunnelExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *InstallOptions) installZitiEdgeTunnel(targetVersion string) error { + newVersion, err := o.getLatestGitHubReleaseVersion(c.ZITI_EDGE_TUNNEL_GITHUB) + if err != nil { + return err + } + + if targetVersion != "" { + newVersion, err = semver.Make(targetVersion) + } + + log.Infoln("Attempting to install '" + c.ZITI_EDGE_TUNNEL + "' version: " + newVersion.String()) + + return o.findVersionAndInstallGitHubRelease(c.ZITI_EDGE_TUNNEL, c.ZITI_EDGE_TUNNEL_GITHUB, false, newVersion.String()) + +} + +// Run implements the command +func (o *InstallZitiEdgeTunnelOptions) Run() error { + return o.installZitiEdgeTunnel(o.Version) +} diff --git a/ziti/cmd/install/install_ziti_prox_c.go b/ziti/cmd/install/install_ziti_prox_c.go new file mode 100644 index 000000000..50de6ff70 --- /dev/null +++ b/ziti/cmd/install/install_ziti_prox_c.go @@ -0,0 +1,98 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "io" + + "github.com/blang/semver" + "github.com/spf13/cobra" +) + +var ( + installZitiProxCLong = templates.LongDesc(` + Installs the Ziti ProxC app if it has not been installed already +`) + + installZitiProxCExample = templates.Examples(` + # Install the Ziti ProxC app + ziti install ziti-prox-c + `) +) + +// InstallZitiProxCOptions the options for the upgrade ziti-prox-c command +type InstallZitiProxCOptions struct { + InstallOptions + + Version string +} + +// NewCmdInstallZitiProxC defines the command +func NewCmdInstallZitiProxC(out io.Writer, errOut io.Writer) *cobra.Command { + options := &InstallZitiProxCOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-prox-c", + Short: "Installs the Ziti ProxC app - if it has not been installed already", + Aliases: []string{"proxc"}, + Long: installZitiProxCLong, + Example: installZitiProxCExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") + options.AddCommonFlags(cmd) + return cmd +} + +func (o *InstallOptions) installZitiProxC(targetVersion string) error { + if targetVersion != "" { + version, err := semver.Make(targetVersion) + if err != nil { + return err + } + return o.findVersionAndInstallGitHubRelease(c.ZITI_PROX_C, c.ZITI_SDK_C_GITHUB, false, version.String()) + } + + release, err := o.getHighestVersionGitHubReleaseInfo(c.ZITI_SDK_C_GITHUB) + if err != nil { + return err + } + log.Infoln("Attempting to install '" + c.ZITI_PROX_C + "' version: " + release.SemVer.String()) + return o.installGitHubRelease(c.ZITI_PROX_C, false, release) +} + +// Run implements the command +func (o *InstallZitiProxCOptions) Run() error { + return o.installZitiProxC(o.Version) +} diff --git a/ziti/cmd/install/install_ziti_router.go b/ziti/cmd/install/install_ziti_router.go new file mode 100644 index 000000000..26610adc6 --- /dev/null +++ b/ziti/cmd/install/install_ziti_router.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "io" + + "github.com/blang/semver" + "github.com/openziti/ziti/common/version" + "github.com/spf13/cobra" +) + +var ( + installZitiRouterLong = templates.LongDesc(` + Installs the Ziti Router app if it has not been installed already +`) + + installZitiRouterExample = templates.Examples(` + # Install the Ziti Router app + ziti install ziti-router + `) +) + +// InstallZitiRouterOptions the options for the upgrade ziti-router command +type InstallZitiRouterOptions struct { + InstallOptions + + Version string +} + +// NewCmdInstallZitiRouter defines the command +func NewCmdInstallZitiRouter(out io.Writer, errOut io.Writer) *cobra.Command { + options := &InstallZitiRouterOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-router", + Short: "Installs the Ziti Router app - if it has not been installed already", + Aliases: []string{"router"}, + Long: installZitiRouterLong, + Example: installZitiRouterExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *InstallZitiRouterOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_ROUTER) + if err != nil { + return err + } + + if o.Version != "" { + newVersion, err = semver.Make(o.Version) + } + + log.Infoln("Attempting to install '" + c.ZITI_ROUTER + "' version: " + newVersion.String()) + + return o.installZitiApp(version.GetBranch(), c.ZITI_ROUTER, false, newVersion.String()) +} diff --git a/ziti/cmd/install/install_ziti_tunnel.go b/ziti/cmd/install/install_ziti_tunnel.go new file mode 100644 index 000000000..809908770 --- /dev/null +++ b/ziti/cmd/install/install_ziti_tunnel.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "io" + + "github.com/blang/semver" + "github.com/openziti/ziti/common/version" + "github.com/spf13/cobra" +) + +var ( + installZitiTunnelLong = templates.LongDesc(` + Installs the Ziti Tunnel app if it has not been installed already +`) + + installZitiTunnelExample = templates.Examples(` + # Install the Ziti Tunnel app + ziti install ziti-tunnel + `) +) + +// InstallZitiTunnelOptions the options for the upgrade ziti-tunnel command +type InstallZitiTunnelOptions struct { + InstallOptions + + Version string +} + +// NewCmdInstallZitiTunnel defines the command +func NewCmdInstallZitiTunnel(out io.Writer, errOut io.Writer) *cobra.Command { + options := &InstallZitiTunnelOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-tunnel", + Short: "Installs the Ziti Tunnel app - if it has not been installed already", + Aliases: []string{"tunnel"}, + Long: installZitiTunnelLong, + Example: installZitiTunnelExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to install") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *InstallZitiTunnelOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_TUNNEL) + if err != nil { + return err + } + + if o.Version != "" { + newVersion, err = semver.Make(o.Version) + } + + log.Infoln("Attempting to install '" + c.ZITI_TUNNEL + "' version: " + newVersion.String()) + + return o.installZitiApp(version.GetBranch(), c.ZITI_TUNNEL, false, newVersion.String()) +} diff --git a/ziti/cmd/install/upgrade.go b/ziti/cmd/install/upgrade.go new file mode 100644 index 000000000..f681b93ad --- /dev/null +++ b/ziti/cmd/install/upgrade.go @@ -0,0 +1,77 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + "io" + + "github.com/spf13/cobra" +) + +// UpgradeOptions are the flags for delete commands +type UpgradeOptions struct { + common.CommonOptions +} + +var ( + upgrade_long = templates.LongDesc(` + Upgrade the Ziti platform binaries. +`) + + upgrade_example = templates.Examples(` + # upgrade the command line tool + ziti upgrade cli + `) +) + +// NewCmdUpgrade creates the command +func NewCmdUpgrade(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeOptions{ + common.CommonOptions{ + Out: out, + Err: errOut, + }, + } + + cmd := &cobra.Command{ + Use: "upgrade [flags]", + Short: "Upgrades a Ziti component/app", + Long: upgrade_long, + Example: upgrade_example, + Aliases: []string{"bump"}, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{"up"}, + Hidden: true, + } + + cmd.AddCommand(NewCmdUpgradeZiti(out, errOut)) + + return cmd +} + +// Run implements this command +func (o *UpgradeOptions) Run() error { + return o.Cmd.Help() +} diff --git a/ziti/cmd/install/upgrade_ziti.go b/ziti/cmd/install/upgrade_ziti.go new file mode 100644 index 000000000..916c835ea --- /dev/null +++ b/ziti/cmd/install/upgrade_ziti.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "io" + + "github.com/openziti/ziti/common/version" + "github.com/spf13/cobra" +) + +var ( + upgradeCLILong = templates.LongDesc(` + Upgrades the Ziti command line tools if there is a newer release +`) + + upgradeCLIExample = templates.Examples(` + # Upgrades the Ziti CLI tools + ziti upgrade cli + `) +) + +// UpgradeZitiOptions the options for the create spring command +type UpgradeZitiOptions struct { + InstallOptions + + Version string +} + +// NewCmdUpgradeZiti defines the command +func NewCmdUpgradeZiti(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeZitiOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti", + Short: "Upgrades the ziti CLI - if there is a new version available", + Aliases: []string{"z", "cli"}, + Long: upgradeCLILong, + Example: upgradeCLIExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *UpgradeZitiOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI) + if err != nil { + return err + } + + newVersionStr := newVersion.String() + + if o.Version != "" { + newVersionStr = o.Version + } + + o.deleteInstalledBinary(c.ZITI) + + return o.installZitiApp(version.GetBranch(), c.ZITI, true, newVersionStr) +} diff --git a/ziti/cmd/install/upgrade_ziti_controller.go b/ziti/cmd/install/upgrade_ziti_controller.go new file mode 100644 index 000000000..b42e3aa80 --- /dev/null +++ b/ziti/cmd/install/upgrade_ziti_controller.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + "io" + + "github.com/openziti/ziti/common/version" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/spf13/cobra" +) + +var ( + upgradeZitiControllerLong = templates.LongDesc(` + Upgrades the Ziti Controller app if there is a newer release +`) + + upgradeZitiControllerExample = templates.Examples(` + # Upgrades the Ziti Controller app + ziti upgrade ziti-controller + `) +) + +// UpgradeZitiControllerOptions the options for the upgrade ziti-controller command +type UpgradeZitiControllerOptions struct { + InstallOptions + + Version string +} + +// NewCmdUpgradeZitiController defines the command +func NewCmdUpgradeZitiController(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeZitiControllerOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-controller", + Short: "Upgrades the Ziti Controller app - if there is a new version available", + Aliases: []string{"controller", "ctrl", "zc"}, + Long: upgradeZitiControllerLong, + Example: upgradeZitiControllerExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *UpgradeZitiControllerOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) + if err != nil { + return err + } + + newVersionStr := newVersion.String() + + if o.Version != "" { + newVersionStr = o.Version + } + + o.deleteInstalledBinary(c.ZITI_CONTROLLER) + + return o.installZitiApp(version.GetBranch(), c.ZITI_CONTROLLER, true, newVersionStr) +} diff --git a/ziti/cmd/install/upgrade_ziti_edge_tunnel.go b/ziti/cmd/install/upgrade_ziti_edge_tunnel.go new file mode 100644 index 000000000..0bd73af45 --- /dev/null +++ b/ziti/cmd/install/upgrade_ziti_edge_tunnel.go @@ -0,0 +1,92 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + "io" + + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/spf13/cobra" +) + +var ( + upgradeZitiEdgeTunnelLong = templates.LongDesc(` + Upgrades the Ziti Edge Tunnel app if there is a newer release +`) + + upgradeZitiEdgeTunnelExample = templates.Examples(` + # Upgrades the Ziti Edge Tunnel app + ziti upgrade ziti-edge-tunnel + `) +) + +// UpgradeZitiEdgeTunnelOptions the options for the upgrade ziti-edge-tunnel command +type UpgradeZitiEdgeTunnelOptions struct { + InstallOptions + + Version string +} + +// NewCmdUpgradeZitiEdgeTunnel defines the command +func NewCmdUpgradeZitiEdgeTunnel(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeZitiEdgeTunnelOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-edge-tunnel", + Short: "Upgrades the Ziti Edge Tunnel app - if there is a new version available", + Aliases: []string{"edge-tunnel", "et"}, + Long: upgradeZitiEdgeTunnelLong, + Example: upgradeZitiEdgeTunnelExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *UpgradeZitiEdgeTunnelOptions) Run() error { + newVersion, err := o.getLatestGitHubReleaseVersion(c.ZITI_EDGE_TUNNEL_GITHUB) + if err != nil { + return err + } + + newVersionStr := newVersion.String() + + if o.Version != "" { + newVersionStr = o.Version + } + + o.deleteInstalledBinary(c.ZITI_EDGE_TUNNEL) + + return o.findVersionAndInstallGitHubRelease(c.ZITI_EDGE_TUNNEL, c.ZITI_EDGE_TUNNEL_GITHUB, true, newVersionStr) +} diff --git a/ziti/cmd/install/upgrade_ziti_prox_c.go b/ziti/cmd/install/upgrade_ziti_prox_c.go new file mode 100644 index 000000000..db6ae533f --- /dev/null +++ b/ziti/cmd/install/upgrade_ziti_prox_c.go @@ -0,0 +1,92 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + "io" + + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/spf13/cobra" +) + +var ( + upgradeZitiProxCLong = templates.LongDesc(` + Upgrades the Ziti ProxC app if there is a newer release +`) + + upgradeZitiProxCExample = templates.Examples(` + # Upgrades the Ziti ProxC app + ziti upgrade ziti-prox-c + `) +) + +// UpgradeZitiProxCOptions the options for the upgrade ziti-prox-c command +type UpgradeZitiProxCOptions struct { + InstallOptions + + Version string +} + +// NewCmdUpgradeZitiProxC defines the command +func NewCmdUpgradeZitiProxC(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeZitiProxCOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-prox-c", + Short: "Upgrades the Ziti ProxC app - if there is a new version available", + Aliases: []string{"proxc"}, + Long: upgradeZitiProxCLong, + Example: upgradeZitiProxCExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *UpgradeZitiProxCOptions) Run() error { + newVersion, err := o.getLatestGitHubReleaseVersion(c.ZITI_SDK_C_GITHUB) + if err != nil { + return err + } + + newVersionStr := newVersion.String() + + if o.Version != "" { + newVersionStr = o.Version + } + + o.deleteInstalledBinary(c.ZITI_PROX_C) + + return o.findVersionAndInstallGitHubRelease(c.ZITI_PROX_C, c.ZITI_SDK_C_GITHUB, true, newVersionStr) +} diff --git a/ziti/cmd/install/upgrade_ziti_router.go b/ziti/cmd/install/upgrade_ziti_router.go new file mode 100644 index 000000000..43aaabfc3 --- /dev/null +++ b/ziti/cmd/install/upgrade_ziti_router.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + "io" + + "github.com/openziti/ziti/common/version" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/spf13/cobra" +) + +var ( + upgradeZitiRouterLong = templates.LongDesc(` + Upgrades the Ziti Router app if there is a newer release +`) + + upgradeZitiRouterExample = templates.Examples(` + # Upgrades the Ziti Router app + ziti upgrade ziti-router + `) +) + +// UpgradeZitiRouterOptions the options for the upgrade ziti-router command +type UpgradeZitiRouterOptions struct { + InstallOptions + + Version string +} + +// NewCmdUpgradeZitiRouter defines the command +func NewCmdUpgradeZitiRouter(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeZitiRouterOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-router", + Short: "Upgrades the Ziti Router app - if there is a new version available", + Aliases: []string{"router", "rtr", "r"}, + Long: upgradeZitiRouterLong, + Example: upgradeZitiRouterExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *UpgradeZitiRouterOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_ROUTER) + if err != nil { + return err + } + + newVersionStr := newVersion.String() + + if o.Version != "" { + newVersionStr = o.Version + } + + o.deleteInstalledBinary(c.ZITI_ROUTER) + + return o.installZitiApp(version.GetBranch(), c.ZITI_ROUTER, true, newVersionStr) +} diff --git a/ziti/cmd/install/upgrade_ziti_tunnel.go b/ziti/cmd/install/upgrade_ziti_tunnel.go new file mode 100644 index 000000000..6cd16cc35 --- /dev/null +++ b/ziti/cmd/install/upgrade_ziti_tunnel.go @@ -0,0 +1,93 @@ +/* + 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 install + +import ( + "github.com/openziti/ziti/ziti/cmd/common" + "io" + + "github.com/openziti/ziti/common/version" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/cmd/templates" + c "github.com/openziti/ziti/ziti/constants" + "github.com/spf13/cobra" +) + +var ( + upgradeZitiTunnelLong = templates.LongDesc(` + Upgrades the Ziti Tunnel app if there is a newer release +`) + + upgradeZitiTunnelExample = templates.Examples(` + # Upgrades the Ziti Tunnel app + ziti upgrade ziti-tunnel + `) +) + +// UpgradeZitiTunnelOptions the options for the upgrade ziti-tunnel command +type UpgradeZitiTunnelOptions struct { + InstallOptions + + Version string +} + +// NewCmdUpgradeZitiTunnel defines the command +func NewCmdUpgradeZitiTunnel(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UpgradeZitiTunnelOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "ziti-tunnel", + Short: "Upgrades the Ziti Tunnel app - if there is a new version available", + Aliases: []string{"tunnel", "rtr", "r"}, + Long: upgradeZitiTunnelLong, + Example: upgradeZitiTunnelExample, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + } + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to upgrade to") + options.AddCommonFlags(cmd) + return cmd +} + +// Run implements the command +func (o *UpgradeZitiTunnelOptions) Run() error { + newVersion, err := o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_TUNNEL) + if err != nil { + return err + } + + newVersionStr := newVersion.String() + + if o.Version != "" { + newVersionStr = o.Version + } + + o.deleteInstalledBinary(c.ZITI_TUNNEL) + + return o.installZitiApp(version.GetBranch(), c.ZITI_TUNNEL, true, newVersionStr) +} diff --git a/ziti/cmd/install/use.go b/ziti/cmd/install/use.go new file mode 100644 index 000000000..ce14bde86 --- /dev/null +++ b/ziti/cmd/install/use.go @@ -0,0 +1,155 @@ +/* + 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 install + +import ( + "fmt" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/internal/log" + "github.com/openziti/ziti/ziti/util" + "io" + + "github.com/blang/semver" + "github.com/openziti/ziti/common/version" + "github.com/spf13/cobra" +) + +// UseOptions are the flags for delete commands +type UseOptions struct { + InstallOptions + + Version string + Branch string +} + +// NewCmdUse creates the command +func NewCmdUse(out io.Writer, errOut io.Writer) *cobra.Command { + options := &UseOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "use [branch]", + Short: "switch between branches of Ziti", + Long: ` +'ziti use' fetches the list of currently available branch-build names from artifactory, +presents them in a chooser-list, and once one is selected, will switch the current 'ziti' binary for the +chosen one. This is useful for swapping between different feature branches, or back and forth from a release +build to a feature-branch build. +`, + Aliases: []string{}, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{}, + Hidden: true, + } + + cmd.Flags().StringVarP(&options.Version, "version", "v", "", "The specific version to use") + cmd.Flags().BoolVarP(&options.Verbose, "verbose", "", false, "Enable verbose logging") + cmd.Flags().StringVarP(&options.Branch, "branch", "b", "", "Name of branch to switch to") + cmd.Flags().BoolVarP(&options.Staging, "staging", "", false, "Install/Upgrade components from the ziti-staging repo") + + return cmd +} + +func (o *UseOptions) install(branch string, zitiApp string) error { + newVersion, err := o.getLatestZitiAppVersionForBranch(branch, zitiApp) + if err != nil { + log.Infoln("Attempt to fetch latest version of '" + zitiApp + "' for branch '" + branch + "' failed: " + err.Error()) + + // Special-case branch fallback (to master) when dealing with ziti-prox-c + if zitiApp == c.ZITI_PROX_C || zitiApp == c.ZITI_EDGE_TUNNEL { + branch = "master" + newVersion, err = o.getLatestZitiAppVersionForBranch(branch, zitiApp) + if err != nil { + return err + } + } else { + return err + } + } + + if o.Version != "" { + newVersion, err = semver.Make(o.Version) + } + + log.Infoln("Attempting to install '" + zitiApp + "' version: " + newVersion.String() + " from branch '" + branch + "'") + + return o.installZitiApp(branch, zitiApp, true, newVersion.String()) +} + +// Run implements the command +func (o *UseOptions) Run() error { + + fmt.Println("Current source branch is: ", version.GetBranch()) + + branch := o.Branch + if branch == "" { + list, err := o.getCurrentZitiSnapshotList() + branch, err = util.PickName(list, "Which Branch would you like to switch to: ") + if err != nil { + return err + } + } + + if o.Staging { + if o.Branch != "main" { + log.Errorf("Error: --staging can only be used with --branch of 'main'. You specified '%s'", branch) + return nil + } + } + + err := o.install(branch, c.ZITI) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + err = o.install(branch, c.ZITI_CONTROLLER) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + err = o.install(branch, c.ZITI_ROUTER) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + err = o.install(branch, c.ZITI_TUNNEL) + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + err = o.installZitiProxC("") + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + err = o.installZitiEdgeTunnel("") + if err != nil { + log.Errorf("Error: install failed %s \n", err.Error()) + } + + return nil +} diff --git a/ziti/cmd/install/version.go b/ziti/cmd/install/version.go new file mode 100644 index 000000000..1c46ecdca --- /dev/null +++ b/ziti/cmd/install/version.go @@ -0,0 +1,263 @@ +/* + 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 install + +import ( + "fmt" + "github.com/blang/semver" + "github.com/openziti/ziti/ziti/cmd/common" + "github.com/openziti/ziti/ziti/cmd/table" + "github.com/openziti/ziti/ziti/internal/log" + "io" + "os" + + "github.com/openziti/ziti/common/version" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + c "github.com/openziti/ziti/ziti/constants" + "github.com/openziti/ziti/ziti/util" + + "github.com/spf13/cobra" +) + +type VersionOptions struct { + InstallOptions + + Container string + NoVersionCheck bool +} + +func NewCmdVersion(out io.Writer, errOut io.Writer) *cobra.Command { + options := &VersionOptions{ + InstallOptions: InstallOptions{ + CommonOptions: common.CommonOptions{ + Out: out, + Err: errOut, + }, + }, + } + + cmd := &cobra.Command{ + Use: "version", + Short: "Print the version information", + Aliases: []string{"ver", "v"}, + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := options.Run() + cmdhelper.CheckErr(err) + }, + Hidden: true, + } + options.AddCommonFlags(cmd) + + cmd.Flags().BoolVarP(&options.NoVersionCheck, "no-update", "n", false, + "disable update check") + + return cmd +} + +// Run ... +func (o *VersionOptions) Run() error { + + util.ConfigDir() + + info := util.ColorInfo + + t := table.CreateTable(os.Stdout) + t.AddRow("NAME", "VERSION") + + t.AddRow(c.ZITI, info(version.GetBuildMetadata(o.Verbose))) + + o.versionPrintZitiApp(c.ZITI_CONTROLLER, &t) + o.versionPrintZitiApp(c.ZITI_PROX_C, &t) + o.versionPrintZitiApp(c.ZITI_ROUTER, &t) + o.versionPrintZitiApp(c.ZITI_TUNNEL, &t) + o.versionPrintZitiApp(c.ZITI_EDGE_TUNNEL, &t) + + t.Render() + + if !o.NoVersionCheck && !o.Verbose { + return o.versionCheck() + } + + return nil +} + +func (o *VersionOptions) getVersionFromZitiApp(zitiApp string, versionArg string) (string, error) { + if o.Verbose { + return o.GetCommandOutput("", zitiApp, versionArg, "--verbose") + } + return o.GetCommandOutput("", zitiApp, versionArg) +} + +func (o *VersionOptions) getVersionFromZitiAppMultiArg(zitiApp string) (string, error) { + var varsionArg string + if zitiApp == c.ZITI { + varsionArg = "--version" + } else { + varsionArg = "version" + } + return o.getVersionFromZitiApp(zitiApp, varsionArg) +} + +func (o *VersionOptions) versionPrintZitiApp(zitiApp string, table *table.Table) { + output, err := o.getVersionFromZitiAppMultiArg(zitiApp) + if err == nil { + table.AddRow(zitiApp, util.ColorInfo(output)) + } else { + if !isBinaryInstalled(zitiApp) { + table.AddRow(zitiApp, util.ColorWarning("not installed")) + } + } +} + +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) + return nil +} + +func (o *VersionOptions) versionCheckZitiApp(zitiApp string) error { + var currentVersion semver.Version + var newVersion semver.Version + var err error + + if !isBinaryInstalled(zitiApp) { + return nil + } + + switch zitiApp { + case c.ZITI: + newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI) + case c.ZITI_CONTROLLER: + newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_CONTROLLER) + case c.ZITI_PROX_C: + newVersion, err = o.getLatestGitHubReleaseVersion(c.ZITI_SDK_C_GITHUB) + case c.ZITI_ROUTER: + newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_ROUTER) + case c.ZITI_TUNNEL: + newVersion, err = o.getLatestZitiAppVersion(version.GetBranch(), c.ZITI_TUNNEL) + case c.ZITI_EDGE_TUNNEL: + newVersion, err = o.getLatestGitHubReleaseVersion(c.ZITI_EDGE_TUNNEL_GITHUB) + default: + return nil + } + if err != nil { + return err + } + + app := util.ColorInfo(zitiApp) + output, err := o.getVersionFromZitiAppMultiArg(zitiApp) + if err != nil { + log.Warnf("\nAn err occurred: %s", err) + } else { + currentVersion, err = semver.ParseTolerant(output) + if err != nil { + log.Warnf("Failed to get %s version: %s\n", zitiApp, err) + return err + } + if newVersion.GT(currentVersion) { + log.Warnf("\nA new %s version is available: %s\n", app, util.ColorInfo(newVersion.String())) + + if o.BatchMode { + log.Warnf("To upgrade to this new version use: %s\n", util.ColorInfo("ziti upgrade "+zitiApp)) + } else { + message := fmt.Sprintf("Would you like to upgrade to the new %s version?", app) + if util.Confirm(message, true, "Please indicate if you would like to upgrade the binary version.") { + switch zitiApp { + case c.ZITI: + err = o.upgradeZiti() + case c.ZITI_CONTROLLER: + err = o.upgradeZitiController() + case c.ZITI_PROX_C: + err = o.upgradeZitiProxC() + case c.ZITI_ROUTER: + err = o.upgradeZitiRouter() + case c.ZITI_TUNNEL: + err = o.upgradeZitiTunnel() + case c.ZITI_EDGE_TUNNEL: + err = o.upgradeZitiEdgeTunnel() + default: + } + if err != nil { + return err + } + } + } + } + } + + return nil +} + +func (o *VersionOptions) upgradeZiti() error { + options := &UpgradeZitiOptions{ + InstallOptions: InstallOptions{ + CommonOptions: o.CommonOptions, + }, + } + return options.Run() +} + +func (o *VersionOptions) upgradeZitiController() error { + options := &UpgradeZitiControllerOptions{ + InstallOptions: InstallOptions{ + CommonOptions: o.CommonOptions, + }, + } + return options.Run() +} + +func (o *VersionOptions) upgradeZitiProxC() error { + options := &UpgradeZitiProxCOptions{ + InstallOptions: InstallOptions{ + CommonOptions: o.CommonOptions, + }, + } + return options.Run() +} + +func (o *VersionOptions) upgradeZitiRouter() error { + options := &UpgradeZitiRouterOptions{ + InstallOptions: InstallOptions{ + CommonOptions: o.CommonOptions, + }, + } + return options.Run() +} + +func (o *VersionOptions) upgradeZitiTunnel() error { + options := &UpgradeZitiTunnelOptions{ + InstallOptions: InstallOptions{ + CommonOptions: o.CommonOptions, + }, + } + return options.Run() +} + +func (o *VersionOptions) upgradeZitiEdgeTunnel() error { + options := &UpgradeZitiEdgeTunnelOptions{ + InstallOptions: InstallOptions{ + CommonOptions: o.CommonOptions, + }, + } + return options.Run() +} From 9e0bae07ee8cc9f2a993ac99f19626caeb8aa7c4 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 15 Nov 2022 16:16:12 -0500 Subject: [PATCH 15/46] Added port check to quickstart Added ability to set listener bind port Added tests for new port variable Fixed bug in quickstart test Fixed typo in quickstart test fixed bug in quickstart env file test closes #706 Signed-off-by: gberl002 --- CHANGELOG.md | 8 +++ go.mod | 11 ++++ go.sum | 24 ++++++++- quickstart/docker/image/Dockerfile | 2 +- quickstart/docker/image/run-with-ziti-cli.sh | 2 +- quickstart/docker/image/ziti-cli-functions.sh | 49 ++++++++++++++++- quickstart/test/quickstart_test.go | 22 ++++++-- ziti/cmd/ziti/cmd/config_templates/router.yml | 4 +- ziti/cmd/ziti/cmd/create_config.go | 17 +++--- .../cmd/ziti/cmd/create_config_environment.go | 3 ++ .../cmd/create_config_router_edge_test.go | 54 +++++++++++++++++-- .../cmd/create_config_router_fabric_test.go | 54 +++++++++++++++++-- ziti/cmd/ziti/cmd/create_config_test.go | 1 + ziti/cmd/ziti/cmd/helpers/env_helpers.go | 4 ++ ziti/cmd/ziti/constants/constants.go | 6 ++- 15 files changed, 235 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0562deef..3df694d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# Release 0.26.12 + +## What's New + +- Ziti CLI + - Enhancements: + - [Issue-706](https://github.com/openziti/ziti/issues/706) - Add port check to quickstart + # Release 0.26.11 ## What's New diff --git a/go.mod b/go.mod index 8a898bcc8..dfda598bc 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Jeffail/gabs/v2 v2.6.1 github.com/MakeNowJust/heredoc v1.0.0 github.com/blang/semver v3.5.1+incompatible + github.com/docker/docker v20.10.21+incompatible github.com/fatih/color v1.13.0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-acme/lego/v4 v4.2.0 @@ -56,6 +57,7 @@ require ( github.com/AppsFlyer/go-sundheit v0.5.0 // indirect github.com/MichaelMure/go-term-markdown v0.1.4 // indirect github.com/MichaelMure/go-term-text v0.3.1 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect @@ -66,11 +68,14 @@ require ( github.com/c-bata/go-prompt v0.2.6 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/coreos/go-iptables v0.6.0 // indirect + github.com/creack/pty v1.1.11 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 // indirect github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect github.com/disintegration/imaging v1.6.2 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/ef-ds/deque v1.0.4 // indirect github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect @@ -87,6 +92,7 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/validate v0.22.0 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c // indirect github.com/google/uuid v1.3.0 // indirect @@ -124,9 +130,13 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/netfoundry/secretstream v0.1.2 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.2 // indirect @@ -168,4 +178,5 @@ require ( google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect + gotest.tools/v3 v3.4.0 // indirect ) diff --git a/go.sum b/go.sum index 5e93949c0..efe5c09f9 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.5.0/go.mod h1:9HLKlQjVBH6U3oDfsXOeVc56THsLPw1L03yban4xThw= github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= @@ -75,6 +76,8 @@ github.com/MichaelMure/go-term-markdown v0.1.4 h1:Ir3kBXDUtOX7dEv0EaQV8CNPpH+T7A github.com/MichaelMure/go-term-markdown v0.1.4/go.mod h1:EhcA3+pKYnlUsxYKBJ5Sn1cTQmmBMjeNlpV8nRb+JxA= github.com/MichaelMure/go-term-text v0.3.1 h1:Kw9kZanyZWiCHOYu9v/8pWEgDQ6UVN9/ix2Vd2zzWf0= github.com/MichaelMure/go-term-text v0.3.1/go.mod h1:QgVjAEDUnRMlzpS6ky5CGblux7ebeiLnuy9dAaFZu8o= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -168,8 +171,9 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -190,6 +194,12 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= +github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -318,6 +328,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= @@ -631,11 +642,15 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c h1:RC8WMpjonrBfyAh6VN/POIPtYD5tRAq0qMqCRjQNK+g= +github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c/go.mod h1:9OcmHNQQUTbk4XCffrLgN1NEKc2mh5u++biHVrvHsSU= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -667,6 +682,10 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= @@ -1229,6 +1248,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1467,6 +1487,8 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/quickstart/docker/image/Dockerfile b/quickstart/docker/image/Dockerfile index a7cb29c30..609f6bd77 100644 --- a/quickstart/docker/image/Dockerfile +++ b/quickstart/docker/image/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:rolling RUN apt update && \ - apt install jq curl netcat-openbsd vim inetutils-ping net-tools -y + apt install jq curl netcat-openbsd vim inetutils-ping net-tools lsof -y RUN useradd -ms /bin/bash ziti && \ mkdir /openziti && chown ziti:ziti /openziti && \ diff --git a/quickstart/docker/image/run-with-ziti-cli.sh b/quickstart/docker/image/run-with-ziti-cli.sh index 301848917..13f83d232 100755 --- a/quickstart/docker/image/run-with-ziti-cli.sh +++ b/quickstart/docker/image/run-with-ziti-cli.sh @@ -29,7 +29,7 @@ if [[ -f "${initFile}" ]]; then fi # give the controller scripts time to start and create the ziti environment file if running in docker compose -until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 1; done +until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 2; done . "${ZITI_SCRIPTS}/ziti-cli-functions.sh" diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index e2e158f35..050e50ed3 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -279,6 +279,36 @@ function checkPrereqs { fi } +function _portCheck { + if [[ "${1-}" == "" ]] || [[ "${2-}" == "" ]]; then + echo -e "_portCheck Usage: _portCheck " + return 0 + fi + + envVar="${1-}" + if [[ -n "$ZSH_VERSION" ]]; then + envVarValue="${(P)envVar}" + elif [[ -n "$BASH_VERSION" ]]; then + envVarValue="${!envVar}" + else + echo -e "Unknown/Unsupported shell, cannot check port status" + return 1 + fi + + portCheckResult=$(lsof -w -i :"${envVarValue}" 2> /dev/null) + if [[ "${portCheckResult}" != "" ]]; then # Controller management plane + echo -e "$(RED " ")" + echo -e "$(RED "The intended ${2-} port (${envVarValue}) is currently being used, the process using this port should be closed or the port value should be changed.")" + echo -e "$(RED "To use a different port, set the port value in ${envVar}")" + echo -e "$(RED " ")" + echo -e "$(RED "Example:")" + echo -e "$(RED "export ${envVar}=1234")" + echo -e "$(RED " ")" + return 1 + fi + return 0 +} + function checkControllerName { if [[ "${ZITI_EDGE_CONTROLLER_HOSTNAME}" == *['!'@#\$%^\&*\(\)_+]* ]]; then echo -e "$(RED " - The provided Network name contains an invalid character: '!'@#\$%^\&*()_+")" @@ -359,6 +389,7 @@ function generateEnvFile { if [[ "${ZITI_CONTROLLER_RAWNAME-}" == "" ]]; then export ZITI_CONTROLLER_RAWNAME="${ZITI_NETWORK-}"; fi if [[ "${ZITI_CONTROLLER_HOSTNAME-}" == "" ]]; then export export ZITI_CONTROLLER_HOSTNAME="${ZITI_CONTROLLER_RAWNAME}"; fi if [[ "${ZITI_CTRL_PORT-}" == "" ]]; then export ZITI_CTRL_PORT="6262"; fi + if [[ "${ZITI_EDGE_ROUTER_PORT-}" == "" ]]; then export ZITI_EDGE_ROUTER_PORT="3022"; fi if [[ "${ZITI_EDGE_CONTROLLER_RAWNAME-}" == "" ]]; then export export ZITI_EDGE_CONTROLLER_RAWNAME="${ZITI_NETWORK-}"; fi if [[ "${ZITI_EDGE_CONTROLLER_HOSTNAME-}" == "" ]]; then export export ZITI_EDGE_CONTROLLER_HOSTNAME="${ZITI_EDGE_CONTROLLER_RAWNAME}"; fi @@ -468,6 +499,21 @@ function ziti_expressConfiguration { echo "Exiting as env file was not generated" return 1 fi + + # Check Ports + returnCnt=0 + _portCheck "ZITI_CTRL_PORT" "Controller" + returnCnt=$((returnCnt + $?)) + _portCheck "ZITI_EDGE_ROUTER_PORT" "Edge Router" + returnCnt=$((returnCnt + $?)) + _portCheck "ZITI_EDGE_CONTROLLER_PORT" "Edge Controller" + returnCnt=$((returnCnt + $?)) + _portcheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" + returnCnt=$((returnCnt + $?)) + _portcheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" + returnCnt=$((returnCnt + $?)) + if [[ "returnCnt" -gt "0" ]]; then return 1; fi + #checkHostsFile echo " " @@ -1039,7 +1085,8 @@ function ziti_createEnvFile { export ZITI_BIN_ROOT="${ZITI_HOME}/ziti-bin" - if [[ "${ZITI_CTRL_MGMT_HOST_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_HOST_PORT="${ZITI_CONTROLLER_HOSTNAME}:10000"; fi + if [[ "${ZITI_CTRL_MGMT_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_PORT="10000"; fi + if [[ "${ZITI_CTRL_MGMT_HOST_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_HOST_PORT="${ZITI_CONTROLLER_HOSTNAME}:${ZITI_CTRL_MGMT_PORT}"; fi if [[ "${ZITI_CTRL_IDENTITY_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-client.cert"; fi if [[ "${ZITI_CTRL_IDENTITY_SERVER_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-server.chain.pem"; fi if [[ "${ZITI_CTRL_IDENTITY_KEY-}" == "" ]]; then export ZITI_CTRL_IDENTITY_KEY="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/keys/${ZITI_CONTROLLER_HOSTNAME}-server.key"; fi diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index 1fe747c81..05bf77b5b 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -78,6 +78,7 @@ func buildDockerQuickstartTestImage() { defer tw.Close() dockerFile := "TestDockerfile" + imageNameAndTag := "openziti/quickstart:test" filePaths := iterateDir(dir) @@ -99,7 +100,7 @@ func buildDockerQuickstartTestImage() { Context: dockerFileTarReader, Dockerfile: dockerFile, Remove: true, - Tags: []string{"openziti/quickstart:test"}, + Tags: []string{imageNameAndTag}, }) if err != nil { fmt.Println(err) @@ -107,6 +108,20 @@ func buildDockerQuickstartTestImage() { } defer imageBuildResponse.Body.Close() + // Wait until the image finishes building (builds in a background thread) + for { + fmt.Println("Waiting for image build...") + output, err := exec.Command("docker", "images", "-q", imageNameAndTag).Output() + if err != nil { + fmt.Println(err) + } + if string(output) != "" { + fmt.Println("Build complete, continuing with test") + break + } + time.Sleep(5 * time.Second) + } + danglers := filters.NewArgs() danglers.Add("dangling", "true") results, err := cli.ImageList(ctx, types.ImageListOptions{ @@ -224,7 +239,7 @@ func TestQuickStartEnvFile(t *testing.T) { // Wait until it finishes for { - time.Sleep(1) + time.Sleep(1 * time.Second) output, _ := exec.Command("docker", "inspect", "-f", "{{.State.Running}}", containerId).Output() if string(output) == "false\n" { break @@ -299,6 +314,7 @@ func TestSimpleWebService(t *testing.T) { bindHostAddress := "web-test-blue" bindHostPort := 8000 serviceName := "basic.web.smoke.test.service" + wd, _ := os.Getwd() waitForController(ctrlAddress) // Give routers time to enroll themselves time.Sleep(5 * time.Second) @@ -376,7 +392,7 @@ func TestSimpleWebService(t *testing.T) { fmt.Println("Unable to detect a terminator for the edge router") } helloUrl := fmt.Sprintf("http://%s:%d", serviceName, dialPort) - httpClient := createZitifiedHttpClient("/Users/geoffberl/git/NetFoundry/ziti/quickstart/" + testerUsername + ".json") + httpClient := createZitifiedHttpClient(wd + "/" + testerUsername + ".json") resp, e := httpClient.Get(helloUrl) if e != nil { panic(e) diff --git a/ziti/cmd/ziti/cmd/config_templates/router.yml b/ziti/cmd/ziti/cmd/config_templates/router.yml index a487968a4..da216eba7 100644 --- a/ziti/cmd/ziti/cmd/config_templates/router.yml +++ b/ziti/cmd/ziti/cmd/config_templates/router.yml @@ -20,8 +20,8 @@ link: - binding: transport {{ if .Router.IsPrivate }}#{{ end }} listeners: {{ if .Router.IsPrivate }}#{{ end }} - binding: transport -{{ if .Router.IsPrivate }}#{{ end }} bind: tls:0.0.0.0:{{ .Router.Listener.BindPort }} -{{ if .Router.IsPrivate }}#{{ end }} advertise: tls:{{ .Router.Edge.AdvertisedHost }}:{{ .Router.Listener.BindPort }} +{{ if .Router.IsPrivate }}#{{ end }} bind: tls:0.0.0.0:{{ .Router.Edge.ListenerBindPort }} +{{ if .Router.IsPrivate }}#{{ end }} advertise: tls:{{ .Router.Edge.AdvertisedHost }}:{{ .Router.Edge.ListenerBindPort }} {{ if .Router.IsPrivate }}#{{ end }} options: {{ if .Router.IsPrivate }}#{{ end }} outQueueSize: {{ .Router.Listener.OutQueueSize }} diff --git a/ziti/cmd/ziti/cmd/create_config.go b/ziti/cmd/ziti/cmd/create_config.go index 77f0bda76..eb40ce014 100644 --- a/ziti/cmd/ziti/cmd/create_config.go +++ b/ziti/cmd/ziti/cmd/create_config.go @@ -132,11 +132,12 @@ type RouterTemplateValues struct { } type EdgeRouterTemplateValues struct { - Hostname string - Port string - IPOverride string - AdvertisedHost string - LanInterface string + Hostname string + Port string + IPOverride string + AdvertisedHost string + LanInterface string + ListenerBindPort string } type WSSRouterTemplateValues struct { @@ -162,7 +163,6 @@ type RouterForwarderTemplateValues struct { type RouterListenerTemplateValues struct { ConnectTimeout time.Duration GetSessionTimeout time.Duration - BindPort int OutQueueSize int } @@ -256,6 +256,9 @@ func (data *ConfigTemplateValues) populateEnvVars() { zitiEdgeRouterEnrollmentDuration, err := cmdhelper.GetZitiEdgeRouterEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeRouterEnrollmentDurationVarName) + zitiEdgeRouterListenerBindPort, err := cmdhelper.GetZitiEdgeRouterListenerBindPort() + handleVariableError(err, constants.ZitiEdgeRouterListenerBindPortVarName) + data.ZitiHome = zitiHome data.Hostname = hostname data.Controller.Name = zitiCtrlHostname @@ -265,6 +268,7 @@ func (data *ConfigTemplateValues) populateEnvVars() { data.Controller.Edge.ListenerHostPort = zitiEdgeCtrlListenerHostPort data.Controller.Edge.AdvertisedHostPort = zitiEdgeCtrlAdvertisedHostPort data.Router.Edge.Port = zitiEdgeRouterPort + data.Router.Edge.ListenerBindPort = zitiEdgeRouterListenerBindPort data.Controller.Edge.AdvertisedPort = zitiEdgeCtrlAdvertisedPort data.Controller.EdgeIdentityDuration = zitiEdgeIdentityEnrollmentDuration data.Controller.EdgeRouterDuration = zitiEdgeRouterEnrollmentDuration @@ -273,7 +277,6 @@ func (data *ConfigTemplateValues) populateEnvVars() { } func (data *ConfigTemplateValues) populateDefaults() { - data.Router.Listener.BindPort = constants.DefaultListenerBindPort data.Router.Listener.GetSessionTimeout = constants.DefaultGetSessionTimeout data.Controller.MinQueuedConnects = channel.MinQueuedConnects diff --git a/ziti/cmd/ziti/cmd/create_config_environment.go b/ziti/cmd/ziti/cmd/create_config_environment.go index d6a996d1d..9b0a65c5c 100644 --- a/ziti/cmd/ziti/cmd/create_config_environment.go +++ b/ziti/cmd/ziti/cmd/create_config_environment.go @@ -98,6 +98,7 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { {constants.ZitiCtrlPortVarName, constants.ZitiCtrlPortVarDescription, data.Controller.Port}, {constants.ZitiEdgeRouterRawNameVarName, constants.ZitiEdgeRouterRawNameVarDescription, data.Router.Edge.Hostname}, {constants.ZitiEdgeRouterPortVarName, constants.ZitiEdgeRouterPortVarDescription, data.Router.Edge.Port}, + {constants.ZitiEdgeRouterListenerBindPortVarName, constants.ZitiEdgeRouterListenerBindPortVarDescription, data.Router.Edge.ListenerBindPort}, {constants.ZitiEdgeCtrlIdentityCertVarName, constants.ZitiEdgeCtrlIdentityCertVarDescription, data.Controller.Edge.IdentityCert}, {constants.ZitiEdgeCtrlIdentityServerCertVarName, constants.ZitiEdgeCtrlIdentityServerCertVarDescription, data.Controller.Edge.IdentityServerCert}, {constants.ZitiEdgeCtrlIdentityKeyVarName, constants.ZitiEdgeCtrlIdentityKeyVarDescription, data.Controller.Edge.IdentityKey}, @@ -185,6 +186,7 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { "%-40s %-50s %s\n"+ "%-40s %-50s %s\n"+ "%-40s %-50s %s\n"+ + "%-40s %-50s %s\n"+ "%-40s %-50s %s", constants.ZitiHomeVarName, constants.ZitiHomeVarDescription, data.ZitiHome, constants.ZitiCtrlPortVarName, constants.ZitiCtrlPortVarDescription, data.Controller.Port, @@ -196,6 +198,7 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { constants.ZitiEdgeCtrlAdvertisedPortVarName, constants.ZitiEdgeCtrlAdvertisedPortVarDescription, data.Controller.Edge.AdvertisedPort, constants.ZitiEdgeRouterRawNameVarName, constants.ZitiEdgeRouterRawNameVarDescription, data.Router.Edge.Hostname, constants.ZitiEdgeRouterPortVarName, constants.ZitiEdgeRouterPortVarDescription, data.Router.Edge.Port, + constants.ZitiEdgeRouterListenerBindPortVarName, constants.ZitiEdgeRouterListenerBindPortVarDescription, data.Router.Edge.ListenerBindPort, constants.ZitiRouterIdentityCertVarName, constants.ZitiRouterIdentityCertVarDescription, data.Router.IdentityCert, constants.ZitiRouterIdentityServerCertVarName, constants.ZitiRouterIdentityServerCertVarDescription, data.Router.IdentityServerCert, constants.ZitiRouterIdentityKeyVarName, constants.ZitiRouterIdentityKeyVarDescription, data.Router.IdentityKey, diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go index bebf5d2a4..2340771ab 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go @@ -4,6 +4,7 @@ import ( "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/stretchr/testify/assert" "os" + "strings" "testing" "time" ) @@ -189,6 +190,51 @@ func TestBlankEdgeRouterNameBecomesHostname(t *testing.T) { } +func TestDefaultZitiEdgeRouterListenerBindPort(t *testing.T) { + expectedDefaultPort := "10080" + + // Make sure the related env vars are unset + _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") + + // Create and run the CLI command + config := createRouterConfig([]string{"edge", "--routerName", "testRouter"}) + + // Check that the template data has been updated as expected + assert.Equal(t, expectedDefaultPort, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} + +func TestSetZitiEdgeRouterListenerBindPort(t *testing.T) { + myPortValue := "1234" + + // Set the port manually + _ = os.Setenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT", myPortValue) + + // Create and run the CLI command + config := createRouterConfig([]string{"edge", "--routerName", "testRouter"}) + + assert.Equal(t, myPortValue, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} + func TestEdgeRouterCannotBeWSSAndPrivate(t *testing.T) { expectedErrorMsg := "Flags for private and wss configs are mutually exclusive. You must choose private or wss, not both" @@ -219,10 +265,10 @@ func TestEdgeRouterOutputPathDoesNotExist(t *testing.T) { func TestExecuteCreateConfigRouterEdgeHasNonBlankTemplateValues(t *testing.T) { routerName := "MyEdgeRouter" - expectedNonEmptyStringFields := []string{".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} - expectedNonEmptyStringValues := []*string{&data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} - expectedNonEmptyIntFields := []string{".Router.Listener.BindPort", ".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} - expectedNonEmptyIntValues := []*int{&data.Router.Listener.BindPort, &data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} + expectedNonEmptyStringFields := []string{".Router.Edge.ListenerBindPort", ".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} + expectedNonEmptyStringValues := []*string{&data.Router.Edge.ListenerBindPort, &data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} + expectedNonEmptyIntFields := []string{".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} + expectedNonEmptyIntValues := []*int{&data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} expectedNonEmptyTimeFields := []string{".Router.Listener.ConnectTimeout", "Router.Listener.GetSessionTimeout", ".Router.Wss.WriteTimeout", ".Router.Wss.ReadTimeout", ".Router.Wss.IdleTimeout", ".Router.Wss.PongTimeout", ".Router.Wss.PingInterval", ".Router.Wss.HandshakeTimeout", ".Router.Forwarder.LatencyProbeInterval"} expectedNonEmptyTimeValues := []*time.Duration{&data.Router.Listener.ConnectTimeout, &data.Router.Listener.GetSessionTimeout, &data.Router.Wss.WriteTimeout, &data.Router.Wss.ReadTimeout, &data.Router.Wss.IdleTimeout, &data.Router.Wss.PongTimeout, &data.Router.Wss.PingInterval, &data.Router.Wss.HandshakeTimeout, &data.Router.Forwarder.LatencyProbeInterval} diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go index 2b1e0cf8a..6f5fb47fb 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go @@ -4,16 +4,17 @@ import ( "github.com/openziti/ziti/ziti/cmd/ziti/constants" "github.com/stretchr/testify/assert" "os" + "strings" "testing" "time" ) func TestExecuteCreateConfigRouterFabricHasNonBlankTemplateValues(t *testing.T) { routerName := "MyFabricRouter" - expectedNonEmptyStringFields := []string{".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} - expectedNonEmptyStringValues := []*string{&data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} - expectedNonEmptyIntFields := []string{".Router.Listener.BindPort", ".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} - expectedNonEmptyIntValues := []*int{&data.Router.Listener.BindPort, &data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} + expectedNonEmptyStringFields := []string{".Router.Listener.BindPort", ".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} + expectedNonEmptyStringValues := []*string{&data.Router.Edge.ListenerBindPort, &data.ZitiHome, &data.Hostname, &data.Router.Name, &data.Router.IdentityCert, &data.Router.IdentityServerCert, &data.Router.IdentityKey, &data.Router.IdentityCA, &data.Router.Edge.Hostname, &data.Router.Edge.Port} + expectedNonEmptyIntFields := []string{".Router.Listener.OutQueueSize", ".Router.Wss.ReadBufferSize", ".Router.Wss.WriteBufferSize", ".Router.Forwarder.XgressDialQueueLength", ".Router.Forwarder.XgressDialWorkerCount", ".Router.Forwarder.LinkDialQueueLength", ".Router.Forwarder.LinkDialWorkerCount"} + expectedNonEmptyIntValues := []*int{&data.Router.Listener.OutQueueSize, &data.Router.Wss.ReadBufferSize, &data.Router.Wss.WriteBufferSize, &data.Router.Forwarder.XgressDialQueueLength, &data.Router.Forwarder.XgressDialWorkerCount, &data.Router.Forwarder.LinkDialQueueLength, &data.Router.Forwarder.LinkDialWorkerCount} expectedNonEmptyTimeFields := []string{".Router.Listener.ConnectTimeout", "Router.Listener.GetSessionTimeout", ".Router.Wss.WriteTimeout", ".Router.Wss.ReadTimeout", ".Router.Wss.IdleTimeout", ".Router.Wss.PongTimeout", ".Router.Wss.PingInterval", ".Router.Wss.HandshakeTimeout", ".Router.Forwarder.LatencyProbeInterval"} expectedNonEmptyTimeValues := []*time.Duration{&data.Router.Listener.ConnectTimeout, &data.Router.Listener.GetSessionTimeout, &data.Router.Wss.WriteTimeout, &data.Router.Wss.ReadTimeout, &data.Router.Wss.IdleTimeout, &data.Router.Wss.PongTimeout, &data.Router.Wss.PingInterval, &data.Router.Wss.HandshakeTimeout, &data.Router.Forwarder.LatencyProbeInterval} @@ -109,3 +110,48 @@ func TestFabricRouterOutputPathDoesNotExist(t *testing.T) { assert.EqualError(t, err, expectedErrorMsg, "Error does not match, expected %s but got %s", expectedErrorMsg, err) } + +func TestDefaultZitiFabricRouterListenerBindPort(t *testing.T) { + expectedDefaultPort := "10080" + + // Make sure the related env vars are unset + _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") + + // Create and run the CLI command + config := createRouterConfig([]string{"fabric", "--routerName", "testRouter"}) + + // Check that the template data has been updated as expected + assert.Equal(t, expectedDefaultPort, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, expectedDefaultPort, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} + +func TestSetZitiFabricRouterListenerBindPort(t *testing.T) { + myPortValue := "1234" + + // Set the port manually + _ = os.Setenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT", myPortValue) + + // Create and run the CLI command + config := createRouterConfig([]string{"fabric", "--routerName", "testRouter"}) + + assert.Equal(t, myPortValue, data.Router.Edge.ListenerBindPort) + + // Check that the actual config output has the correct port + for i := 1; i < len(config.Link.Listeners); i++ { + if config.Link.Listeners[i].Binding == "transport" { + // Assert Bind and Advertise use Bind port value + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Bind, ":")[1]) + assert.Equal(t, myPortValue, strings.Split(config.Link.Listeners[i].Address, ":")[1]) + break + } + } +} diff --git a/ziti/cmd/ziti/cmd/create_config_test.go b/ziti/cmd/ziti/cmd/create_config_test.go index 59a8b002b..51ed0e9ed 100644 --- a/ziti/cmd/ziti/cmd/create_config_test.go +++ b/ziti/cmd/ziti/cmd/create_config_test.go @@ -40,6 +40,7 @@ func getZitiEnvironmentVariables() []string { "ZITI_EDGE_IDENTITY_ENROLLMENT_DURATION", "ZITI_EDGE_ROUTER_ENROLLMENT_DURATION", "ZITI_EDGE_ROUTER_ADVERTISED_HOST", + "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT", } } diff --git a/ziti/cmd/ziti/cmd/helpers/env_helpers.go b/ziti/cmd/ziti/cmd/helpers/env_helpers.go index 21ee4d8e1..13e93944a 100644 --- a/ziti/cmd/ziti/cmd/helpers/env_helpers.go +++ b/ziti/cmd/ziti/cmd/helpers/env_helpers.go @@ -105,6 +105,10 @@ func GetZitiEdgeRouterPort() (string, error) { return getValueOrSetAndGetDefault(constants.ZitiEdgeRouterPortVarName, constants.DefaultZitiEdgeRouterPort) } +func GetZitiEdgeRouterListenerBindPort() (string, error) { + return getValueOrSetAndGetDefault(constants.ZitiEdgeRouterListenerBindPortVarName, constants.DefaultZitiEdgeRouterListenerBindPort) +} + func GetZitiEdgeCtrlListenerHostPort() (string, error) { // Get the edge controller port to use as the default edgeCtrlPort, err := GetZitiEdgeCtrlAdvertisedPort() diff --git a/ziti/cmd/ziti/constants/constants.go b/ziti/cmd/ziti/constants/constants.go index b4efd27b3..3aacff84d 100644 --- a/ziti/cmd/ziti/constants/constants.go +++ b/ziti/cmd/ziti/constants/constants.go @@ -36,8 +36,8 @@ const ( // Config Template Constants const ( - DefaultListenerBindPort = 10080 - DefaultGetSessionTimeout = 60 * time.Second + DefaultZitiEdgeRouterListenerBindPort = "10080" + DefaultGetSessionTimeout = 60 * time.Second DefaultZitiEdgeRouterPort = "3022" @@ -107,4 +107,6 @@ const ( ZitiEdgeRouterIPOverrideVarDescription = "Override the default edge router IP with a custom IP, this IP will also be added to the PKI" ZitiEdgeRouterAdvertisedHostVarName = "ZITI_EDGE_ROUTER_ADVERTISED_HOST" ZitiEdgeRouterAdvertisedHostVarDescription = "The advertised host of the router" + ZitiEdgeRouterListenerBindPortVarName = "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" + ZitiEdgeRouterListenerBindPortVarDescription = "The port a public router will advertise on" ) From fb03b88adf92f13ceb09d38cd1245c61d7752782 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 15 Nov 2022 22:51:59 -0500 Subject: [PATCH 16/46] Replace use of `ziti version` with `ziti --version` in quickstart --- quickstart/docker/README.md | 4 ++-- quickstart/docker/buildLocalDev.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstart/docker/README.md b/quickstart/docker/README.md index cd6f7023a..dd853f242 100644 --- a/quickstart/docker/README.md +++ b/quickstart/docker/README.md @@ -17,10 +17,10 @@ Build Docker Image For Publication 1. issue this function to pull the latest ziti binaries: `getLatestZiti` 1. move the ziti binaries: `mv ziti-bin/ziti image/ziti.ignore/` 1. build the docker image: `docker build image -t openziti/quickstart` -1. exec into a container and make sure it's the version you expect: `docker run --rm -it openziti/quickstart ziti version` +1. exec into a container and make sure it's the version you expect: `docker run --rm -it openziti/quickstart ziti --version` 1. cleanup: `rm ziti-*tar.gz; rm -rf ziti-bin` 2. Push Docker Image to dockerhub ------------------ 1. `source ./image/ziti-cli-functions.sh` -1. just run `./pushLatestDocker.sh` \ No newline at end of file +1. just run `./pushLatestDocker.sh` diff --git a/quickstart/docker/buildLocalDev.sh b/quickstart/docker/buildLocalDev.sh index 8dc9a0bad..5e709cf24 100755 --- a/quickstart/docker/buildLocalDev.sh +++ b/quickstart/docker/buildLocalDev.sh @@ -54,7 +54,7 @@ if [ -d "${ZITI_DOCKER_ROOT}/image/ziti.ignore" ]; then rm -rf "${ZITI_DOCKER_ROOT}/image/ziti.ignore" fi -docker run --rm -it openziti/quickstart:dev /openziti/ziti-bin/ziti version +echo "Ziti Version: $(docker run --rm -it openziti/quickstart:dev /openziti/ziti-bin/ziti --version)" vers="$(echo "${ZITI_BINARIES_VERSION}" | cut -c 2-100)" docker tag "openziti/quickstart:dev" "openziti/quickstart:dev" From af1daff19087ea07a6214faf15881f495312f3fe Mon Sep 17 00:00:00 2001 From: gberl002 Date: Wed, 16 Nov 2022 17:25:26 -0500 Subject: [PATCH 17/46] Fixing typo in function call Signed-off-by: gberl002 --- quickstart/docker/image/ziti-cli-functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 050e50ed3..fd1e1692e 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -508,9 +508,9 @@ function ziti_expressConfiguration { returnCnt=$((returnCnt + $?)) _portCheck "ZITI_EDGE_CONTROLLER_PORT" "Edge Controller" returnCnt=$((returnCnt + $?)) - _portcheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" + _portCheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" returnCnt=$((returnCnt + $?)) - _portcheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" + _portCheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" returnCnt=$((returnCnt + $?)) if [[ "returnCnt" -gt "0" ]]; then return 1; fi From 61b6649def3c659651962df6e3b2c16da071f4bf Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 18 Nov 2022 22:41:27 -0500 Subject: [PATCH 18/46] enable the newly exposed verbose option from enrolling --- CHANGELOG.md | 1 + common/enrollment/enroll.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7934c17d8..1d652b9ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * The init and uninstall commands have been removed * The install, upgrade, use and version commands have been hidden and will be hidden once tests using them are updated or replaced * The demo and tutorial commands have been moved under the new learn subcommand +* `ziti edge enroll` now has a verbose option for additional debugging # Release 0.26.11 diff --git a/common/enrollment/enroll.go b/common/enrollment/enroll.go index c4c45519a..8010f9fb4 100644 --- a/common/enrollment/enroll.go +++ b/common/enrollment/enroll.go @@ -111,6 +111,7 @@ func NewEnrollCommand(p common.OptionsProvider) *cobra.Command { enrollSubCmd.Flags().StringVarP(&action.Username, "username", "u", "", "Username for updb enrollment, prompted if not provided and necessary") enrollSubCmd.Flags().StringVarP(&action.Password, "password", "p", "", "Password for updb enrollment, prompted if not provided and necessary") 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 enrollSubCmd.Flags().VarP(&action.KeyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key") @@ -170,6 +171,7 @@ func (e *EnrollAction) Run() error { AdditionalCAs: e.CaOverride, Username: e.Username, Password: e.Password, + Verbose: e.Verbose, } if tkn.EnrollmentMethod == "updb" { From 8c533b72943d5994bb45986069f73b7d41dba3ad Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Sat, 19 Nov 2022 14:01:22 -0500 Subject: [PATCH 19/46] small change to the readme --- quickstart/docker/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quickstart/docker/README.md b/quickstart/docker/README.md index dd853f242..a281b66b3 100644 --- a/quickstart/docker/README.md +++ b/quickstart/docker/README.md @@ -7,6 +7,9 @@ Build Docker Image for Local Dev (probably for docker-compose testing) 2. run the script `./buildLocalDev.sh` which will create a `openziti/quickstart:dev` tag 3. update `.env` and change the value for `ZITI_VERSION` to `dev` 4. run `docker-compose` as normal +5. If you encounter any strange errors, it's probably best to prune docker + and try again. Issue `docker system prune -a` and allow it to clear/cleanup + the entire docker world Build Docker Image For Publication ------------------ From 3c583ddeb6d26f6641dc56263b19a9b88410d9bb Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 16 Nov 2022 11:45:49 -0500 Subject: [PATCH 20/46] Add create/delete transit-router CLI commands. Fixes #897 --- CHANGELOG.md | 2 + go.mod | 32 ++++--- go.sum | 64 +++++++++---- ziti/cmd/edge/create.go | 7 +- ziti/cmd/edge/create_edge_router.go | 9 +- ziti/cmd/edge/create_transit_router.go | 120 +++++++++++++++++++++++++ ziti/cmd/edge/delete.go | 3 +- 7 files changed, 199 insertions(+), 38 deletions(-) create mode 100644 ziti/cmd/edge/create_transit_router.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d652b9ff..0b9b823b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Ziti CLI * The CLI has been cleaned up and unused, unusable and underused components have been removed or hidden + * Add create/delete transit-router CLI commands ## Ziti CLI @@ -24,6 +25,7 @@ * The install, upgrade, use and version commands have been hidden and will be hidden once tests using them are updated or replaced * The demo and tutorial commands have been moved under the new learn subcommand * `ziti edge enroll` now has a verbose option for additional debugging +* The `ziti edge` CLI now support create/delete transit-router. This allows transit/fabric routers to be provisioned using an enrollment process, rather than requiring certs to be created externally. Note that this requires that the fabric router config file has a `csr` section. # Release 0.26.11 diff --git a/go.mod b/go.mod index cbc74e96d..22d5bb9ef 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Jeffail/gabs/v2 v2.6.1 github.com/MakeNowJust/heredoc v1.0.0 github.com/blang/semver v3.5.1+incompatible + github.com/docker/docker v20.10.21+incompatible github.com/fatih/color v1.13.0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-acme/lego/v4 v4.2.0 @@ -20,15 +21,15 @@ require ( github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.6.9 github.com/openziti/agent v1.0.5 - github.com/openziti/channel/v2 v2.0.12 + github.com/openziti/channel/v2 v2.0.15 github.com/openziti/edge v0.24.36 github.com/openziti/fabric v0.21.17 github.com/openziti/foundation/v2 v2.0.7 - github.com/openziti/identity v1.0.20 + github.com/openziti/identity v1.0.23 github.com/openziti/runzmd v1.0.3 - github.com/openziti/sdk-golang v0.16.146 + github.com/openziti/sdk-golang v0.18.1 github.com/openziti/storage v0.1.26 - github.com/openziti/transport/v2 v2.0.38 + github.com/openziti/transport/v2 v2.0.41 github.com/openziti/xweb/v2 v2.0.2 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pborman/uuid v1.2.0 @@ -56,6 +57,7 @@ require ( github.com/AppsFlyer/go-sundheit v0.5.0 // indirect github.com/MichaelMure/go-term-markdown v0.1.4 // indirect github.com/MichaelMure/go-term-text v0.3.1 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect @@ -64,13 +66,16 @@ require ( github.com/biogo/store v0.0.0-20200525035639-8c94ae1e7c9c // indirect github.com/boltdb/bolt v1.3.1 // indirect github.com/c-bata/go-prompt v0.2.6 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/coreos/go-iptables v0.6.0 // indirect + github.com/creack/pty v1.1.11 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 // indirect github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect github.com/disintegration/imaging v1.6.2 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/ef-ds/deque v1.0.4 // indirect github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect @@ -87,6 +92,7 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/validate v0.22.0 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c // indirect github.com/google/uuid v1.3.0 // indirect @@ -124,13 +130,17 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/netfoundry/secretstream v0.1.2 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.2 // indirect - github.com/openziti/metrics v1.1.5 // indirect + github.com/openziti/metrics v1.1.6 // indirect github.com/openziti/x509-claims v1.0.3 // indirect github.com/orcaman/concurrent-map/v2 v2.0.0 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect @@ -138,7 +148,7 @@ require ( github.com/pkg/term v1.2.0-beta.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect - github.com/rivo/uniseg v0.4.2 // indirect + github.com/rivo/uniseg v0.4.3 // indirect github.com/rodaine/table v1.0.1 // indirect github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect github.com/speps/go-hashids v2.0.0+incompatible // indirect @@ -157,15 +167,17 @@ require ( github.com/yusufpapurcu/wmi v1.2.2 // indirect go.mongodb.org/mongo-driver v1.10.0 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect - golang.org/x/crypto v0.2.0 // indirect + golang.org/x/crypto v0.3.0 // indirect + golang.org/x/exp v0.0.0-20221114191408-850992195362 // indirect golang.org/x/image v0.1.0 // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/mod v0.6.0 // indirect golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect golang.org/x/sys v0.2.0 // indirect golang.org/x/term v0.2.0 // indirect golang.org/x/text v0.4.0 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/tools v0.2.0 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect + gotest.tools/v3 v3.4.0 // indirect ) diff --git a/go.sum b/go.sum index 8752aa719..bab64a661 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.5.0/go.mod h1:9HLKlQjVBH6U3oDfsXOeVc56THsLPw1L03yban4xThw= github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= @@ -75,6 +76,8 @@ github.com/MichaelMure/go-term-markdown v0.1.4 h1:Ir3kBXDUtOX7dEv0EaQV8CNPpH+T7A github.com/MichaelMure/go-term-markdown v0.1.4/go.mod h1:EhcA3+pKYnlUsxYKBJ5Sn1cTQmmBMjeNlpV8nRb+JxA= github.com/MichaelMure/go-term-text v0.3.1 h1:Kw9kZanyZWiCHOYu9v/8pWEgDQ6UVN9/ix2Vd2zzWf0= github.com/MichaelMure/go-term-text v0.3.1/go.mod h1:QgVjAEDUnRMlzpS6ky5CGblux7ebeiLnuy9dAaFZu8o= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -132,8 +135,8 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7 github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI= github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY= github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -168,8 +171,9 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -190,6 +194,12 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= +github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -318,6 +328,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= @@ -631,11 +642,15 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU= +github.com/moby/term v0.0.0-20221120202655-abb19827d345/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -667,14 +682,18 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openziti/agent v1.0.5 h1:wZUcMYqvwspOjDSaejMtczSXnJoqK0edI9HcEIFsTIs= github.com/openziti/agent v1.0.5/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= -github.com/openziti/channel/v2 v2.0.12 h1:0/qQ3qCSt70gpUuxQk8MRD3+iGKqS4wuYZpbcOzS+tc= -github.com/openziti/channel/v2 v2.0.12/go.mod h1:mESOWBphvr2/P6j3FDIiQF+Z6z3E3Vjv6GaCoGWY6eM= +github.com/openziti/channel/v2 v2.0.15 h1:y1YwewnZTPTPtE3YVjaVpOWGoqJ3+I8+7KqQB4D3poQ= +github.com/openziti/channel/v2 v2.0.15/go.mod h1:LdoKRnefknW4WllUyHJtvKDtKK716lYdHqApKbBy3rk= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= github.com/openziti/edge v0.24.36 h1:3ywHRL5XXYtA4+y12WptofLhkndshePuy/MyKT3A2xo= @@ -683,20 +702,20 @@ github.com/openziti/fabric v0.21.17 h1:oT32L0Lu64Jd7CkHrQZdOwG0Mew8bMBEUowtRyhER github.com/openziti/fabric v0.21.17/go.mod h1:VsRUi2wdA3k4bOXxfrohaoUuhcjf8ZdpPPN0NzD8my4= github.com/openziti/foundation/v2 v2.0.7 h1:QtpP0ntUhr/7uLR1iM7eEkrusQ2b2ZqTblgdq8cac9Y= github.com/openziti/foundation/v2 v2.0.7/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= -github.com/openziti/identity v1.0.20 h1:8nsQFHpqKS1ByD8QuPDxQWfS8CQEidyn5jFXWnXguX0= -github.com/openziti/identity v1.0.20/go.mod h1:X0WLWEgnM1iL8asNbuu7vUW0kZq8nnWKepMW214C9Mk= +github.com/openziti/identity v1.0.23 h1:SJ2UN3qCiUKwuwFc0dr3nuHyKvhOr5aN5bEJa2wY9Sw= +github.com/openziti/identity v1.0.23/go.mod h1:uVqZEC4Lr7pEud9b5g0h/cH0Ir5K0egCjUrEVup4ERc= github.com/openziti/jwks v1.0.2 h1:32BGXIAnefS+v7uXKPb1x8/cQ7srek6Ai06dsrMTY4E= github.com/openziti/jwks v1.0.2/go.mod h1:KwO0x9FBG0aoJS5f6nH5xeHoplyR1H143SMI9kF0mC8= -github.com/openziti/metrics v1.1.5 h1:qhsGsYWdp7LxPCYi9WMGHGbjiHvsT1DtjM44JNHLZWk= -github.com/openziti/metrics v1.1.5/go.mod h1:B6RCuVRTpI3kEIhQlCvsHj3Pqi6bSnqFmRPgfgv9ico= +github.com/openziti/metrics v1.1.6 h1:fc4t5JEuYYr4gr+tF3qNpbvQ55QhoLyeOG+hiDfKLF8= +github.com/openziti/metrics v1.1.6/go.mod h1:07aMMS1VNzZvz0246fX73SFfuuoRz2nKcvDJumrVlZ0= github.com/openziti/runzmd v1.0.3 h1:g+JyJS66ykMIidLTzroKBLwbsSF9S1hDvolj2PpD8lE= github.com/openziti/runzmd v1.0.3/go.mod h1:2YuoQl5zZ6edfb+k1MjglW2cwfZvXwug2WldvBIUNrU= -github.com/openziti/sdk-golang v0.16.146 h1:5R7ZOSh+Q0pmZdzEv3l2Q03KQgiUrpaj3ymD8DjBT5k= -github.com/openziti/sdk-golang v0.16.146/go.mod h1:yOgsofdEd82pph97N4DX0xYlfgjJ2LCgC/mHkMw+5hU= +github.com/openziti/sdk-golang v0.18.1 h1:/Ge1PiTvGG99Qm1Ry5T50ay7QCMuy5Rz7HbqMP2mcEQ= +github.com/openziti/sdk-golang v0.18.1/go.mod h1:k/QRh6WA2zFsALuWC6X6+exmzbC/ddXFpRcx5FRDvQM= github.com/openziti/storage v0.1.26 h1:1tV4czY/TNmzX3raUZjbR8jVl5L92pdD0SjmdzCzUmE= github.com/openziti/storage v0.1.26/go.mod h1:Zkm+4d2gckkIbuuCw/sKFWKKhPROZak3gLFzdII0KWQ= -github.com/openziti/transport/v2 v2.0.38 h1:9+EtBF052TtGvT5isuPj/SUTXNHg8RbkGBcEKfiUPd8= -github.com/openziti/transport/v2 v2.0.38/go.mod h1:FB/pqmA8RdUsoWtpTc6E/it6lLdA7GOugy9no3JDU/4= +github.com/openziti/transport/v2 v2.0.41 h1:T9RPXsJ0wbDgIx6mjKY1YDOg6ncRDmLPq8xU52B0mvU= +github.com/openziti/transport/v2 v2.0.41/go.mod h1:YM4hnHjHK1gQZuWgmDoPGSDP+8l7uT8kT8oBGM1u6nk= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.0.2 h1:XYlVFriTq/U1wcUrc+XPnWJGhXh9NJPhtQ7+r3aC0cU= @@ -773,8 +792,8 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8= -github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= +github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rodaine/table v1.0.1 h1:U/VwCnUxlVYxw8+NJiLIuCxA/xa6jL38MY3FYysVWWQ= github.com/rodaine/table v1.0.1/go.mod h1:UVEtfBsflpeEcD56nF4F5AocNFta0ZuolpSVdPtlmP4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -985,8 +1004,8 @@ golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE= -golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -997,6 +1016,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ= +golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1027,8 +1048,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1230,6 +1252,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1293,8 +1316,9 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1468,6 +1492,8 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ziti/cmd/edge/create.go b/ziti/cmd/edge/create.go index 55f3b376b..9c59834cc 100644 --- a/ziti/cmd/edge/create.go +++ b/ziti/cmd/edge/create.go @@ -43,13 +43,14 @@ func newCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(newCreateConfigTypeCmd(out, errOut)) cmd.AddCommand(newCreateEdgeRouterCmd(out, errOut)) cmd.AddCommand(newCreateEdgeRouterPolicyCmd(out, errOut)) - cmd.AddCommand(newCreateTerminatorCmd(out, errOut)) + cmd.AddCommand(newCreateEnrollmentCmd(out, errOut)) cmd.AddCommand(newCreateIdentityCmd(out, errOut)) + cmd.AddCommand(newCreatePostureCheckCmd(out, errOut)) cmd.AddCommand(newCreateServiceCmd(out, errOut)) cmd.AddCommand(newCreateServiceEdgeRouterPolicyCmd(out, errOut)) cmd.AddCommand(newCreateServicePolicyCmd(out, errOut)) - cmd.AddCommand(newCreatePostureCheckCmd(out, errOut)) - cmd.AddCommand(newCreateEnrollmentCmd(out, errOut)) + cmd.AddCommand(newCreateTerminatorCmd(out, errOut)) + cmd.AddCommand(newCreateTransitRouterCmd(out, errOut)) return cmd } diff --git a/ziti/cmd/edge/create_edge_router.go b/ziti/cmd/edge/create_edge_router.go index 3b7922ef5..e325484bf 100644 --- a/ziti/cmd/edge/create_edge_router.go +++ b/ziti/cmd/edge/create_edge_router.go @@ -18,14 +18,13 @@ package edge import ( "fmt" + "github.com/Jeffail/gabs" "github.com/openziti/ziti/ziti/cmd/api" "github.com/openziti/ziti/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "io" - "io/ioutil" - - "github.com/Jeffail/gabs" "github.com/spf13/cobra" + "io" + "os" ) type createEdgeRouterOptions struct { @@ -116,7 +115,7 @@ func getEdgeRouterJwt(o *createEdgeRouterOptions, id string) error { return fmt.Errorf("enrollment JWT not present for new edge router") } - if err := ioutil.WriteFile(o.jwtOutputFile, []byte(jwt), 0600); err != nil { + if err := os.WriteFile(o.jwtOutputFile, []byte(jwt), 0600); err != nil { fmt.Printf("Failed to write JWT to file(%v)\n", o.jwtOutputFile) return err } diff --git a/ziti/cmd/edge/create_transit_router.go b/ziti/cmd/edge/create_transit_router.go new file mode 100644 index 000000000..39ff7163a --- /dev/null +++ b/ziti/cmd/edge/create_transit_router.go @@ -0,0 +1,120 @@ +/* + Copyright NetFoundry Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package edge + +import ( + "fmt" + "github.com/openziti/ziti/ziti/cmd/api" + "github.com/openziti/ziti/ziti/cmd/common" + cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "io" + "os" + + "github.com/Jeffail/gabs" + "github.com/spf13/cobra" +) + +type createTransitRouterOptions struct { + api.Options + jwtOutputFile string + tags map[string]string + cost uint16 + noTraversal bool +} + +func newCreateTransitRouterCmd(out io.Writer, errOut io.Writer) *cobra.Command { + options := &createTransitRouterOptions{ + Options: api.Options{ + CommonOptions: common.CommonOptions{Out: out, Err: errOut}, + }, + } + + cmd := &cobra.Command{ + Use: "transit-router ", + Short: "creates a transit router managed by the Ziti Edge Controller", + Long: "creates a transit router managed by the Ziti Edge Controller", + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + options.Cmd = cmd + options.Args = args + err := runCreateTransitRouter(options) + cmdhelper.CheckErr(err) + }, + SuggestFor: []string{}, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + cmd.Flags().StringVarP(&options.jwtOutputFile, "jwt-output-file", "o", "", "File to which to output the JWT used for enrolling the edge router") + cmd.Flags().StringToStringVar(&options.tags, "tags", nil, "Custom management tags") + cmd.Flags().Uint16Var(&options.cost, "cost", 0, "Specifies the router cost. Default 0.") + cmd.Flags().BoolVar(&options.noTraversal, "no-traversal", false, "Disallow traversal for this edge router. Default to allowed(false).") + + options.AddCommonFlags(cmd) + + return cmd +} + +// runCreateTransitRouter implements the command to create a gateway on the edge controller +func runCreateTransitRouter(o *createTransitRouterOptions) error { + entityData := gabs.New() + api.SetJSONValue(entityData, o.Args[0], "name") + api.SetJSONValue(entityData, o.tags, "tags") + api.SetJSONValue(entityData, o.cost, "cost") + api.SetJSONValue(entityData, o.noTraversal, "noTraversal") + + result, err := CreateEntityOfType("transit-routers", entityData.String(), &o.Options) + if err := o.LogCreateResult("transit router", result, err); err != nil { + return err + } + + if o.jwtOutputFile != "" { + id := result.S("data", "id").Data().(string) + if err := getTransitRouterJwt(o, id); err != nil { + return err + } + } + return nil +} + +func getTransitRouterJwt(o *createTransitRouterOptions, id string) error { + newRouter, err := DetailEntityOfType("transit-routers", id, o.OutputJSONResponse, o.Out, o.Options.Timeout, o.Options.Verbose) + if err != nil { + return err + } + + if newRouter == nil { + return fmt.Errorf("no error during transit router creation, but edge router with id %v not found... unable to extract JWT", id) + } + + jwt := newRouter.Path("enrollmentJwt").Data().(string) + if jwt == "" { + return fmt.Errorf("enrollment JWT not present for new transit router") + } + + if err := os.WriteFile(o.jwtOutputFile, []byte(jwt), 0600); err != nil { + fmt.Printf("Failed to write JWT to file(%v)\n", o.jwtOutputFile) + return err + } + + jwtExpiration := newRouter.Path("enrollmentExpiresAt").Data().(string) + if jwtExpiration != "" { + fmt.Printf("Enrollment expires at %v\n", jwtExpiration) + } + + return err +} diff --git a/ziti/cmd/edge/delete.go b/ziti/cmd/edge/delete.go index 7908be24b..faa3b8022 100644 --- a/ziti/cmd/edge/delete.go +++ b/ziti/cmd/edge/delete.go @@ -60,12 +60,13 @@ func newDeleteCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.AddCommand(newDeleteCmdForEntityType("edge-router", newOptions(), "er", "ers")) cmd.AddCommand(newDeleteCmdForEntityType("edge-router-policy", newOptions(), "erp", "erps")) cmd.AddCommand(newDeleteCmdForEntityType("identity", newOptions())) + cmd.AddCommand(newDeleteCmdForEntityType("posture-check", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("service", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("service-edge-router-policy", newOptions(), "serp", "serps")) cmd.AddCommand(newDeleteCmdForEntityType("service-policy", newOptions(), "sp", "sps")) cmd.AddCommand(newDeleteCmdForEntityType("session", newOptions())) cmd.AddCommand(newDeleteCmdForEntityType("terminator", newOptions())) - cmd.AddCommand(newDeleteCmdForEntityType("posture-check", newOptions())) + cmd.AddCommand(newDeleteCmdForEntityType("transit-router", newOptions())) return cmd } From 004fc0cc0272dab054c6f0d5d96239a9814ca4db Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 16 Nov 2022 16:11:51 -0500 Subject: [PATCH 21/46] Fix some linter warnings --- ziti/cmd/edge/policy_advisor.go | 6 ++---- ziti/util/identities.go | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ziti/cmd/edge/policy_advisor.go b/ziti/cmd/edge/policy_advisor.go index 6cabe3759..892b4e945 100644 --- a/ziti/cmd/edge/policy_advisor.go +++ b/ziti/cmd/edge/policy_advisor.go @@ -265,8 +265,7 @@ func runPolicyAdvisorForIdentity(identityId string, o *policyAdvisorOptions) err skip := 0 done := false for !done { - filter := "true limit 2" - filter = fmt.Sprintf(`true skip %v limit 2`, skip) + filter := fmt.Sprintf(`true skip %v limit 2`, skip) children, _, err := filterSubEntitiesOfType("identities", "services", identityId, filter, &o.Options) if err != nil { return err @@ -300,8 +299,7 @@ func runPolicyAdvisorForService(serviceId string, o *policyAdvisorOptions) error skip := 0 done := false for !done { - filter := "true limit 2" - filter = fmt.Sprintf(`true skip %v limit 2`, skip) + filter := fmt.Sprintf(`true skip %v limit 2`, skip) children, _, err := filterSubEntitiesOfType("services", "identities", serviceId, filter, &o.Options) if err != nil { return err diff --git a/ziti/util/identities.go b/ziti/util/identities.go index f56b4ad29..57f594a5b 100644 --- a/ziti/util/identities.go +++ b/ziti/util/identities.go @@ -13,7 +13,7 @@ import ( "github.com/openziti/ziti/ziti/cmd/common" "github.com/pkg/errors" "gopkg.in/resty.v1" - "io/ioutil" + "io" "net" "net/http" "net/url" @@ -81,7 +81,7 @@ func (self *RestClientEdgeIdentity) IsReadOnly() bool { func (self *RestClientEdgeIdentity) NewTlsClientConfig() (*tls.Config, error) { rootCaPool := x509.NewCertPool() - rootPemData, err := ioutil.ReadFile(self.CaCert) + rootPemData, err := os.ReadFile(self.CaCert) if err != nil { return nil, errors.Errorf("could not read session certificates [%s]: %v", self.CaCert, err) } @@ -255,7 +255,7 @@ func LoadRestClientConfig() (*RestClientConfig, string, error) { } return nil, "", errors.Wrapf(err, "error while statting config file %v", configFile) } - result, err := ioutil.ReadFile(configFile) + result, err := os.ReadFile(configFile) if err != nil { return nil, "", errors.Wrapf(err, "error while reading config file %v", configFile) } @@ -295,7 +295,7 @@ func PersistRestClientConfig(config *RestClientConfig) error { return errors.Wrap(err, "error while marshalling config to JSON") } - err = ioutil.WriteFile(configFile, data, 0600) + err = os.WriteFile(configFile, data, 0600) if err != nil { return errors.Wrapf(err, "error while writing config file %v", configFile) } @@ -379,8 +379,8 @@ func newRestClientResponseF(clientOpts ClientOpts) func(*http.Response, error) { return } - resp.Body = ioutil.NopCloser(resp.Body) - bodyContent, err := ioutil.ReadAll(resp.Body) + resp.Body = io.NopCloser(resp.Body) + bodyContent, err := io.ReadAll(resp.Body) if err != nil { _, _ = fmt.Fprintf(clientOpts.ErrOutputWriter(), "could not read response body: %v", err) return @@ -407,7 +407,7 @@ func newRestClientRequestF(clientOpts ClientOpts, readOnly bool) func(*http.Requ _, _ = fmt.Fprintf(clientOpts.ErrOutputWriter(), "could not copy request body: %v", err) return nil } - bodyContent, err := ioutil.ReadAll(body) + bodyContent, err := io.ReadAll(body) if err != nil { bodyStr := string(bodyContent) _, _ = fmt.Fprint(clientOpts.OutputWriter(), bodyStr, "\n") From e631908c2009e7dcb011ce78b1284126b48c619d Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Mon, 21 Nov 2022 18:07:08 -0500 Subject: [PATCH 22/46] use the short hostname instead because FQDN breaks CentOS; use pkill instead of killall because it's more prevalent --- quickstart/docker/image/ziti-cli-functions.sh | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index e2e158f35..cbdfed621 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -2,8 +2,10 @@ set -uo pipefail +ZITI_HOSTNAME="$(hostname -s)" + # shellcheck disable=SC2155 -export DEFAULT_ZITI_HOME_LOCATION="${HOME}/.ziti/quickstart/$(hostname)" +export DEFAULT_ZITI_HOME_LOCATION="${HOME}/.ziti/quickstart/${ZITI_HOSTNAME}" export ZITI_QUICKSTART_ENVROOT="${HOME}/.ziti/quickstart" @@ -69,7 +71,7 @@ function startZitiController { } function stopZitiController { - killall ziti-controller + pkill ziti-controller # shellcheck disable=SC2181 if [[ $? == 0 ]]; then echo "Controller stopped."; fi } @@ -83,7 +85,7 @@ function startExpressEdgeRouter { } function stopAllEdgeRouters { - killall ziti-router + pkill ziti-router # shellcheck disable=SC2181 if [[ $? == 0 ]]; then echo "Router(s) stopped."; fi } @@ -138,7 +140,7 @@ function verifyZitiVersionExists { unset ZITI_BINARIES_VERSION - ziticurl="$(curl -s https://api.github.com/repos/openziti/ziti/releases/tags/"${ZITI_VERSION_OVERRIDE}")" + ziticurl="$(curl -s https://${GITHUB_TOKEN:+${GITHUB_TOKEN}@}api.github.com/repos/openziti/ziti/releases/tags/"${ZITI_VERSION_OVERRIDE}")" # shellcheck disable=SC2155 export ZITI_BINARIES_FILE=$(echo "${ziticurl}" | tr '\r\n' ' ' | jq -r '.assets[] | select(.name | startswith("'"ziti-${ZITI_OSTYPE}-${ZITI_ARCH}"'")) | .name') # shellcheck disable=SC2155 @@ -146,6 +148,7 @@ function verifyZitiVersionExists { # Check if there was an error while trying to get the requested version if [[ "${ZITI_BINARIES_VERSION-}" == "null" ]]; then + echo "ERROR: response missing '.tag_name': ${ziticurl}" >&2 return 1 fi @@ -178,7 +181,7 @@ function getLatestZitiVersion { unset ZITI_BINARIES_VERSION if [[ "${ZITI_BINARIES_VERSION-}" == "" ]]; then - zitilatest=$(curl -s https://api.github.com/repos/openziti/ziti/releases/latest) + zitilatest=$(curl -s https://${GITHUB_TOKEN:+${GITHUB_TOKEN}@}api.github.com/repos/openziti/ziti/releases/latest) # shellcheck disable=SC2155 export ZITI_BINARIES_FILE=$(echo "${zitilatest}" | tr '\r\n' ' ' | jq -r '.assets[] | select(.name | startswith("'"ziti-${ZITI_OSTYPE}-${ZITI_ARCH}"'")) | .name') # shellcheck disable=SC2155 @@ -323,15 +326,15 @@ function setupZitiNetwork { echo "Creating a controller is effectively creating a network. The name of the network will be used when writing" echo "configuration files locally. Choose the name of your network now. The format of the network name should resemble" echo -n "what a hostname looks like. A good choice is to actually use your system's hostname: " - echo -e "$(BLUE "$(hostname)")" + echo -e "$(BLUE "${ZITI_HOSTNAME}")" echo " " - echo -en "$(echo -ne "Network Name [$(BLUE "$(hostname)")]: ")" + echo -en "$(echo -ne "Network Name [$(BLUE "${ZITI_HOSTNAME}")]: ")" read -r ZITI_NETWORK echo " " if checkControllerName; then : #clear to continue if [[ "${ZITI_NETWORK-}" == "" ]]; then - ZITI_NETWORK="$(hostname)" + ZITI_NETWORK="${ZITI_HOSTNAME}" fi echo "name: ${ZITI_NETWORK-}" else @@ -451,7 +454,7 @@ function ziti_expressConfiguration { echo " " echo -e "******** Setting Up Environment ********" if [[ "${1-}" == "" ]]; then - nw="$(hostname)" + nw="${ZITI_HOSTNAME}" else nw="${1-}" fi @@ -718,7 +721,7 @@ function createRouterPki { export ZITI_ROUTER_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/server.cert" export ZITI_ROUTER_IDENTITY_KEY="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/server.key" export ZITI_ROUTER_IDENTITY_CA="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/cas.cert" - pki_client_server "${router_name},localhost,127.0.0.1,$(hostname)" "${ZITI_CONTROLLER_INTERMEDIATE_NAME}" "${ZITI_EDGE_ROUTER_IP_OVERRIDE-}" "${router_name}" + pki_client_server "${router_name},localhost,127.0.0.1,${ZITI_HOSTNAME}" "${ZITI_CONTROLLER_INTERMEDIATE_NAME}" "${ZITI_EDGE_ROUTER_IP_OVERRIDE-}" "${router_name}" } function createPrivateRouterConfig { @@ -781,7 +784,7 @@ function createPki { pki_create_intermediate "${ZITI_SPURIOUS_INTERMEDIATE}" "${ZITI_SIGNING_INTERMEDIATE_NAME}" 1 echo " " - pki_allow_list_dns="${ZITI_CONTROLLER_HOSTNAME},localhost,$(hostname)" + pki_allow_list_dns="${ZITI_CONTROLLER_HOSTNAME},localhost,${ZITI_HOSTNAME}" if [[ "${ZITI_EDGE_CONTROLLER_HOSTNAME}" != "" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${ZITI_EDGE_CONTROLLER_HOSTNAME}"; fi if [[ "${EXTERNAL_DNS}" != "" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${EXTERNAL_DNS}"; fi pki_allow_list_ip="127.0.0.1" @@ -966,7 +969,7 @@ function ziti_createEnvFile { if [[ "${retVal}" != 0 ]]; then if decideToUseDefaultZitiHome; then # shellcheck disable=SC2155 - export ZITI_NETWORK="$(hostname)" + export ZITI_NETWORK="${ZITI_HOSTNAME}" ZITI_HOME="${DEFAULT_ZITI_HOME_LOCATION}" else return 1 @@ -998,16 +1001,16 @@ function ziti_createEnvFile { export ZITI_NETWORK="${1-}" fi if [[ "${ZITI_NETWORK-}" = "" ]]; then - echo -e "$(YELLOW "WARN: ZITI_NETWORK HAS NOT BEEN DECLARED! USING hostname: $(hostname)")" + echo -e "$(YELLOW "WARN: ZITI_NETWORK HAS NOT BEEN DECLARED! USING hostname: ${ZITI_HOSTNAME}")" # shellcheck disable=SC2155 - export ZITI_NETWORK="$(hostname)" + export ZITI_NETWORK="${ZITI_HOSTNAME}" fi fi echo "ZITI_NETWORK set to: ${ZITI_NETWORK}" if [[ "${ZITI_USER-}" == "" ]]; then export ZITI_USER="admin"; fi - if [[ "${ZITI_PWD-}" == "" ]]; then export ZITI_PWD="admin"; fi + if [[ "${ZITI_PWD-}" == "" ]]; then export ZITI_PWD="$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c${1:-32})"; fi if [[ "${ZITI_DOMAIN_SUFFIX-}" == "" ]]; then export ZITI_DOMAIN_SUFFIX=""; fi if [[ "${ZITI_ID-}" == "" ]]; then export ZITI_ID="${ZITI_HOME}/identities.yaml"; fi From ec1b6f5e0467ca46faeef77a207c4f9d73b1bb5d Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 22 Nov 2022 16:56:07 -0500 Subject: [PATCH 23/46] embellish the functions that do initial start and stop of the controller during expressInstall and manually start and stop the router --- quickstart/docker/image/ziti-cli-functions.sh | 55 +++++++++++++++---- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index cbdfed621..ebdf3e67c 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -67,13 +67,21 @@ function startZitiController { ("${ZITI_BIN_DIR-}/ziti-controller" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" > "${log_file}" 2>&1 &) pid=$! echo -e "ziti-controller started as process id: $pid. log located at: $(BLUE "${log_file}")" - return $pid + echo $pid # for capture by caller } function stopZitiController { - pkill ziti-controller - # shellcheck disable=SC2181 - if [[ $? == 0 ]]; then echo "Controller stopped."; fi + if (( ${#} )); then + kill "$1" + # shellcheck disable=SC2181 + if [[ $? == 0 ]]; then + echo "Controller stopped." + return 0 + fi + else + echo "ERROR: need controller PID to kill" >&2 + return 1 + fi } function startExpressEdgeRouter { @@ -81,13 +89,40 @@ function startExpressEdgeRouter { "${ZITI_BIN_DIR}/ziti-router" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.yaml" > "${log_file}" 2>&1 & pid=$! echo -e "Express Edge Router started as process id: $pid. log located at: $(BLUE "${log_file}")" - return $pid + ZITI_EXPRESS_EDGE_ROUTER_PID="$pid" } function stopAllEdgeRouters { - pkill ziti-router - # shellcheck disable=SC2181 - if [[ $? == 0 ]]; then echo "Router(s) stopped."; fi + if [[ -n ${ZITI_EXPRESS_EDGE_ROUTER_PID:-} ]]; then + # shellcheck disable=SC2015 + kill "${ZITI_EXPRESS_EDGE_ROUTER_PID}" && { + echo "INFO: stopped router" + } || { + echo "ERROR: something went wrong with stopping the router(s)" >&2 + return 1 + } + else + if which pkill &>/dev/null; then + # shellcheck disable=SC2015 + pkill ziti-router && { + echo "Router(s) stopped." + } || { + echo "ERROR: something went wrong with stopping the router(s)" >&2 + return 1 + } + elif which killall &>/dev/null; then + # shellcheck disable=SC2015 + killall ziti-router && { + echo "Router(s) stopped." + } || { + echo "ERROR: something went wrong with stopping the router(s)" >&2 + return 1 + } + else + echo "ERROR: need 'pkill' or 'killall' command to kill routers that were not started with startExpressEdgeRouter" >&2 + return 1 + fi + fi } function checkHostsFile { @@ -484,7 +519,7 @@ function ziti_expressConfiguration { createControllerConfig #createControllerSystemdFile initializeController - startZitiController + ZITI_EXPRESS_CONTROLLER_PID=$(startZitiController) echo "waiting for the controller to come online to allow the edge router to enroll" waitForController @@ -518,7 +553,7 @@ function ziti_expressConfiguration { "${ZITI_BIN_DIR-}/ziti-router" enroll "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.yaml" --jwt "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.jwt" &> "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.enrollment.log" echo "" - stopZitiController + [[ -n ${ZITI_EXPRESS_CONTROLLER_PID:-} ]] && stopZitiController "${ZITI_EXPRESS_CONTROLLER_PID}" echo "Edge Router enrolled. Controller stopped." echo "" From 5e759ee96e5080bfbefd853311af2a5670f8e1c0 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 22 Nov 2022 18:01:56 -0500 Subject: [PATCH 24/46] prompt to optionally change the admin pwd --- quickstart/docker/image/ziti-cli-functions.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index ebdf3e67c..1089df75b 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -1045,7 +1045,18 @@ function ziti_createEnvFile { echo "ZITI_NETWORK set to: ${ZITI_NETWORK}" if [[ "${ZITI_USER-}" == "" ]]; then export ZITI_USER="admin"; fi - if [[ "${ZITI_PWD-}" == "" ]]; then export ZITI_PWD="$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c${1:-32})"; fi + if [[ "${ZITI_PWD-}" == "" ]]; then + ZITI_PWD="$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c32)" + echo -e "Do you want to keep the generated admin password '$ZITI_PWD'? (Y/n)" + # shellcheck disable=SC2162 + read ZITI_PWD_REPLY + if [[ -z "${ZITI_PWD_REPLY}" || ${ZITI_PWD_REPLY} =~ [yY] ]]; then + echo "INFO: using ZITI_PWD=${ZITI_PWD}" + else + echo "Type the preferred admin password and press " + read -r ZITI_PWD + fi + fi if [[ "${ZITI_DOMAIN_SUFFIX-}" == "" ]]; then export ZITI_DOMAIN_SUFFIX=""; fi if [[ "${ZITI_ID-}" == "" ]]; then export ZITI_ID="${ZITI_HOME}/identities.yaml"; fi From 046096e46941b2bd011def56078e8f29c49d7285 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 22 Nov 2022 18:07:30 -0500 Subject: [PATCH 25/46] send express controller initial startup pid to stop function --- quickstart/docker/image/ziti-cli-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 1089df75b..aaf0fdcf0 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -458,7 +458,7 @@ function ziti_expressConfiguration { # Stop any devices currently running to avoid port collisions stopAllEdgeRouters - stopZitiController + stopZitiController "${ZITI_EXPRESS_CONTROLLER_PID}" else echo -e "$(RED " --- Exiting express install ---")" return 1 From 6e626943ff2c21ee95f0a25ec0c689629ae9bc3b Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 22 Nov 2022 19:36:20 -0500 Subject: [PATCH 26/46] only output the PID from the function that starts the controller --- quickstart/docker/image/ziti-cli-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index aaf0fdcf0..070ec9dde 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -66,7 +66,6 @@ function startZitiController { # shellcheck disable=SC2034 ("${ZITI_BIN_DIR-}/ziti-controller" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" > "${log_file}" 2>&1 &) pid=$! - echo -e "ziti-controller started as process id: $pid. log located at: $(BLUE "${log_file}")" echo $pid # for capture by caller } @@ -520,6 +519,7 @@ function ziti_expressConfiguration { #createControllerSystemdFile initializeController ZITI_EXPRESS_CONTROLLER_PID=$(startZitiController) + echo "ziti-controller started as process id: $pid. log located at: $(BLUE "${ZITI_HOME-}/${ZITI_EDGE_CONTROLLER_RAWNAME}.log")" echo "waiting for the controller to come online to allow the edge router to enroll" waitForController From 80d2823dfce4b8a4b3928e05601619e83828b070 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 22 Nov 2022 20:07:44 -0500 Subject: [PATCH 27/46] fix functions that start and stop the controller during expressInstall --- quickstart/docker/image/ziti-cli-functions.sh | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 070ec9dde..d9cf83306 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -64,21 +64,37 @@ function initializeController { function startZitiController { log_file="${ZITI_HOME-}/${ZITI_EDGE_CONTROLLER_RAWNAME}.log" # shellcheck disable=SC2034 - ("${ZITI_BIN_DIR-}/ziti-controller" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" > "${log_file}" 2>&1 &) - pid=$! - echo $pid # for capture by caller + "${ZITI_BIN_DIR-}/ziti-controller" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" &> "${log_file}" & + ZITI_EXPRESS_CONTROLLER_PID=$! + echo "ziti-controller started as process id: $ZITI_EXPRESS_CONTROLLER_PID. log located at: $(BLUE "${ZITI_HOME-}/${ZITI_EDGE_CONTROLLER_RAWNAME}.log")" } function stopZitiController { - if (( ${#} )); then - kill "$1" + if [[ -n ${ZITI_EXPRESS_CONTROLLER_PID:-} ]]; then + kill "$ZITI_EXPRESS_CONTROLLER_PID" # shellcheck disable=SC2181 if [[ $? == 0 ]]; then echo "Controller stopped." return 0 fi + elif which pkill &>/dev/null; then + # shellcheck disable=SC2015 + pkill ziti-controller && { + echo "Controller stopped." + } || { + echo "ERROR: something went wrong with stopping the controller" >&2 + return 1 + } + elif which killall &>/dev/null; then + # shellcheck disable=SC2015 + killall ziti-controller && { + echo "Controller stopped." + } || { + echo "ERROR: something went wrong with stopping the controller" >&2 + return 1 + } else - echo "ERROR: need controller PID to kill" >&2 + echo "ERROR: need 'pkill' or 'killall' command to kill controller that was not started with startZitiController" >&2 return 1 fi } @@ -86,9 +102,9 @@ function stopZitiController { function startExpressEdgeRouter { log_file="${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.log" "${ZITI_BIN_DIR}/ziti-router" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.yaml" > "${log_file}" 2>&1 & - pid=$! - echo -e "Express Edge Router started as process id: $pid. log located at: $(BLUE "${log_file}")" - ZITI_EXPRESS_EDGE_ROUTER_PID="$pid" + ZITI_EXPRESS_EDGE_ROUTER_PID=$! + echo -e "Express Edge Router started as process id: $ZITI_EXPRESS_EDGE_ROUTER_PID. log located at: $(BLUE "${log_file}")" + } function stopAllEdgeRouters { @@ -100,27 +116,25 @@ function stopAllEdgeRouters { echo "ERROR: something went wrong with stopping the router(s)" >&2 return 1 } - else - if which pkill &>/dev/null; then - # shellcheck disable=SC2015 - pkill ziti-router && { - echo "Router(s) stopped." - } || { - echo "ERROR: something went wrong with stopping the router(s)" >&2 - return 1 - } - elif which killall &>/dev/null; then - # shellcheck disable=SC2015 - killall ziti-router && { - echo "Router(s) stopped." - } || { - echo "ERROR: something went wrong with stopping the router(s)" >&2 - return 1 - } - else - echo "ERROR: need 'pkill' or 'killall' command to kill routers that were not started with startExpressEdgeRouter" >&2 + elif which pkill &>/dev/null; then + # shellcheck disable=SC2015 + pkill ziti-router && { + echo "Router(s) stopped." + } || { + echo "ERROR: something went wrong with stopping the router(s)" >&2 return 1 - fi + } + elif which killall &>/dev/null; then + # shellcheck disable=SC2015 + killall ziti-router && { + echo "Router(s) stopped." + } || { + echo "ERROR: something went wrong with stopping the router(s)" >&2 + return 1 + } + else + echo "ERROR: need 'pkill' or 'killall' command to kill routers that were not started with startExpressEdgeRouter" >&2 + return 1 fi } @@ -518,8 +532,7 @@ function ziti_expressConfiguration { createControllerConfig #createControllerSystemdFile initializeController - ZITI_EXPRESS_CONTROLLER_PID=$(startZitiController) - echo "ziti-controller started as process id: $pid. log located at: $(BLUE "${ZITI_HOME-}/${ZITI_EDGE_CONTROLLER_RAWNAME}.log")" + startZitiController echo "waiting for the controller to come online to allow the edge router to enroll" waitForController From 47d24627bb46a20ab4638ffebb40321c9d645214 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 21 Nov 2022 17:08:53 -0500 Subject: [PATCH 28/46] Add AMI build for tests. Update simple-transfer to use new AMI. --- go.mod | 4 +- go.sum | 8 +- network-tests/ami/README.md | 17 +++ network-tests/ami/cleanup-old-images.sh | 10 ++ .../ami/etc/apt/apt.conf.d/99remote-not-fancy | 2 + .../ami/etc/sysctl.d/51-network-tuning.conf | 9 ++ network-tests/ami/list-images.sh | 11 ++ network-tests/ami/ziti-ami.pkr.hcl | 68 +++++++++ network-tests/go.mod | 42 +++--- network-tests/go.sum | 81 ++++++----- network-tests/simple-transfer/main.go | 29 ++-- .../stages/0_infrastructure/retry.go | 33 ----- network-tests/test_resources/resource.go | 14 ++ .../test_resources/terraform/main.tf | 42 ++++++ .../terraform/ondemand_instance/main.tf | 45 ++++++ .../test_resources/terraform/vpc/main.tf | 129 ++++++++++++++++++ network-tests/utils/actions/echoServer.go | 4 +- 17 files changed, 438 insertions(+), 110 deletions(-) create mode 100644 network-tests/ami/README.md create mode 100755 network-tests/ami/cleanup-old-images.sh create mode 100644 network-tests/ami/etc/apt/apt.conf.d/99remote-not-fancy create mode 100644 network-tests/ami/etc/sysctl.d/51-network-tuning.conf create mode 100755 network-tests/ami/list-images.sh create mode 100644 network-tests/ami/ziti-ami.pkr.hcl delete mode 100644 network-tests/simple-transfer/stages/0_infrastructure/retry.go create mode 100644 network-tests/test_resources/resource.go create mode 100644 network-tests/test_resources/terraform/main.tf create mode 100644 network-tests/test_resources/terraform/ondemand_instance/main.tf create mode 100644 network-tests/test_resources/terraform/vpc/main.tf diff --git a/go.mod b/go.mod index 22d5bb9ef..163d7c097 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/openziti/foundation/v2 v2.0.7 github.com/openziti/identity v1.0.23 github.com/openziti/runzmd v1.0.3 - github.com/openziti/sdk-golang v0.18.1 + github.com/openziti/sdk-golang v0.18.2 github.com/openziti/storage v0.1.26 github.com/openziti/transport/v2 v2.0.41 github.com/openziti/xweb/v2 v2.0.2 @@ -168,7 +168,7 @@ require ( go.mongodb.org/mongo-driver v1.10.0 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect golang.org/x/crypto v0.3.0 // indirect - golang.org/x/exp v0.0.0-20221114191408-850992195362 // indirect + golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect golang.org/x/image v0.1.0 // indirect golang.org/x/mod v0.6.0 // indirect golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect diff --git a/go.sum b/go.sum index bab64a661..e30d9855e 100644 --- a/go.sum +++ b/go.sum @@ -710,8 +710,8 @@ github.com/openziti/metrics v1.1.6 h1:fc4t5JEuYYr4gr+tF3qNpbvQ55QhoLyeOG+hiDfKLF github.com/openziti/metrics v1.1.6/go.mod h1:07aMMS1VNzZvz0246fX73SFfuuoRz2nKcvDJumrVlZ0= github.com/openziti/runzmd v1.0.3 h1:g+JyJS66ykMIidLTzroKBLwbsSF9S1hDvolj2PpD8lE= github.com/openziti/runzmd v1.0.3/go.mod h1:2YuoQl5zZ6edfb+k1MjglW2cwfZvXwug2WldvBIUNrU= -github.com/openziti/sdk-golang v0.18.1 h1:/Ge1PiTvGG99Qm1Ry5T50ay7QCMuy5Rz7HbqMP2mcEQ= -github.com/openziti/sdk-golang v0.18.1/go.mod h1:k/QRh6WA2zFsALuWC6X6+exmzbC/ddXFpRcx5FRDvQM= +github.com/openziti/sdk-golang v0.18.2 h1:RA+47vGtPwzqrgWlgTyqKurttvzhG25bu9qnhEU1Ghw= +github.com/openziti/sdk-golang v0.18.2/go.mod h1:79XTAIkizuRq5NpAex3Yg7oDH/fcNSlcrVeSiYEf2q0= github.com/openziti/storage v0.1.26 h1:1tV4czY/TNmzX3raUZjbR8jVl5L92pdD0SjmdzCzUmE= github.com/openziti/storage v0.1.26/go.mod h1:Zkm+4d2gckkIbuuCw/sKFWKKhPROZak3gLFzdII0KWQ= github.com/openziti/transport/v2 v2.0.41 h1:T9RPXsJ0wbDgIx6mjKY1YDOg6ncRDmLPq8xU52B0mvU= @@ -1016,8 +1016,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ= -golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 h1:yZNXmy+j/JpX19vZkVktWqAo7Gny4PBWYYK3zskGpx4= +golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= diff --git a/network-tests/ami/README.md b/network-tests/ami/README.md new file mode 100644 index 000000000..4f0bd3816 --- /dev/null +++ b/network-tests/ami/README.md @@ -0,0 +1,17 @@ +# Ziti AMI + +This folder shows how to use [Packer](https://www.packer.io/) to create an [Amazon Machine +Image (AMI)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) that has the necessary prerequisites for running fablab based OpenZiti smoketests installed on top of Ubuntu 22.04. + +## Quick start + +To build the Ziti AMI: + +1. `git clone` this repo to your computer. +1. Install [Packer](https://www.packer.io/). +1. Configure your AWS credentials using one of the [options supported by the AWS + SDK](http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html). Usually, the easiest option is to + set the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. +1. Run `packer build ziti-ami.pkr.hcl`. + +When the build finishes, it will output the ID of the new AMI. \ No newline at end of file diff --git a/network-tests/ami/cleanup-old-images.sh b/network-tests/ami/cleanup-old-images.sh new file mode 100755 index 000000000..174e264fc --- /dev/null +++ b/network-tests/ami/cleanup-old-images.sh @@ -0,0 +1,10 @@ +regions=( +"us-east-1" +"us-west-2" +) + + +for region in ${regions[@]}; +do + aws ec2 describe-images --region ${region} --owners self --filters Name="name",Values="ziti-tests-*" | jq '[.Images[] | { Id: .ImageId, Date: .CreationDate}] | sort_by(.Date)' | jq -r '.[] | .Id ' | head -n -1 | xargs -t -r -n 1 aws ec2 deregister-image --region ${region} --image-id +done diff --git a/network-tests/ami/etc/apt/apt.conf.d/99remote-not-fancy b/network-tests/ami/etc/apt/apt.conf.d/99remote-not-fancy new file mode 100644 index 000000000..ce12e07e0 --- /dev/null +++ b/network-tests/ami/etc/apt/apt.conf.d/99remote-not-fancy @@ -0,0 +1,2 @@ +Binary::apt::APT::Color "0"; +Binary::apt::DPkg::Progress-Fancy "0"; \ No newline at end of file diff --git a/network-tests/ami/etc/sysctl.d/51-network-tuning.conf b/network-tests/ami/etc/sysctl.d/51-network-tuning.conf new file mode 100644 index 000000000..edc76a389 --- /dev/null +++ b/network-tests/ami/etc/sysctl.d/51-network-tuning.conf @@ -0,0 +1,9 @@ +# adjust the socket buffer sizes +net.core.rmem_max = 16777216 +net.core.wmem_max = 16777216 +net.core.rmem_default = 16777216 +net.core.wmem_default = 16777216 +net.ipv4.tcp_rmem = 4096 87380 16777216 +net.ipv4.tcp_wmem = 4096 65536 16777216 +net.ipv4.tcp_mem = 8388608 8388608 16777216 +net.ipv4.udp_mem = 8388608 8388608 16777216 \ No newline at end of file diff --git a/network-tests/ami/list-images.sh b/network-tests/ami/list-images.sh new file mode 100755 index 000000000..11c49393b --- /dev/null +++ b/network-tests/ami/list-images.sh @@ -0,0 +1,11 @@ +regions=( +"us-east-1" +"us-west-2" +) + + +for region in ${regions[@]}; +do + echo "Region: ${region}" + aws ec2 describe-images --region ${region} --owners self --filters Name="name",Values="ziti-tests-*" | jq '[.Images[] | { Id: .ImageId, Date: .CreationDate}] | sort_by(.Date)' | jq -r '.[] | (.Id + " " + .Date) ' +done diff --git a/network-tests/ami/ziti-ami.pkr.hcl b/network-tests/ami/ziti-ami.pkr.hcl new file mode 100644 index 000000000..a48399412 --- /dev/null +++ b/network-tests/ami/ziti-ami.pkr.hcl @@ -0,0 +1,68 @@ +packer { + required_version = ">= 1.6.0" + + required_plugins { + amazon = { + version = ">= 1.1.1" + source = "github.com/hashicorp/amazon" + } + } +} + +source "amazon-ebs" "ziti-tests-ubuntu-ami" { + ami_description = "An Ubuntu AMI that has everything needed for running fablab smoketests." + ami_name = "ziti-tests-{{ timestamp }}" + ami_regions = ["us-east-1", "us-west-2"] + instance_type = "t2.micro" + region = "us-east-1" + source_ami_filter { + filters = { + architecture = "x86_64" + name = "ubuntu/images/*/ubuntu-jammy-22.04-amd64-server-*" + root-device-type = "ebs" + virtualization-type = "hvm" + } + most_recent = true + owners = ["099720109477"] + } + ssh_username = "ubuntu" +} + +build { + sources = ["source.amazon-ebs.ziti-tests-ubuntu-ami"] + + provisioner "file" { + source = "etc/apt/apt.conf.d/99remote-not-fancy" + destination = "/home/ubuntu/99remote-not-fancy" + } + + provisioner "file" { + source = "etc/sysctl.d/51-network-tuning.conf" + destination = "/home/ubuntu/51-network-tuning.conf" + } + + provisioner "shell" { + inline = [ + "sudo mv /home/ubuntu/99remote-not-fancy /etc/apt/apt.conf.d/", + "sudo mv /home/ubuntu/51-network-tuning.conf /etc/sysctl.d/", + + "cloud-init status --wait", + + # add metricsbeat sources + "curl --fail --silent --show-error --location https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor | sudo dd of=/usr/share/keyrings/elasticsearch-archive-keyring.gpg", + "echo \"deb [arch=amd64 signed-by=/usr/share/keyrings/elasticsearch-archive-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main\" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list", + + # add consul sources + "curl --fail --silent --show-error --location https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo dd of=/usr/share/keyrings/hashicorp-archive-keyring.gpg", + "echo \"deb [arch=amd64 signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main\" | sudo tee -a /etc/apt/sources.list.d/hashicorp.list", + + "sudo apt update", + "sudo apt upgrade -y", + "sudo apt install -y iperf3 tcpdump sysstat", + "sudo apt install -y metricbeat=8.3.2", + "sudo apt install -y consul", + "sudo bash -c \"echo 'ubuntu soft nofile 40960' >> /etc/security/limits.conf\"", + "sudo sed -i 's/ENABLED=\"false\"/ENABLED=\"true\"/g' /etc/default/sysstat", + ] + } +} diff --git a/network-tests/go.mod b/network-tests/go.mod index 125148e4c..53b8b4905 100644 --- a/network-tests/go.mod +++ b/network-tests/go.mod @@ -3,8 +3,8 @@ module github.com/openziti/ziti/network-tests go 1.19 require ( - github.com/openziti/fablab v0.4.14 - github.com/openziti/sdk-golang v0.16.146 + github.com/openziti/fablab v0.4.15 + github.com/openziti/sdk-golang v0.18.2 github.com/openziti/zitilab v0.1.9 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.6.1 @@ -27,12 +27,12 @@ require ( github.com/blang/semver v3.5.1+incompatible // indirect github.com/boltdb/bolt v1.3.1 // indirect github.com/c-bata/go-prompt v0.2.6 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 // indirect github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect github.com/disintegration/imaging v1.6.2 // indirect - github.com/dlclark/regexp2 v1.4.0 // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/ef-ds/deque v1.0.4 // indirect github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect @@ -57,7 +57,7 @@ require ( github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098 // indirect + github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect @@ -80,8 +80,8 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/kyokomi/emoji/v2 v2.2.8 // indirect - github.com/lucasb-eyer/go-colorful v1.0.3 // indirect + github.com/kyokomi/emoji/v2 v2.2.10 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/lucsky/cuid v1.2.1 // indirect github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect github.com/magiconair/properties v1.8.5 // indirect @@ -104,18 +104,19 @@ require ( 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.5 // indirect - github.com/openziti/channel/v2 v2.0.12 // indirect - github.com/openziti/edge v0.24.36 // indirect - github.com/openziti/fabric v0.21.17 // indirect + github.com/openziti/channel/v2 v2.0.15 // indirect + github.com/openziti/edge v0.24.50 // indirect + github.com/openziti/fabric v0.21.21 // indirect github.com/openziti/foundation/v2 v2.0.7 // indirect - github.com/openziti/identity v1.0.20 // indirect + github.com/openziti/identity v1.0.23 // indirect github.com/openziti/jwks v1.0.2 // indirect - github.com/openziti/metrics v1.1.5 // indirect + github.com/openziti/metrics v1.1.6 // indirect + github.com/openziti/runzmd v1.0.3 // indirect github.com/openziti/storage v0.1.26 // indirect - github.com/openziti/transport/v2 v2.0.38 // indirect + github.com/openziti/transport/v2 v2.0.41 // indirect github.com/openziti/x509-claims v1.0.3 // indirect github.com/openziti/xweb/v2 v2.0.2 // indirect - github.com/openziti/ziti v0.26.10 // indirect + github.com/openziti/ziti v0.26.11 // indirect github.com/openziti/ziti-db-explorer v1.1.1 // indirect github.com/orcaman/concurrent-map/v2 v2.0.0 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect @@ -140,7 +141,7 @@ require ( github.com/stretchr/testify v1.8.1 // 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.10 // indirect + github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -151,15 +152,16 @@ require ( go.etcd.io/bbolt v1.3.6 // indirect go.mongodb.org/mongo-driver v1.10.0 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect - golang.org/x/crypto v0.1.0 // indirect - golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/net v0.1.0 // indirect + golang.org/x/crypto v0.3.0 // indirect + golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect + golang.org/x/image v0.1.0 // indirect + golang.org/x/mod v0.6.0 // indirect + golang.org/x/net v0.2.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.2.0 // indirect golang.org/x/term v0.2.0 // indirect golang.org/x/text v0.4.0 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/tools v0.2.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.7 // indirect gopkg.in/ini.v1 v1.66.2 // indirect diff --git a/network-tests/go.sum b/network-tests/go.sum index 99bf2aa04..3ef802002 100644 --- a/network-tests/go.sum +++ b/network-tests/go.sum @@ -122,8 +122,8 @@ github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBW github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI= github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY= github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -158,8 +158,9 @@ github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663/go.mod h1:Kad2 github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -316,8 +317,9 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098 h1:Qxs3bNRWe8GTcKMxYOSXm0jx6j0de8XUtb/fsP3GZ0I= github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= +github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c h1:iyaGYbCmcYK0Ja9a3OUa2Fo+EaN0cbLu0eKpBwPFzc8= +github.com/gomarkdown/markdown v0.0.0-20221013030248-663e2500819c/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= @@ -471,14 +473,16 @@ github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kyokomi/emoji/v2 v2.2.8 h1:jcofPxjHWEkJtkIbcLHvZhxKgCPl6C7MyjTrD4KDqUE= github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= +github.com/kyokomi/emoji/v2 v2.2.10 h1:1z5eMVcxFifsmEoNpdeq4UahbcicgQ4FEHuzrCVwmiI= +github.com/kyokomi/emoji/v2 v2.2.10/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= github.com/linode/linodego v0.21.0/go.mod h1:UTpq1JUZD0CZsJ8rt+0CRkqbzrp1MbGakVPt2DXY5Mk= github.com/liquidweb/liquidweb-go v1.6.1/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= -github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucsky/cuid v1.2.1 h1:MtJrL2OFhvYufUIn48d35QGXyeTC8tn0upumW9WwTHg= github.com/lucsky/cuid v1.2.1/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= @@ -595,34 +599,36 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openziti/agent v1.0.5 h1:wZUcMYqvwspOjDSaejMtczSXnJoqK0edI9HcEIFsTIs= github.com/openziti/agent v1.0.5/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= -github.com/openziti/channel/v2 v2.0.12 h1:0/qQ3qCSt70gpUuxQk8MRD3+iGKqS4wuYZpbcOzS+tc= -github.com/openziti/channel/v2 v2.0.12/go.mod h1:mESOWBphvr2/P6j3FDIiQF+Z6z3E3Vjv6GaCoGWY6eM= -github.com/openziti/edge v0.24.36 h1:3ywHRL5XXYtA4+y12WptofLhkndshePuy/MyKT3A2xo= -github.com/openziti/edge v0.24.36/go.mod h1:3I6GZTcb3j57Y9IlBrnpceklfzdR10ejp4D7+11B6BM= -github.com/openziti/fablab v0.4.14 h1:765ha5lu3TEznhQP1LVAyLYfPJsVLYFLoP8tIvrfCtc= -github.com/openziti/fablab v0.4.14/go.mod h1:FmnlfLEQUa/Gdf82wnkQLFe44lGexoIxGd+JOtRIMHs= -github.com/openziti/fabric v0.21.17 h1:oT32L0Lu64Jd7CkHrQZdOwG0Mew8bMBEUowtRyhERvs= -github.com/openziti/fabric v0.21.17/go.mod h1:VsRUi2wdA3k4bOXxfrohaoUuhcjf8ZdpPPN0NzD8my4= +github.com/openziti/channel/v2 v2.0.15 h1:y1YwewnZTPTPtE3YVjaVpOWGoqJ3+I8+7KqQB4D3poQ= +github.com/openziti/channel/v2 v2.0.15/go.mod h1:LdoKRnefknW4WllUyHJtvKDtKK716lYdHqApKbBy3rk= +github.com/openziti/edge v0.24.50 h1:gmtjAJISV1mLXWSJmyRunVcZ6gk7WPS2aPkFaWh34uo= +github.com/openziti/edge v0.24.50/go.mod h1:71Cp8bypuFbJpt7FPsETZrmLdmHagFcWKDD+SzsIL0s= +github.com/openziti/fablab v0.4.15 h1:4sLJ9UC4rmpYOaxjTmwtfA2h/uwmVifwdpVJUBW6eQ4= +github.com/openziti/fablab v0.4.15/go.mod h1:FmnlfLEQUa/Gdf82wnkQLFe44lGexoIxGd+JOtRIMHs= +github.com/openziti/fabric v0.21.21 h1:vswdjm4xvZuCps62S4JjZZyA43YYLgc0uOCx6tdXWUY= +github.com/openziti/fabric v0.21.21/go.mod h1:F6L8c4AnNOACdx2IJqSW2JLG6J3Gm798BLL58sBYtZY= github.com/openziti/foundation/v2 v2.0.7 h1:QtpP0ntUhr/7uLR1iM7eEkrusQ2b2ZqTblgdq8cac9Y= github.com/openziti/foundation/v2 v2.0.7/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= -github.com/openziti/identity v1.0.20 h1:8nsQFHpqKS1ByD8QuPDxQWfS8CQEidyn5jFXWnXguX0= -github.com/openziti/identity v1.0.20/go.mod h1:X0WLWEgnM1iL8asNbuu7vUW0kZq8nnWKepMW214C9Mk= +github.com/openziti/identity v1.0.23 h1:SJ2UN3qCiUKwuwFc0dr3nuHyKvhOr5aN5bEJa2wY9Sw= +github.com/openziti/identity v1.0.23/go.mod h1:uVqZEC4Lr7pEud9b5g0h/cH0Ir5K0egCjUrEVup4ERc= github.com/openziti/jwks v1.0.2 h1:32BGXIAnefS+v7uXKPb1x8/cQ7srek6Ai06dsrMTY4E= github.com/openziti/jwks v1.0.2/go.mod h1:KwO0x9FBG0aoJS5f6nH5xeHoplyR1H143SMI9kF0mC8= -github.com/openziti/metrics v1.1.5 h1:qhsGsYWdp7LxPCYi9WMGHGbjiHvsT1DtjM44JNHLZWk= -github.com/openziti/metrics v1.1.5/go.mod h1:B6RCuVRTpI3kEIhQlCvsHj3Pqi6bSnqFmRPgfgv9ico= -github.com/openziti/sdk-golang v0.16.146 h1:5R7ZOSh+Q0pmZdzEv3l2Q03KQgiUrpaj3ymD8DjBT5k= -github.com/openziti/sdk-golang v0.16.146/go.mod h1:yOgsofdEd82pph97N4DX0xYlfgjJ2LCgC/mHkMw+5hU= +github.com/openziti/metrics v1.1.6 h1:fc4t5JEuYYr4gr+tF3qNpbvQ55QhoLyeOG+hiDfKLF8= +github.com/openziti/metrics v1.1.6/go.mod h1:07aMMS1VNzZvz0246fX73SFfuuoRz2nKcvDJumrVlZ0= +github.com/openziti/runzmd v1.0.3 h1:g+JyJS66ykMIidLTzroKBLwbsSF9S1hDvolj2PpD8lE= +github.com/openziti/runzmd v1.0.3/go.mod h1:2YuoQl5zZ6edfb+k1MjglW2cwfZvXwug2WldvBIUNrU= +github.com/openziti/sdk-golang v0.18.2 h1:RA+47vGtPwzqrgWlgTyqKurttvzhG25bu9qnhEU1Ghw= +github.com/openziti/sdk-golang v0.18.2/go.mod h1:79XTAIkizuRq5NpAex3Yg7oDH/fcNSlcrVeSiYEf2q0= github.com/openziti/storage v0.1.26 h1:1tV4czY/TNmzX3raUZjbR8jVl5L92pdD0SjmdzCzUmE= github.com/openziti/storage v0.1.26/go.mod h1:Zkm+4d2gckkIbuuCw/sKFWKKhPROZak3gLFzdII0KWQ= -github.com/openziti/transport/v2 v2.0.38 h1:9+EtBF052TtGvT5isuPj/SUTXNHg8RbkGBcEKfiUPd8= -github.com/openziti/transport/v2 v2.0.38/go.mod h1:FB/pqmA8RdUsoWtpTc6E/it6lLdA7GOugy9no3JDU/4= +github.com/openziti/transport/v2 v2.0.41 h1:T9RPXsJ0wbDgIx6mjKY1YDOg6ncRDmLPq8xU52B0mvU= +github.com/openziti/transport/v2 v2.0.41/go.mod h1:YM4hnHjHK1gQZuWgmDoPGSDP+8l7uT8kT8oBGM1u6nk= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.0.2 h1:XYlVFriTq/U1wcUrc+XPnWJGhXh9NJPhtQ7+r3aC0cU= github.com/openziti/xweb/v2 v2.0.2/go.mod h1:KQOOlnJk08EZT3TWkvDj/pbIUEVbgG0IrrNzl8gsi40= -github.com/openziti/ziti v0.26.10 h1:aPikHYJa/KvzgTiRW2hGw8f2L/+NsFgy8sbHXcuxwbU= -github.com/openziti/ziti v0.26.10/go.mod h1:hbl02rbQ8l6+kF/vXolNPCdZLQ3WKkSGEc7xeRPEl4c= +github.com/openziti/ziti v0.26.11 h1:umXrmrBnbQeSV/hsKTdor/hWx/tJ5Hs/Xv/k5GXitL0= +github.com/openziti/ziti v0.26.11/go.mod h1:GJ6thwbiuCRf5rRO2/lalmvZVdWCQkLgiX7i8zAhuUo= 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/zitilab v0.1.9 h1:NWUgq4ZyZIhXlH9HVL19JK6ArDnTNLnlKOteE6PLa8E= @@ -765,8 +771,9 @@ github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 h1:3SNcvBmEPE1YlB github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= +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/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= @@ -796,6 +803,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= @@ -842,10 +850,11 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -856,11 +865,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-20221126150942-6ab00d035af9 h1:yZNXmy+j/JpX19vZkVktWqAo7Gny4PBWYYK3zskGpx4= +golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 h1:gQ6GUSD102fPgli+Yb4cR/cGaHF7tNBt+GYoRCpGC7s= golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk= +golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c= 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= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -884,8 +896,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -937,8 +950,9 @@ golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -963,6 +977,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1043,6 +1058,7 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= @@ -1127,8 +1143,9 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/network-tests/simple-transfer/main.go b/network-tests/simple-transfer/main.go index d2b00b4d3..8ea2500da 100644 --- a/network-tests/simple-transfer/main.go +++ b/network-tests/simple-transfer/main.go @@ -3,14 +3,11 @@ package main import ( "embed" "fmt" - "os" - "time" - "github.com/openziti/fablab" "github.com/openziti/fablab/kernel/lib/actions/component" "github.com/openziti/fablab/kernel/lib/binding" "github.com/openziti/fablab/kernel/lib/runlevel/0_infrastructure/aws_ssh_key" - semaphore_0 "github.com/openziti/fablab/kernel/lib/runlevel/0_infrastructure/semaphore" + semaphore0 "github.com/openziti/fablab/kernel/lib/runlevel/0_infrastructure/semaphore" terraform_0 "github.com/openziti/fablab/kernel/lib/runlevel/0_infrastructure/terraform" "github.com/openziti/fablab/kernel/lib/runlevel/1_configuration/config" "github.com/openziti/fablab/kernel/lib/runlevel/2_kitting/devkit" @@ -21,11 +18,12 @@ import ( "github.com/openziti/fablab/kernel/model" "github.com/openziti/fablab/resources" "github.com/openziti/ziti/network-tests/simple-transfer/actions" - runlevel_0_infrastructure "github.com/openziti/ziti/network-tests/simple-transfer/stages/0_infrastructure" + "github.com/openziti/ziti/network-tests/test_resources" "github.com/openziti/zitilab" - zitilib_runlevel_0_infrastructure "github.com/openziti/zitilab/runlevel/0_infrastructure" zitilib_runlevel_1_configuration "github.com/openziti/zitilab/runlevel/1_configuration" "github.com/sirupsen/logrus" + "os" + "time" ) //go:embed configs @@ -79,7 +77,7 @@ var m = &model.Model{ Resources: model.Resources{ resources.Configs: resources.SubFolder(configResource, "configs"), - resources.Terraform: resources.DefaultTerraformResources(), + resources.Terraform: test_resources.TerraformResources(), }, Regions: model.Regions{ @@ -92,7 +90,7 @@ var m = &model.Model{ Components: model.Components{ "ctrl": { Scope: model.Scope{Tags: model.Tags{"ctrl"}}, - BinaryName: "ziti-controller", + BinaryName: "ziti controller", ConfigSrc: "ctrl.yml", ConfigName: "ctrl.yml", PublicIdentity: "ctrl", @@ -107,14 +105,14 @@ var m = &model.Model{ Components: model.Components{ "router-east": { Scope: model.Scope{Tags: model.Tags{"edge-router", "terminator"}}, - BinaryName: "ziti-router", + BinaryName: "ziti router", ConfigSrc: "router.yml", ConfigName: "router-east.yml", PublicIdentity: "router-east", - RunWithSudo: true, }, "echo-server": { Scope: model.Scope{Tags: model.Tags{"sdk-app", "service"}}, + BinaryName: "echo-server", PublicIdentity: "echo-server", }, "consul": { @@ -134,14 +132,14 @@ var m = &model.Model{ Components: model.Components{ "router-west": { Scope: model.Scope{Tags: model.Tags{"edge-router", "terminator"}}, - BinaryName: "ziti-router", + BinaryName: "ziti router", ConfigSrc: "router.yml", ConfigName: "router-west.yml", PublicIdentity: "router-west", - RunWithSudo: true, }, "echo-client": { Scope: model.Scope{Tags: model.Tags{"sdk-app", "client"}}, + BinaryName: "echo-client", PublicIdentity: "echo-client", }, "consul": { @@ -172,9 +170,7 @@ var m = &model.Model{ Infrastructure: model.InfrastructureStages{ aws_ssh_key.Express(), terraform_0.Express(), - runlevel_0_infrastructure.RetryInfra(zitilib_runlevel_0_infrastructure.InstallMetricbeat("*", zitilib_runlevel_0_infrastructure.RECCOMENDED_METRICBEAT_VERSION), 5), - runlevel_0_infrastructure.RetryInfra(zitilib_runlevel_0_infrastructure.InstallConsul("*"), 5), - semaphore_0.Restart(90 * time.Second), + semaphore0.Ready(time.Minute), }, Configuration: model.ConfigurationStages{ @@ -183,8 +179,7 @@ var m = &model.Model{ zitilib_runlevel_1_configuration.DotZiti(), ), config.Component(), - zitilab.DefaultZitiBinaries(), - devkit.DevKitF(zitilab.ZitiRoot, []string{"ziti-echo"}), + devkit.DevKitF(zitilab.ZitiRoot, []string{"ziti", "ziti-echo"}), }, Distribution: model.DistributionStages{ diff --git a/network-tests/simple-transfer/stages/0_infrastructure/retry.go b/network-tests/simple-transfer/stages/0_infrastructure/retry.go deleted file mode 100644 index 808ebe160..000000000 --- a/network-tests/simple-transfer/stages/0_infrastructure/retry.go +++ /dev/null @@ -1,33 +0,0 @@ -package runlevel_0_infrastructure - -import ( - "fmt" - - "github.com/openziti/fablab/kernel/model" - "github.com/sirupsen/logrus" -) - -type retry struct { - stage model.InfrastructureStage - retries int -} - -func RetryInfra(stage model.InfrastructureStage, retries int) model.InfrastructureStage { - return &retry{ - stage: stage, - retries: retries, - } -} - -func (r *retry) Express(run model.Run) error { - var err error - for i := 0; i < r.retries; i++ { - if e := r.stage.Express(run); e == nil { - continue - } else { - err = fmt.Errorf("%w", e) - } - } - logrus.Warn("Infra stage successful after retries. Earlier errors: [%w]", err) - return nil -} diff --git a/network-tests/test_resources/resource.go b/network-tests/test_resources/resource.go new file mode 100644 index 000000000..9d24b3088 --- /dev/null +++ b/network-tests/test_resources/resource.go @@ -0,0 +1,14 @@ +package test_resources + +import ( + "embed" + "github.com/openziti/fablab/resources" + "io/fs" +) + +//go:embed terraform +var terraformResource embed.FS + +func TerraformResources() fs.FS { + return resources.SubFolder(terraformResource, resources.Terraform) +} diff --git a/network-tests/test_resources/terraform/main.tf b/network-tests/test_resources/terraform/main.tf new file mode 100644 index 000000000..b101aa159 --- /dev/null +++ b/network-tests/test_resources/terraform/main.tf @@ -0,0 +1,42 @@ +variable "environment_tag" { default = "{{ .Model.MustVariable "environment" }}" } +variable "aws_access_key" { default = "{{ .Model.MustVariable "credentials.aws.access_key" }}" } +variable "aws_secret_key" { default = "{{ .Model.MustVariable "credentials.aws.secret_key" }}" } +variable "aws_key_name" { default = "{{ .Model.MustVariable "credentials.aws.ssh_key_name" }}" } +variable "aws_key_path" { default = "{{ .Model.MustVariable "credentials.ssh.key_path" }}" } + +variable "vpc_cidr" { default = "10.0.0.0/16" } +variable "public_cidr" { default = "10.0.0.0/24" } + +{{ range $regionId, $region := .Model.Regions }} +module "{{ $regionId }}_region" { + source = "{{ $.TerraformLib }}/vpc" + access_key = var.aws_access_key + secret_key = var.aws_secret_key + region = "{{ $region.Region }}" + vpc_cidr = var.vpc_cidr + public_cidr = var.public_cidr + az = "{{ $region.Site }}" + environment_tag = var.environment_tag +} + +{{ range $hostId, $host := $region.Hosts }} +module "{{ $regionId }}_host_{{ $hostId }}" { + source = "{{ $.TerraformLib }}/{{ instanceTemplate $host }}_instance" + access_key = var.aws_access_key + secret_key = var.aws_secret_key + environment_tag = var.environment_tag + instance_type = "{{ $host.InstanceType }}" + key_name = var.aws_key_name + key_path = var.aws_key_path + region = "{{ $region.Region }}" + security_group_id = module.{{ $regionId }}_region.security_group_id + subnet_id = module.{{ $regionId }}_region.subnet_id + spot_price = "{{ $host.SpotPrice }}" + spot_type = "{{ $host.SpotType }}" + name = "{{ $region.Model.MustVariable "environment" }}.{{ $host.Id }}" +} + +output "{{ $regionId }}_host_{{ $hostId }}_public_ip" { value = module.{{ $regionId }}_host_{{ $hostId }}.public_ip } +output "{{ $regionId }}_host_{{ $hostId }}_private_ip" { value = module.{{ $regionId }}_host_{{ $hostId }}.private_ip } +{{ end }} +{{ end }} diff --git a/network-tests/test_resources/terraform/ondemand_instance/main.tf b/network-tests/test_resources/terraform/ondemand_instance/main.tf new file mode 100644 index 000000000..c87424bd5 --- /dev/null +++ b/network-tests/test_resources/terraform/ondemand_instance/main.tf @@ -0,0 +1,45 @@ +variable "name" {} +variable "access_key" {} +variable "secret_key" {} +variable "environment_tag" { default = "" } +variable "instance_type" {} +variable "key_name" {} +variable "key_path" {} +variable "region" {} +variable "security_group_id" {} +variable "ssh_user" { default = "ubuntu" } +variable "subnet_id" {} +variable "spot_price" {} +variable "spot_type" {} + +output "public_ip" { value = aws_instance.fablab.public_ip } +output "private_ip" { value = aws_instance.fablab.private_ip } + +provider "aws" { + access_key = var.access_key + secret_key = var.secret_key + region = var.region +} + +data "aws_ami" "ami" { + most_recent = true + owners = ["self"] + + filter { + name = "name" + values = ["ziti-tests-*"] + } +} + +resource "aws_instance" "fablab" { + ami = data.aws_ami.ami.id + instance_type = var.instance_type + key_name = var.key_name + vpc_security_group_ids = [var.security_group_id] + subnet_id = var.subnet_id + associate_public_ip_address = true + + tags = { + Name = var.name + } +} diff --git a/network-tests/test_resources/terraform/vpc/main.tf b/network-tests/test_resources/terraform/vpc/main.tf new file mode 100644 index 000000000..87f8d5782 --- /dev/null +++ b/network-tests/test_resources/terraform/vpc/main.tf @@ -0,0 +1,129 @@ +variable "access_key" {} +variable "secret_key" {} +variable "region" {} +variable "vpc_cidr" {} +variable "public_cidr" {} +variable "az" {} +variable "environment_tag" {} + +output "security_group_id" { value = aws_security_group.fablab.id } +output "subnet_id" { value = aws_subnet.fablab.id } + +provider "aws" { + access_key = var.access_key + secret_key = var.secret_key + region = var.region +} + +resource "aws_vpc" "fablab" { + cidr_block = var.vpc_cidr + enable_dns_hostnames = true + tags = { + Name = var.environment_tag + } +} + +resource "aws_internet_gateway" "fablab" { + vpc_id = aws_vpc.fablab.id +} + +resource "aws_subnet" "fablab" { + vpc_id = aws_vpc.fablab.id + cidr_block = var.public_cidr + availability_zone = var.az + tags = { + Name = var.environment_tag + } +} + +resource "aws_route_table" "fablab" { + vpc_id = aws_vpc.fablab.id + route { + cidr_block = "0.0.0.0/0" + gateway_id = aws_internet_gateway.fablab.id + } + tags = { + Name = var.environment_tag + } +} + +resource "aws_route_table_association" "fablab" { + subnet_id = aws_subnet.fablab.id + route_table_id = aws_route_table.fablab.id +} + +resource "aws_security_group" "fablab" { + name = var.environment_tag + vpc_id = aws_vpc.fablab.id + + ingress { + from_port = 10000 + to_port = 10000 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 8171 + to_port = 8171 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 7001 + to_port = 7005 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 7001 + to_port = 7001 + protocol = "udp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 6262 + to_port = 6262 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 6262 + to_port = 6262 + protocol = "udp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 6000 + to_port = 6009 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 6000 + to_port = 6009 + protocol = "udp" + cidr_blocks = ["0.0.0.0/0"] + } + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + from_port = 1280 + to_port = 1280 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + tags = { + Name = var.environment_tag + } +} \ No newline at end of file diff --git a/network-tests/utils/actions/echoServer.go b/network-tests/utils/actions/echoServer.go index 411a2353b..001ce9280 100644 --- a/network-tests/utils/actions/echoServer.go +++ b/network-tests/utils/actions/echoServer.go @@ -23,14 +23,14 @@ func (esi *echoServerStart) Execute(m *model.Model) error { ssh := lib.NewSshConfigFactory(c.GetHost()) remoteConfigFile := "/home/ubuntu/fablab/cfg/" + c.PublicIdentity + ".json" - echoServerCmd := fmt.Sprintf("screen -d -m nohup /home/%s/fablab/bin/ziti-echo server --identity %s 2>&1 &", + echoServerCmd := fmt.Sprintf("nohup /home/%s/fablab/bin/ziti-echo server --identity %s > /home/ubuntu/logs/ziti-echo.log 2>&1 &", ssh.User(), remoteConfigFile) if output, err := lib.RemoteExec(ssh, echoServerCmd); err != nil { logrus.Errorf("error starting echo server [%s] (%v)", output, err) return err } - logrus.Error("After remote starting echo server") + logrus.Info("echo server started") return nil }) } From 4453d9288dc9e9a3c1323ed146cb7f7f2696897e Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Mon, 28 Nov 2022 16:56:06 -0500 Subject: [PATCH 29/46] focus the start/stop functions on the expressInstall experience --- quickstart/docker/image/ziti-cli-functions.sh | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index d9cf83306..f722c01fd 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -77,24 +77,8 @@ function stopZitiController { echo "Controller stopped." return 0 fi - elif which pkill &>/dev/null; then - # shellcheck disable=SC2015 - pkill ziti-controller && { - echo "Controller stopped." - } || { - echo "ERROR: something went wrong with stopping the controller" >&2 - return 1 - } - elif which killall &>/dev/null; then - # shellcheck disable=SC2015 - killall ziti-controller && { - echo "Controller stopped." - } || { - echo "ERROR: something went wrong with stopping the controller" >&2 - return 1 - } else - echo "ERROR: need 'pkill' or 'killall' command to kill controller that was not started with startZitiController" >&2 + echo "ERROR: you can only stop a controller process that was started with startZitiController" >&2 return 1 fi } @@ -116,24 +100,8 @@ function stopAllEdgeRouters { echo "ERROR: something went wrong with stopping the router(s)" >&2 return 1 } - elif which pkill &>/dev/null; then - # shellcheck disable=SC2015 - pkill ziti-router && { - echo "Router(s) stopped." - } || { - echo "ERROR: something went wrong with stopping the router(s)" >&2 - return 1 - } - elif which killall &>/dev/null; then - # shellcheck disable=SC2015 - killall ziti-router && { - echo "Router(s) stopped." - } || { - echo "ERROR: something went wrong with stopping the router(s)" >&2 - return 1 - } else - echo "ERROR: need 'pkill' or 'killall' command to kill routers that were not started with startExpressEdgeRouter" >&2 + echo "ERROR: you can only stop a router process that was started with startExpressEdgeRouter" >&2 return 1 fi } @@ -471,7 +439,7 @@ function ziti_expressConfiguration { # Stop any devices currently running to avoid port collisions stopAllEdgeRouters - stopZitiController "${ZITI_EXPRESS_CONTROLLER_PID}" + stopZitiController else echo -e "$(RED " --- Exiting express install ---")" return 1 @@ -566,7 +534,7 @@ function ziti_expressConfiguration { "${ZITI_BIN_DIR-}/ziti-router" enroll "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.yaml" --jwt "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.jwt" &> "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.enrollment.log" echo "" - [[ -n ${ZITI_EXPRESS_CONTROLLER_PID:-} ]] && stopZitiController "${ZITI_EXPRESS_CONTROLLER_PID}" + stopZitiController echo "Edge Router enrolled. Controller stopped." echo "" From 3394d7f13830684275dbe898563ea813e88e4d28 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Mon, 28 Nov 2022 17:24:55 -0500 Subject: [PATCH 30/46] fix echo ansi colors --- quickstart/docker/image/ziti-cli-functions.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index f722c01fd..d7b0c7cbf 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -66,7 +66,7 @@ function startZitiController { # shellcheck disable=SC2034 "${ZITI_BIN_DIR-}/ziti-controller" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" &> "${log_file}" & ZITI_EXPRESS_CONTROLLER_PID=$! - echo "ziti-controller started as process id: $ZITI_EXPRESS_CONTROLLER_PID. log located at: $(BLUE "${ZITI_HOME-}/${ZITI_EDGE_CONTROLLER_RAWNAME}.log")" + echo -e "ziti-controller started as process id: $ZITI_EXPRESS_CONTROLLER_PID. log located at: $(BLUE "${log_file}")" } function stopZitiController { @@ -1028,13 +1028,13 @@ function ziti_createEnvFile { if [[ "${ZITI_USER-}" == "" ]]; then export ZITI_USER="admin"; fi if [[ "${ZITI_PWD-}" == "" ]]; then ZITI_PWD="$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c32)" - echo -e "Do you want to keep the generated admin password '$ZITI_PWD'? (Y/n)" + echo -en "Do you want to keep the generated admin password '$ZITI_PWD'? (Y/n)" # shellcheck disable=SC2162 - read ZITI_PWD_REPLY - if [[ -z "${ZITI_PWD_REPLY}" || ${ZITI_PWD_REPLY} =~ [yY] ]]; then + read -r pwd_reply + if [[ -z "${pwd_reply}" || ${pwd_reply} =~ [yY] ]]; then echo "INFO: using ZITI_PWD=${ZITI_PWD}" else - echo "Type the preferred admin password and press " + echo -en "Type the preferred admin password and press " read -r ZITI_PWD fi fi From b26cac7f8956a90d80dddaf37937ec3a04d998fe Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 29 Nov 2022 15:31:32 -0500 Subject: [PATCH 31/46] assign ZITI_PWD to known value for tests --- quickstart/docker/image/dockerTestEntrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quickstart/docker/image/dockerTestEntrypoint.sh b/quickstart/docker/image/dockerTestEntrypoint.sh index d11b11f59..abe8610f4 100755 --- a/quickstart/docker/image/dockerTestEntrypoint.sh +++ b/quickstart/docker/image/dockerTestEntrypoint.sh @@ -6,4 +6,6 @@ fi touch runonce source "${ZITI_SCRIPTS}/ziti-cli-functions.sh" +# Set the default password to be a specific value, if not set the password will be a random string and tests will fail +export ZITI_PWD=admin expressInstall "${ZITI_NETWORK}" \ No newline at end of file From bd74580f722564885c3d905de2db409ffe7d8b6f Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 29 Nov 2022 16:39:30 -0500 Subject: [PATCH 32/46] Addressing PR concerns Signed-off-by: gberl002 --- quickstart/docker/image/run-with-ziti-cli.sh | 5 ++++- quickstart/docker/image/ziti-cli-functions.sh | 12 ++++++++---- ziti/cmd/ziti/cmd/create_config_router_edge_test.go | 2 +- .../cmd/ziti/cmd/create_config_router_fabric_test.go | 4 +++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/quickstart/docker/image/run-with-ziti-cli.sh b/quickstart/docker/image/run-with-ziti-cli.sh index 13f83d232..e231c9ee5 100755 --- a/quickstart/docker/image/run-with-ziti-cli.sh +++ b/quickstart/docker/image/run-with-ziti-cli.sh @@ -29,7 +29,10 @@ if [[ -f "${initFile}" ]]; then fi # give the controller scripts time to start and create the ziti environment file if running in docker compose -until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 2; done +until $(test -f "${ZITI_HOME}/ziti.env"); do echo "waiting for ziti.env..."; sleep 1; done + +# Pause shortly to avoid the intermittent error of reading the file before it's completely done being written to. +sleep 1 . "${ZITI_SCRIPTS}/ziti-cli-functions.sh" diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index fd1e1692e..d8f4ac73e 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -291,10 +291,11 @@ function _portCheck { elif [[ -n "$BASH_VERSION" ]]; then envVarValue="${!envVar}" else - echo -e "Unknown/Unsupported shell, cannot check port status" - return 1 + echo -e "$(YELLOW "Unknown/Unsupported shell, cannot verify availability of ${2-}'s intended port, proceed with caution")" + return 0 fi + echo -e "Checking if ${2-}'s port (${envVarValue}) is available" portCheckResult=$(lsof -w -i :"${envVarValue}" 2> /dev/null) if [[ "${portCheckResult}" != "" ]]; then # Controller management plane echo -e "$(RED " ")" @@ -510,8 +511,11 @@ function ziti_expressConfiguration { returnCnt=$((returnCnt + $?)) _portCheck "ZITI_CTRL_MGMT_PORT" "Controller Management Plane" returnCnt=$((returnCnt + $?)) - _portCheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" - returnCnt=$((returnCnt + $?)) + if [[ "${ZITI_EDGE_ROUTER_LISTENER_BIND_PORT-}" != "" ]]; then + # This port can be explicitly set but is not always, only check if set + _portCheck "ZITI_EDGE_ROUTER_LISTENER_BIND_PORT" "Router Listener Bind Port" + returnCnt=$((returnCnt + $?)) + fi if [[ "returnCnt" -gt "0" ]]; then return 1; fi #checkHostsFile diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go index 2340771ab..98dc1eda2 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_edge_test.go @@ -191,7 +191,7 @@ func TestBlankEdgeRouterNameBecomesHostname(t *testing.T) { } func TestDefaultZitiEdgeRouterListenerBindPort(t *testing.T) { - expectedDefaultPort := "10080" + expectedDefaultPort := TEST_ROUTER_LISTENER_PORT // Make sure the related env vars are unset _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go index 6f5fb47fb..5b7805092 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go +++ b/ziti/cmd/ziti/cmd/create_config_router_fabric_test.go @@ -9,6 +9,8 @@ import ( "time" ) +var TEST_ROUTER_LISTENER_PORT = 10080 + func TestExecuteCreateConfigRouterFabricHasNonBlankTemplateValues(t *testing.T) { routerName := "MyFabricRouter" expectedNonEmptyStringFields := []string{".Router.Listener.BindPort", ".ZitiHome", ".Hostname", ".Router.Name", ".Router.IdentityCert", ".Router.IdentityServerCert", ".Router.IdentityKey", ".Router.IdentityCA", ".Router.Edge.Hostname", ".Router.Edge.Port"} @@ -112,7 +114,7 @@ func TestFabricRouterOutputPathDoesNotExist(t *testing.T) { } func TestDefaultZitiFabricRouterListenerBindPort(t *testing.T) { - expectedDefaultPort := "10080" + expectedDefaultPort := TEST_ROUTER_LISTENER_PORT // Make sure the related env vars are unset _ = os.Unsetenv("ZITI_EDGE_ROUTER_LISTENER_BIND_PORT") From 705abf598a564df14669c3158888af164eb1f6a2 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 29 Nov 2022 17:40:48 -0500 Subject: [PATCH 33/46] Fixing a misnamed dependency Signed-off-by: gberl002 --- ziti/cmd/create_config.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ziti/cmd/create_config.go b/ziti/cmd/create_config.go index 432172f6f..2dd5635fd 100644 --- a/ziti/cmd/create_config.go +++ b/ziti/cmd/create_config.go @@ -18,7 +18,7 @@ package cmd import ( "github.com/openziti/ziti/ziti/cmd/common" - helpers2 "github.com/openziti/ziti/ziti/cmd/helpers" + cmdHelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/constants" "os" "time" @@ -179,7 +179,7 @@ func init() { } } - workingDir = helpers2.NormalizePath(zh) + workingDir = cmdHelper.NormalizePath(zh) } // NewCmdCreateConfig creates a command object for the "config" command @@ -189,7 +189,7 @@ func NewCmdCreateConfig() *cobra.Command { Short: "Creates a config file for specified Ziti component using environment variables", Aliases: []string{"cfg"}, Run: func(cmd *cobra.Command, args []string) { - helpers2.CheckErr(cmd.Help()) + cmdHelper.CheckErr(cmd.Help()) }, } @@ -213,50 +213,50 @@ func (data *ConfigTemplateValues) populateEnvVars() { handleVariableError(err, "hostname") // Get and add ziti home to the params - zitiHome, err := helpers2.GetZitiHome() + zitiHome, err := cmdHelper.GetZitiHome() handleVariableError(err, constants.ZitiHomeVarName) // Get Ziti Controller Name - zitiCtrlHostname, err := helpers2.GetZitiCtrlName() + zitiCtrlHostname, err := cmdHelper.GetZitiCtrlName() handleVariableError(err, constants.ZitiCtrlNameVarName) // Get Ziti Edge Router Port - zitiEdgeRouterPort, err := helpers2.GetZitiEdgeRouterPort() + zitiEdgeRouterPort, err := cmdHelper.GetZitiEdgeRouterPort() handleVariableError(err, constants.ZitiEdgeRouterPortVarName) // Get Ziti Controller Listener Address - zitiCtrlListenerAddress, err := helpers2.GetZitiCtrlListenerAddress() + zitiCtrlListenerAddress, err := cmdHelper.GetZitiCtrlListenerAddress() handleVariableError(err, constants.ZitiCtrlListenerAddressVarName) // Get Ziti Controller Advertised Address - zitiCtrlAdvertisedAddress, err := helpers2.GetZitiCtrlAdvertisedAddress() + zitiCtrlAdvertisedAddress, err := cmdHelper.GetZitiCtrlAdvertisedAddress() handleVariableError(err, constants.ZitiCtrlAdvertisedAddressVarName) // Get Ziti Controller Port - zitiCtrlPort, err := helpers2.GetZitiCtrlPort() + zitiCtrlPort, err := cmdHelper.GetZitiCtrlPort() handleVariableError(err, constants.ZitiCtrlPortVarName) // Get Ziti Edge Controller Listener Host and Port - zitiEdgeCtrlListenerHostPort, err := helpers2.GetZitiEdgeCtrlListenerHostPort() + zitiEdgeCtrlListenerHostPort, err := cmdHelper.GetZitiEdgeCtrlListenerHostPort() handleVariableError(err, constants.ZitiEdgeCtrlListenerHostPortVarName) // Get Ziti Edge Controller Advertised Host and Port - zitiEdgeCtrlAdvertisedHostPort, err := helpers2.GetZitiEdgeCtrlAdvertisedHostPort() + zitiEdgeCtrlAdvertisedHostPort, err := cmdHelper.GetZitiEdgeCtrlAdvertisedHostPort() handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedHostPortVarName) // Get Ziti Edge Controller Advertised Port - zitiEdgeCtrlAdvertisedPort, err := helpers2.GetZitiEdgeCtrlAdvertisedPort() + zitiEdgeCtrlAdvertisedPort, err := cmdHelper.GetZitiEdgeCtrlAdvertisedPort() handleVariableError(err, constants.ZitiEdgeCtrlAdvertisedPortVarName) // Get Ziti edge Identity enrollment duration - zitiEdgeIdentityEnrollmentDuration, err := helpers2.GetZitiEdgeIdentityEnrollmentDuration() + zitiEdgeIdentityEnrollmentDuration, err := cmdHelper.GetZitiEdgeIdentityEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeIdentityEnrollmentDurationVarName) // Get Ziti edge Router enrollment duration - zitiEdgeRouterEnrollmentDuration, err := helpers2.GetZitiEdgeRouterEnrollmentDuration() + zitiEdgeRouterEnrollmentDuration, err := cmdHelper.GetZitiEdgeRouterEnrollmentDuration() handleVariableError(err, constants.ZitiEdgeRouterEnrollmentDurationVarName) - zitiEdgeRouterListenerBindPort, err := cmdhelper.GetZitiEdgeRouterListenerBindPort() + zitiEdgeRouterListenerBindPort, err := cmdHelper.GetZitiEdgeRouterListenerBindPort() handleVariableError(err, constants.ZitiEdgeRouterListenerBindPortVarName) data.ZitiHome = zitiHome From ce767e47b326830b9a014c41ed18b69756aed288 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 29 Nov 2022 19:18:30 -0500 Subject: [PATCH 34/46] Updated Simple Web Service test to use variables for the username and password now that passwords are random Signed-off-by: gberl002 --- quickstart/test/quickstart_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index 05bf77b5b..b92e84e6b 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -300,12 +300,15 @@ func TestQuickStartEnvFile(t *testing.T) { } /* -This is a manually run test that will, with the default values, 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 server on the back end. +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 +server on the back end. */ func TestSimpleWebService(t *testing.T) { // Wait for the controller to become available + zitiAdminUsername := "admin" + zitiAdminPassword := "admin" testerUsername := "gotester" ctrlAddress := "https://ziti-edge-controller:1280" hostingRouterName := "ziti-edge-router" @@ -328,7 +331,7 @@ func TestSimpleWebService(t *testing.T) { for _, ca := range caCerts { caPool.AddCert(ca) } - client, err := rest_util.NewEdgeManagementClientWithUpdb("admin", "admin", ctrlAddress, caPool) + client, err := rest_util.NewEdgeManagementClientWithUpdb(zitiAdminUsername, zitiAdminPassword, ctrlAddress, caPool) if err != nil { log.Fatal(err) } From 16289d3b320602575ca76bf68d741711e1ca37c5 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 29 Nov 2022 16:08:27 -0500 Subject: [PATCH 35/46] Update deps, CODEOWNERS and mm notifications --- .github/CODEOWNERS | 2 +- .../workflows/mattermost-channel-posts.yml | 44 ++++++++ .github/workflows/mattermost-webhook.yml | 27 +++++ .github/workflows/mattermost-ziti-webhook.yml | 34 ------ go.mod | 41 +++---- go.sum | 101 +++++++++--------- network-tests/simple-transfer/main.go | 4 +- 7 files changed, 146 insertions(+), 107 deletions(-) create mode 100644 .github/workflows/mattermost-channel-posts.yml create mode 100644 .github/workflows/mattermost-webhook.yml delete mode 100644 .github/workflows/mattermost-ziti-webhook.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5be6e2a4e..85e37db81 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # see: # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners +* @openziti/sig-core * @openziti/maintainers - diff --git a/.github/workflows/mattermost-channel-posts.yml b/.github/workflows/mattermost-channel-posts.yml new file mode 100644 index 000000000..0ab6351b6 --- /dev/null +++ b/.github/workflows/mattermost-channel-posts.yml @@ -0,0 +1,44 @@ +name: mattermost-ziti-webhook +on: + issues: + issue_comment: + pull_request_review: + types: [ submitted ] + pull_request_review_comment: + pull_request: + types: [ opened, reopened, ready_for_review, closed ] + fork: + release: + types: [ released ] + workflow_dispatch: + +jobs: + send-notifications: + runs-on: ubuntu-latest + name: POST Webhook + if: github.actor != 'dependabot[bot]' + steps: + - uses: openziti/ziti-mattermost-action-py@main + if: | + github.repository_owner == 'openziti' + && ((github.event_name != 'pull_request_review') + || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')) + with: + zitiId: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} + webhookUrl: ${{ secrets.ZHOOK_URL }} + eventJson: ${{ toJson(github.event) }} + senderUsername: "GitHubZ" + destChannel: "dev-notifications" + + - uses: openziti/ziti-mattermost-action-py@main + if: | + github.repository_owner == 'openziti' + && ((github.event_name != 'pull_request_review') + || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')) + with: + zitiId: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} + webhookUrl: ${{ secrets.ZHOOK_URL }} + eventJson: ${{ toJson(github.event) }} + senderUsername: "GitHubZ" + destChannel: "github-sig-core" + diff --git a/.github/workflows/mattermost-webhook.yml b/.github/workflows/mattermost-webhook.yml new file mode 100644 index 000000000..e048ec00f --- /dev/null +++ b/.github/workflows/mattermost-webhook.yml @@ -0,0 +1,27 @@ +name: mattermost-ziti-webhook +on: + create: + delete: + issues: + issue_comment: + pull_request_review: + pull_request_review_comment: + pull_request: + push: + fork: + release: + +jobs: + mattermost-ziti-webhook: + runs-on: ubuntu-latest + name: POST Webhook + env: + ZITI_LOG: 99 + ZITI_NODEJS_LOG: 99 + steps: + - uses: openziti/ziti-webhook-action@main + with: + ziti-id: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} + webhook-url: ${{ secrets.ZITI_MATTERMOST_WEBHOOK_URL }} + webhook-secret: ${{ secrets.ZITI_MATTERMOSTI_WEBHOOK_SECRET }} + diff --git a/.github/workflows/mattermost-ziti-webhook.yml b/.github/workflows/mattermost-ziti-webhook.yml deleted file mode 100644 index 84a6a3fdd..000000000 --- a/.github/workflows/mattermost-ziti-webhook.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: mattermost-ziti-webhook -on: - issues: - issue_comment: - pull_request_review: - types: [submitted] - pull_request_review_comment: - pull_request: - types: [opened, reopened] - push: - fork: - release: - types: [released] - workflow_dispatch: - watch: - types: [started] - -jobs: - mattermost-ziti-webhook: - runs-on: ubuntu-latest - name: POST Webhook - steps: - - uses: openziti/ziti-mattermost-action-py@main - if: | - github.repository_owner == 'openziti' - && ((github.event_name != 'pull_request_review') - || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')) - with: - zitiId: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} - webhookUrl: ${{ secrets.ZHOOK_URL }} - eventJson: ${{ toJson(github.event) }} - senderUsername: "GitHubZ" - destChannel: "dev-notifications" - diff --git a/go.mod b/go.mod index 163d7c097..6ae36080b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.13.0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-acme/lego/v4 v4.2.0 - github.com/go-openapi/runtime v0.24.2 + github.com/go-openapi/runtime v0.25.0 github.com/go-openapi/strfmt v0.21.3 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/protobuf v1.5.2 @@ -20,23 +20,23 @@ require ( github.com/jedib0t/go-pretty/v6 v6.4.0 github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.6.9 - github.com/openziti/agent v1.0.5 - github.com/openziti/channel/v2 v2.0.15 - github.com/openziti/edge v0.24.36 - github.com/openziti/fabric v0.21.17 - github.com/openziti/foundation/v2 v2.0.7 - github.com/openziti/identity v1.0.23 - github.com/openziti/runzmd v1.0.3 - github.com/openziti/sdk-golang v0.18.2 - github.com/openziti/storage v0.1.26 - github.com/openziti/transport/v2 v2.0.41 + github.com/openziti/agent v1.0.6 + github.com/openziti/channel/v2 v2.0.20 + github.com/openziti/edge v0.24.59 + github.com/openziti/fabric v0.21.27 + github.com/openziti/foundation/v2 v2.0.8 + github.com/openziti/identity v1.0.26 + github.com/openziti/runzmd v1.0.5 + github.com/openziti/sdk-golang v0.18.10 + github.com/openziti/storage v0.1.28 + github.com/openziti/transport/v2 v2.0.45 github.com/openziti/xweb/v2 v2.0.2 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/russross/blackfriday v1.5.2 - github.com/shirou/gopsutil/v3 v3.22.10 + github.com/shirou/gopsutil/v3 v3.22.11 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 @@ -82,6 +82,8 @@ require ( github.com/emirpasic/gods v1.18.1 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect 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.3 // indirect @@ -101,7 +103,8 @@ require ( github.com/hashicorp/go-hclog v1.3.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-msgpack v0.5.5 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/golang-lru v0.6.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/raft v1.3.11 // indirect github.com/hashicorp/raft-boltdb v0.0.0-20220329195025-15018e9b97e0 // indirect @@ -123,8 +126,8 @@ require ( github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/mattn/go-tty v0.0.3 // indirect - github.com/mdlayher/netlink v1.6.2 // indirect - github.com/mdlayher/socket v0.2.3 // indirect + github.com/mdlayher/netlink v1.7.0 // indirect + github.com/mdlayher/socket v0.4.0 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/miekg/dns v1.1.50 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect @@ -140,9 +143,9 @@ require ( github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.2 // indirect - github.com/openziti/metrics v1.1.6 // indirect + github.com/openziti/metrics v1.2.0 // indirect github.com/openziti/x509-claims v1.0.3 // indirect - github.com/orcaman/concurrent-map/v2 v2.0.0 // 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 github.com/pkg/term v1.2.0-beta.2 // indirect @@ -167,11 +170,13 @@ require ( github.com/yusufpapurcu/wmi v1.2.2 // indirect go.mongodb.org/mongo-driver v1.10.0 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect + go.opentelemetry.io/otel v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/crypto v0.3.0 // indirect golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect golang.org/x/image v0.1.0 // indirect golang.org/x/mod v0.6.0 // indirect - golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect + golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.2.0 // indirect golang.org/x/term v0.2.0 // indirect golang.org/x/text v0.4.0 // indirect diff --git a/go.sum b/go.sum index e30d9855e..d37f9d8dd 100644 --- a/go.sum +++ b/go.sum @@ -255,6 +255,11 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= @@ -274,15 +279,14 @@ github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXym github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= -github.com/go-openapi/runtime v0.24.2 h1:yX9HMGQbz32M87ECaAhGpJjBmErO3QLcgdZj9BzGx7c= -github.com/go-openapi/runtime v0.24.2/go.mod h1:AKurw9fNre+h3ELZfk6ILsfvPN+bvvlaU/M9q/r9hpk= +github.com/go-openapi/runtime v0.25.0 h1:7yQTCdRbWhX8vnIjdzU8S00tBYf7Sg71EBeorlPHvhc= +github.com/go-openapi/runtime v0.25.0/go.mod h1:Ux6fikcHXyyob6LNWxtE96hWwjBPYF0DXgVFuMTneOs= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI= github.com/go-openapi/spec v0.20.7/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= -github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -290,7 +294,6 @@ github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/ github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/validate v0.21.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-openapi/validate v0.22.0 h1:b0QecH6VslW/TxtpKgzpO1SNG7GU2FsaqKdP1E2T50Y= github.com/go-openapi/validate v0.22.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8= @@ -298,7 +301,6 @@ github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPr github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= @@ -387,7 +389,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= @@ -466,8 +467,10 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= +github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.1 h1:5pv5N1lT1fjLg2VQ5KWc7kmucp2x/kvFOnxuVTqZ6x4= +github.com/hashicorp/golang-lru/v2 v2.0.1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= @@ -609,10 +612,10 @@ github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4f github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI= github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mdlayher/netlink v1.6.2 h1:D2zGSkvYsJ6NreeED3JiVTu1lj2sIYATqSaZlhPzUgQ= -github.com/mdlayher/netlink v1.6.2/go.mod h1:O1HXX2sIWSMJ3Qn1BYZk1yZM+7iMki/uYGGiwGyq/iU= -github.com/mdlayher/socket v0.2.3 h1:XZA2X2TjdOwNoNPVPclRCURoX/hokBY8nkTmRZFEheM= -github.com/mdlayher/socket v0.2.3/go.mod h1:bz12/FozYNH/VbvC3q7TRIK/Y6dH1kCKsXaUeXi/FmY= +github.com/mdlayher/netlink v1.7.0 h1:ZNGI4V7i1fJ94DPYtWhI/R85i/Q7ZxnuhUJQcJMoodI= +github.com/mdlayher/netlink v1.7.0/go.mod h1:nKO5CSjE/DJjVhk/TNp6vCE1ktVxEA8VEh8drhZzxsQ= +github.com/mdlayher/socket v0.4.0 h1:280wsy40IC9M9q1uPGcLBwXpcTQDtoGwVt+BNoITxIw= +github.com/mdlayher/socket v0.4.0/go.mod h1:xxFqz5GRCUN3UEOm9CZqEJsAbe1C8OwSK46NlmWuVoc= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= @@ -639,7 +642,6 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU= @@ -690,32 +692,32 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openziti/agent v1.0.5 h1:wZUcMYqvwspOjDSaejMtczSXnJoqK0edI9HcEIFsTIs= -github.com/openziti/agent v1.0.5/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= -github.com/openziti/channel/v2 v2.0.15 h1:y1YwewnZTPTPtE3YVjaVpOWGoqJ3+I8+7KqQB4D3poQ= -github.com/openziti/channel/v2 v2.0.15/go.mod h1:LdoKRnefknW4WllUyHJtvKDtKK716lYdHqApKbBy3rk= +github.com/openziti/agent v1.0.6 h1:9CE7tPHRk/agfl8UNlFYIEg925RlNdVyILrCmxuHag4= +github.com/openziti/agent v1.0.6/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= +github.com/openziti/channel/v2 v2.0.20 h1:bm7+EMz94aEC74dcVwbw5EPd/+/zofDmTGGIhfTcz9k= +github.com/openziti/channel/v2 v2.0.20/go.mod h1:wrNdnG22WnX9sSZlGDF6H14PxTn2S8KIZYE1sc5JMLA= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge v0.24.36 h1:3ywHRL5XXYtA4+y12WptofLhkndshePuy/MyKT3A2xo= -github.com/openziti/edge v0.24.36/go.mod h1:3I6GZTcb3j57Y9IlBrnpceklfzdR10ejp4D7+11B6BM= -github.com/openziti/fabric v0.21.17 h1:oT32L0Lu64Jd7CkHrQZdOwG0Mew8bMBEUowtRyhERvs= -github.com/openziti/fabric v0.21.17/go.mod h1:VsRUi2wdA3k4bOXxfrohaoUuhcjf8ZdpPPN0NzD8my4= -github.com/openziti/foundation/v2 v2.0.7 h1:QtpP0ntUhr/7uLR1iM7eEkrusQ2b2ZqTblgdq8cac9Y= -github.com/openziti/foundation/v2 v2.0.7/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= -github.com/openziti/identity v1.0.23 h1:SJ2UN3qCiUKwuwFc0dr3nuHyKvhOr5aN5bEJa2wY9Sw= -github.com/openziti/identity v1.0.23/go.mod h1:uVqZEC4Lr7pEud9b5g0h/cH0Ir5K0egCjUrEVup4ERc= +github.com/openziti/edge v0.24.59 h1:n5KRvqLdIAMgZVug4vkjW8F7A02aAdz0mP5jFFg+HTI= +github.com/openziti/edge v0.24.59/go.mod h1:tFwfmPgpipO1nQB9CNsy6WNBffAWYVR4leYJL3VjodU= +github.com/openziti/fabric v0.21.27 h1:oB9iELm/s/IzX9oGE1GCy1thoBDUtXp8N7Ruq3021uA= +github.com/openziti/fabric v0.21.27/go.mod h1:MHK/9Ysr5pNpTaeyBWBvFSV2EhpHSevPhor66eYGMDk= +github.com/openziti/foundation/v2 v2.0.8 h1:0Y7GG7C+84yC7OxfqnRJjZGQaVqtkRKuCWzCrfFQts4= +github.com/openziti/foundation/v2 v2.0.8/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= +github.com/openziti/identity v1.0.26 h1:t0LrFC6vQgYoJF45GPQBP+6IPwP8kgpctTo10hJicH4= +github.com/openziti/identity v1.0.26/go.mod h1:b/fapA3IvFcMa69IsIRODDHiezi/DaYm+jKqFKNn1vM= github.com/openziti/jwks v1.0.2 h1:32BGXIAnefS+v7uXKPb1x8/cQ7srek6Ai06dsrMTY4E= github.com/openziti/jwks v1.0.2/go.mod h1:KwO0x9FBG0aoJS5f6nH5xeHoplyR1H143SMI9kF0mC8= -github.com/openziti/metrics v1.1.6 h1:fc4t5JEuYYr4gr+tF3qNpbvQ55QhoLyeOG+hiDfKLF8= -github.com/openziti/metrics v1.1.6/go.mod h1:07aMMS1VNzZvz0246fX73SFfuuoRz2nKcvDJumrVlZ0= -github.com/openziti/runzmd v1.0.3 h1:g+JyJS66ykMIidLTzroKBLwbsSF9S1hDvolj2PpD8lE= -github.com/openziti/runzmd v1.0.3/go.mod h1:2YuoQl5zZ6edfb+k1MjglW2cwfZvXwug2WldvBIUNrU= -github.com/openziti/sdk-golang v0.18.2 h1:RA+47vGtPwzqrgWlgTyqKurttvzhG25bu9qnhEU1Ghw= -github.com/openziti/sdk-golang v0.18.2/go.mod h1:79XTAIkizuRq5NpAex3Yg7oDH/fcNSlcrVeSiYEf2q0= -github.com/openziti/storage v0.1.26 h1:1tV4czY/TNmzX3raUZjbR8jVl5L92pdD0SjmdzCzUmE= -github.com/openziti/storage v0.1.26/go.mod h1:Zkm+4d2gckkIbuuCw/sKFWKKhPROZak3gLFzdII0KWQ= -github.com/openziti/transport/v2 v2.0.41 h1:T9RPXsJ0wbDgIx6mjKY1YDOg6ncRDmLPq8xU52B0mvU= -github.com/openziti/transport/v2 v2.0.41/go.mod h1:YM4hnHjHK1gQZuWgmDoPGSDP+8l7uT8kT8oBGM1u6nk= +github.com/openziti/metrics v1.2.0 h1:s/LUPdCaX1i8ZPRgEQNhg4ekUeID0P2I1TVFa4NpQuE= +github.com/openziti/metrics v1.2.0/go.mod h1:ZGAUFO3Q89j2U4zAxNraZfepwMpP4lkMepEnh2zO+lA= +github.com/openziti/runzmd v1.0.5 h1:H+SHafF+g6lr34/5yc8uwMH9Ra74q0uwG63ZdH7Kcgw= +github.com/openziti/runzmd v1.0.5/go.mod h1:tHlzIpZwgWP7OORUVe11bLiKq4Veo51t5S9SjQrjLCw= +github.com/openziti/sdk-golang v0.18.10 h1:eBkH8In+1nkJjDMHmQUDmnOg7yYo+2KDjz05tZ4ip2o= +github.com/openziti/sdk-golang v0.18.10/go.mod h1:PQA1J9Hkg4dxvXI1OZLhtBiTYvspnonAah8LtOruc8g= +github.com/openziti/storage v0.1.28 h1:h9TlQHdjRZQ+GfZ66D8y4kNRvHnMNcmB7BiysuHJAy8= +github.com/openziti/storage v0.1.28/go.mod h1:eo3uH/2yOmesRRposgSZgVYKRZhmvHWx0/EdWb1c5v4= +github.com/openziti/transport/v2 v2.0.45 h1:wL9Q6jB2CeZ5Fxw3AMIVNY1r+PQrLuyoIsmmrB56Z9Y= +github.com/openziti/transport/v2 v2.0.45/go.mod h1:dpf6sh+PexxXggeVzCerrEP2cO2kcC3el3UkwFwnPTc= 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= @@ -723,8 +725,8 @@ github.com/openziti/xweb/v2 v2.0.2/go.mod h1:KQOOlnJk08EZT3TWkvDj/pbIUEVbgG0IrrN github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw= github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= -github.com/orcaman/concurrent-map/v2 v2.0.0 h1:iSMwuBQvQ1nX5i9gYuGMiSy0fjWHmazdjF+NdSO9JzI= -github.com/orcaman/concurrent-map/v2 v2.0.0/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM= +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= github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA= github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 h1:mOvehYivJ4Aqu2CPe3D3lv8jhqOI9/1o0THxJHBE0qw= github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9/go.mod h1:gLH27qo/dvMhLTVVyMELpe3Tut7sOfkiDg7ZpeqKwsw= @@ -809,8 +811,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.22.10 h1:4KMHdfBRYXGF9skjDWiL4RA2N+E8dRdodU/bOZpPoVg= -github.com/shirou/gopsutil/v3 v3.22.10/go.mod h1:QNza6r4YQoydyCfo6rH0blGfKahgibh4dQmV5xdFkQk= +github.com/shirou/gopsutil/v3 v3.22.11 h1:kxsPKS+Eeo+VnEQ2XCaGJepeP6KY53QoRTETx3+1ndM= +github.com/shirou/gopsutil/v3 v3.22.11/go.mod h1:xl0EeL4vXJ+hQMAGN8B9VFpxukEMA0XdevQOe5MZ1oY= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= @@ -902,10 +904,8 @@ github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 h1:3SNcvBmEPE1YlB github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= 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/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -951,7 +951,6 @@ go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3 go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= 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.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak= @@ -966,6 +965,11 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= +go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= +go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= +go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= +go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1000,7 +1004,6 @@ golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -1105,9 +1108,7 @@ golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1 golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220923203811-8be639271d50/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1138,9 +1139,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 h1:cu5kTvlzcw1Q5S9f5ip1/cpiB4nXvw1XYzFPGgzLUOY= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1220,19 +1220,14 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 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.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= diff --git a/network-tests/simple-transfer/main.go b/network-tests/simple-transfer/main.go index 8ea2500da..b96fc518f 100644 --- a/network-tests/simple-transfer/main.go +++ b/network-tests/simple-transfer/main.go @@ -20,6 +20,7 @@ import ( "github.com/openziti/ziti/network-tests/simple-transfer/actions" "github.com/openziti/ziti/network-tests/test_resources" "github.com/openziti/zitilab" + "github.com/openziti/zitilab/actions/edge" zitilib_runlevel_1_configuration "github.com/openziti/zitilab/runlevel/1_configuration" "github.com/sirupsen/logrus" "os" @@ -164,7 +165,8 @@ var m = &model.Model{ DataPath: "consul/data", LogPath: "consul/log.out", }), - "stop": model.Bind(component.StopInParallel("*", 15)), + "stop": model.Bind(component.StopInParallel("*", 15)), + "login": model.Bind(edge.Login("#ctrl")), }, Infrastructure: model.InfrastructureStages{ From 533b260ff30e7dd09e51e300858b31fa4f76b20f Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Thu, 1 Dec 2022 13:49:08 -0500 Subject: [PATCH 36/46] Update workflows. Remove some unused code --- .github/workflows/mattermost-channel-posts.yml | 2 ++ .github/workflows/mattermost-webhook.yml | 13 +++++++------ network-tests/simple-transfer/stages.go | 5 +---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mattermost-channel-posts.yml b/.github/workflows/mattermost-channel-posts.yml index 0ab6351b6..5f96c334b 100644 --- a/.github/workflows/mattermost-channel-posts.yml +++ b/.github/workflows/mattermost-channel-posts.yml @@ -8,6 +8,8 @@ on: pull_request: types: [ opened, reopened, ready_for_review, closed ] fork: + push: + tags: release: types: [ released ] workflow_dispatch: diff --git a/.github/workflows/mattermost-webhook.yml b/.github/workflows/mattermost-webhook.yml index e048ec00f..a214230f6 100644 --- a/.github/workflows/mattermost-webhook.yml +++ b/.github/workflows/mattermost-webhook.yml @@ -1,5 +1,5 @@ name: mattermost-ziti-webhook -on: +on: create: delete: issues: @@ -15,13 +15,14 @@ jobs: mattermost-ziti-webhook: runs-on: ubuntu-latest name: POST Webhook + if: github.actor != 'dependabot[bot]' env: ZITI_LOG: 99 ZITI_NODEJS_LOG: 99 steps: - - uses: openziti/ziti-webhook-action@main - with: - ziti-id: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} - webhook-url: ${{ secrets.ZITI_MATTERMOST_WEBHOOK_URL }} - webhook-secret: ${{ secrets.ZITI_MATTERMOSTI_WEBHOOK_SECRET }} + - uses: openziti/ziti-webhook-action@main + with: + ziti-id: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} + webhook-url: ${{ secrets.ZITI_MATTERMOST_WEBHOOK_URL }} + webhook-secret: ${{ secrets.ZITI_MATTERMOSTI_WEBHOOK_SECRET }} diff --git a/network-tests/simple-transfer/stages.go b/network-tests/simple-transfer/stages.go index 91bba7508..724ca93cb 100644 --- a/network-tests/simple-transfer/stages.go +++ b/network-tests/simple-transfer/stages.go @@ -4,7 +4,6 @@ import ( "crypto/rand" "net/url" - fablib_5_operation "github.com/openziti/fablab/kernel/lib/runlevel/5_operation" "github.com/openziti/fablab/kernel/model" runlevel_5_operation "github.com/openziti/ziti/network-tests/simple-transfer/stages/5_operation" ) @@ -16,13 +15,11 @@ func newStageFactory() model.Factory { } func (sf *stageFactory) Build(m *model.Model) error { - runPhase := fablib_5_operation.NewPhase() - //generate 10k random bytes data := make([]byte, 10000) rand.Read(data) m.AddOperatingStage(runlevel_5_operation.AssertEcho("#echo-client", url.QueryEscape(string(data)))) - m.AddOperatingStage(runPhase) + return nil } From f4f515c72bcef1b10d029ed2eee4713ed08259f3 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Thu, 1 Dec 2022 18:24:56 -0500 Subject: [PATCH 37/46] use ZITI_NETWORK and DEFAULT_ZITI_NETWORK instead of ZITI_HOSTNAME --- quickstart/docker/image/ziti-cli-functions.sh | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 63aa782ed..50304fa95 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -2,10 +2,11 @@ set -uo pipefail -ZITI_HOSTNAME="$(hostname -s)" +# the default ZITI_NETWORK (network name) is the short hostname +: "${DEFAULT_ZITI_NETWORK:="$(hostname -s)"}" # shellcheck disable=SC2155 -export DEFAULT_ZITI_HOME_LOCATION="${HOME}/.ziti/quickstart/${ZITI_HOSTNAME}" +export DEFAULT_ZITI_HOME_LOCATION="${HOME}/.ziti/quickstart/${DEFAULT_ZITI_NETWORK}" export ZITI_QUICKSTART_ENVROOT="${HOME}/.ziti/quickstart" @@ -61,7 +62,7 @@ function initializeController { "${ZITI_BIN_DIR-}/ziti-controller" edge init "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" -u "${ZITI_USER-}" -p "${ZITI_PWD}" &> "${log_file}" echo -e "ziti-controller initialized. see $(BLUE "${log_file}") for details" } -function startZitiController { +function startController { log_file="${ZITI_HOME-}/${ZITI_EDGE_CONTROLLER_RAWNAME}.log" # shellcheck disable=SC2034 "${ZITI_BIN_DIR-}/ziti-controller" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_CONTROLLER_RAWNAME}.yaml" &> "${log_file}" & @@ -69,7 +70,7 @@ function startZitiController { echo -e "ziti-controller started as process id: $ZITI_EXPRESS_CONTROLLER_PID. log located at: $(BLUE "${log_file}")" } -function stopZitiController { +function stopController { if [[ -n ${ZITI_EXPRESS_CONTROLLER_PID:-} ]]; then kill "$ZITI_EXPRESS_CONTROLLER_PID" # shellcheck disable=SC2181 @@ -78,12 +79,12 @@ function stopZitiController { return 0 fi else - echo "ERROR: you can only stop a controller process that was started with startZitiController" >&2 + echo "ERROR: you can only stop a controller process that was started with startController" >&2 return 1 fi } -function startExpressEdgeRouter { +function startRouter { log_file="${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.log" "${ZITI_BIN_DIR}/ziti-router" run "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.yaml" > "${log_file}" 2>&1 & ZITI_EXPRESS_EDGE_ROUTER_PID=$! @@ -91,7 +92,7 @@ function startExpressEdgeRouter { } -function stopAllEdgeRouters { +function stopRouter { if [[ -n ${ZITI_EXPRESS_EDGE_ROUTER_PID:-} ]]; then # shellcheck disable=SC2015 kill "${ZITI_EXPRESS_EDGE_ROUTER_PID}" && { @@ -101,7 +102,7 @@ function stopAllEdgeRouters { return 1 } else - echo "ERROR: you can only stop a router process that was started with startExpressEdgeRouter" >&2 + echo "ERROR: you can only stop a router process that was started with startRouter" >&2 return 1 fi } @@ -373,15 +374,15 @@ function setupZitiNetwork { echo "Creating a controller is effectively creating a network. The name of the network will be used when writing" echo "configuration files locally. Choose the name of your network now. The format of the network name should resemble" echo -n "what a hostname looks like. A good choice is to actually use your system's hostname: " - echo -e "$(BLUE "${ZITI_HOSTNAME}")" + echo -e "$(BLUE "${DEFAULT_ZITI_NETWORK}")" echo " " - echo -en "$(echo -ne "Network Name [$(BLUE "${ZITI_HOSTNAME}")]: ")" + echo -en "$(echo -ne "Network Name [$(BLUE "${DEFAULT_ZITI_NETWORK}")]: ")" read -r ZITI_NETWORK echo " " if checkControllerName; then : #clear to continue if [[ "${ZITI_NETWORK-}" == "" ]]; then - ZITI_NETWORK="${ZITI_HOSTNAME}" + ZITI_NETWORK="${DEFAULT_ZITI_NETWORK}" fi echo "name: ${ZITI_NETWORK-}" else @@ -470,8 +471,8 @@ function ziti_expressConfiguration { fi # Stop any devices currently running to avoid port collisions - stopAllEdgeRouters - stopZitiController + stopRouter + stopController else echo -e "$(RED " --- Exiting express install ---")" return 1 @@ -502,7 +503,7 @@ function ziti_expressConfiguration { echo " " echo -e "******** Setting Up Environment ********" if [[ "${1-}" == "" ]]; then - nw="${ZITI_HOSTNAME}" + nw="${DEFAULT_ZITI_NETWORK}" else nw="${1-}" fi @@ -550,7 +551,7 @@ function ziti_expressConfiguration { createControllerConfig #createControllerSystemdFile initializeController - startZitiController + startController echo "waiting for the controller to come online to allow the edge router to enroll" waitForController @@ -584,13 +585,13 @@ function ziti_expressConfiguration { "${ZITI_BIN_DIR-}/ziti-router" enroll "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.yaml" --jwt "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.jwt" &> "${ZITI_HOME_OS_SPECIFIC}/${ZITI_EDGE_ROUTER_RAWNAME}.enrollment.log" echo "" - stopZitiController + stopController echo "Edge Router enrolled. Controller stopped." echo "" echo -e "$(GREEN "Congratulations. Express setup complete!")" - echo -e "Start your Ziti Controller by running the function: $(BLUE "startZitiController")" - echo -e "Start your Ziti Edge Router by running : $(BLUE 'startExpressEdgeRouter')" + echo -e "Start your Ziti Controller by running the function: $(BLUE "startController")" + echo -e "Start your Ziti Edge Router by running : $(BLUE 'startRouter')" echo "" } @@ -787,7 +788,7 @@ function createRouterPki { export ZITI_ROUTER_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/server.cert" export ZITI_ROUTER_IDENTITY_KEY="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/server.key" export ZITI_ROUTER_IDENTITY_CA="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/cas.cert" - pki_client_server "${router_name},localhost,127.0.0.1,${ZITI_HOSTNAME}" "${ZITI_CONTROLLER_INTERMEDIATE_NAME}" "${ZITI_EDGE_ROUTER_IP_OVERRIDE-}" "${router_name}" + pki_client_server "${router_name},localhost,127.0.0.1,${ZITI_NETWORK}" "${ZITI_CONTROLLER_INTERMEDIATE_NAME}" "${ZITI_EDGE_ROUTER_IP_OVERRIDE-}" "${router_name}" } function createPrivateRouterConfig { @@ -850,7 +851,7 @@ function createPki { pki_create_intermediate "${ZITI_SPURIOUS_INTERMEDIATE}" "${ZITI_SIGNING_INTERMEDIATE_NAME}" 1 echo " " - pki_allow_list_dns="${ZITI_CONTROLLER_HOSTNAME},localhost,${ZITI_HOSTNAME}" + pki_allow_list_dns="${ZITI_CONTROLLER_HOSTNAME},localhost,${ZITI_NETWORK}" if [[ "${ZITI_EDGE_CONTROLLER_HOSTNAME}" != "" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${ZITI_EDGE_CONTROLLER_HOSTNAME}"; fi if [[ "${EXTERNAL_DNS}" != "" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${EXTERNAL_DNS}"; fi pki_allow_list_ip="127.0.0.1" @@ -1034,8 +1035,6 @@ function ziti_createEnvFile { retVal=$? if [[ "${retVal}" != 0 ]]; then if decideToUseDefaultZitiHome; then - # shellcheck disable=SC2155 - export ZITI_NETWORK="${ZITI_HOSTNAME}" ZITI_HOME="${DEFAULT_ZITI_HOME_LOCATION}" else return 1 @@ -1067,9 +1066,9 @@ function ziti_createEnvFile { export ZITI_NETWORK="${1-}" fi if [[ "${ZITI_NETWORK-}" = "" ]]; then - echo -e "$(YELLOW "WARN: ZITI_NETWORK HAS NOT BEEN DECLARED! USING hostname: ${ZITI_HOSTNAME}")" + echo -e "$(YELLOW "WARN: ZITI_NETWORK HAS NOT BEEN DECLARED! USING hostname: ${DEFAULT_ZITI_NETWORK}")" # shellcheck disable=SC2155 - export ZITI_NETWORK="${ZITI_HOSTNAME}" + export ZITI_NETWORK="${DEFAULT_ZITI_NETWORK}" fi fi From 83361ce5c52ff0b18779174b1d83f5aae5f497b2 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Fri, 2 Dec 2022 10:30:31 -0500 Subject: [PATCH 38/46] Update mattermost action --- .github/workflows/mattermost-channel-posts.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/mattermost-channel-posts.yml b/.github/workflows/mattermost-channel-posts.yml index 5f96c334b..05fcd6add 100644 --- a/.github/workflows/mattermost-channel-posts.yml +++ b/.github/workflows/mattermost-channel-posts.yml @@ -10,9 +10,12 @@ on: fork: push: tags: + - '*' release: types: [ released ] workflow_dispatch: + watch: + types: [ started ] jobs: send-notifications: From 2ea48ef37c121ffd9e2c5a78eb6f05d23c173798 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Fri, 2 Dec 2022 15:46:18 -0500 Subject: [PATCH 39/46] Keep certain files in the container so they can be updated in docker-compose environments Closes #912 Signed-off-by: gberl002 --- quickstart/docker/docker-compose.yml | 16 ++++++++-------- quickstart/docker/image/Dockerfile | 9 ++++++--- quickstart/docker/simplified-docker-compose.yml | 8 ++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/quickstart/docker/docker-compose.yml b/quickstart/docker/docker-compose.yml index 635e05b00..75be2af1f 100644 --- a/quickstart/docker/docker-compose.yml +++ b/quickstart/docker/docker-compose.yml @@ -19,7 +19,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: - - "/openziti/scripts/run-controller.sh" + - "/mutable-ziti/scripts/run-controller.sh" ziti-controller-init-container: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -40,9 +40,9 @@ services: volumes: - ziti-fs:/openziti entrypoint: - - "/openziti/scripts/run-with-ziti-cli.sh" + - "/mutable-ziti/scripts/run-with-ziti-cli.sh" command: - - "/openziti/scripts/access-control.sh" + - "/mutable-ziti/scripts/access-control.sh" ziti-edge-router: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -61,7 +61,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: /bin/bash - command: "/openziti/scripts/run-router.sh edge" + command: "/mutable-ziti/scripts/run-router.sh edge" ziti-edge-router-wss: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -81,7 +81,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: /bin/bash - command: "/openziti/scripts/run-router.sh wss" + command: "/mutable-ziti/scripts/run-router.sh wss" ziti-fabric-router-br: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -99,7 +99,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: /bin/bash - command: "/openziti/scripts/run-router.sh fabric" + command: "/mutable-ziti/scripts/run-router.sh fabric" ziti-private-red: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -116,7 +116,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: /bin/bash - command: "/openziti/scripts/run-router.sh private" + command: "/mutable-ziti/scripts/run-router.sh private" ziti-private-blue: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -133,7 +133,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: /bin/bash - command: "/openziti/scripts/run-router.sh private" + command: "/mutable-ziti/scripts/run-router.sh private" web-test-blue: image: crccheck/hello-world diff --git a/quickstart/docker/image/Dockerfile b/quickstart/docker/image/Dockerfile index 609f6bd77..c48b173c9 100644 --- a/quickstart/docker/image/Dockerfile +++ b/quickstart/docker/image/Dockerfile @@ -6,17 +6,20 @@ RUN apt update && \ RUN useradd -ms /bin/bash ziti && \ mkdir /openziti && chown ziti:ziti /openziti && \ mkdir /openziti/scripts && chown ziti:ziti /openziti/scripts && \ - mkdir /openziti/shared && chown ziti:ziti /openziti/shared + mkdir /openziti/shared && chown ziti:ziti /openziti/shared && \ + mkdir /mutable-ziti && chown ziti:ziti /mutable-ziti USER ziti WORKDIR /openziti ENV ZITI_HOME=/openziti -ENV ZITI_BIN_DIR="${ZITI_HOME}/ziti-bin" ENV ZITI_SHARED="${ZITI_HOME}/shared" -ENV ZITI_SCRIPTS="${ZITI_HOME}/scripts" ENV ENV_FILE="${ZITI_HOME}/ziti.env" ENV ZITI_NETWORK=ziti +# Don't put these paths on volume shared in docker-compose deployment (https://github.com/openziti/ziti/issues/912) +ENV MUTABLE_HOME=/mutable-ziti +ENV ZITI_BIN_DIR="${MUTABLE_HOME}/ziti-bin" +ENV ZITI_SCRIPTS="${MUTABLE_HOME}/scripts" RUN mkdir -p "${ZITI_SCRIPTS}" diff --git a/quickstart/docker/simplified-docker-compose.yml b/quickstart/docker/simplified-docker-compose.yml index 183ebfce4..4c398a6d8 100644 --- a/quickstart/docker/simplified-docker-compose.yml +++ b/quickstart/docker/simplified-docker-compose.yml @@ -16,7 +16,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: - - "/openziti/scripts/run-controller.sh" + - "/mutable-ziti/scripts/run-controller.sh" ziti-controller-init-container: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -37,9 +37,9 @@ services: volumes: - ziti-fs:/openziti entrypoint: - - "/openziti/scripts/run-with-ziti-cli.sh" + - "/mutable-ziti/scripts/run-with-ziti-cli.sh" command: - - "/openziti/scripts/access-control.sh" + - "/mutable-ziti/scripts/access-control.sh" ziti-edge-router: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -56,7 +56,7 @@ services: volumes: - ziti-fs:/openziti entrypoint: /bin/bash - command: "/openziti/scripts/run-router.sh edge" + command: "/mutable-ziti/scripts/run-router.sh edge" ziti-console: image: openziti/zac From 2c9e8b1b4ed551aca9bf06b769ad4480458bf5e0 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Fri, 2 Dec 2022 22:33:34 -0500 Subject: [PATCH 40/46] Restructuring of directories in docker-compose environment Signed-off-by: gberl002 --- quickstart/README.md | 2 +- quickstart/docker/README.md | 2 +- .../docker/attach.container.to.compose.sh | 2 +- quickstart/docker/blue.nw.attach.sh | 2 +- quickstart/docker/buildLocalDev.sh | 2 +- quickstart/docker/docker-compose.yml | 36 +++++++++---------- quickstart/docker/image/Dockerfile | 19 ++++------ quickstart/docker/image/TestDockerfile | 19 +++++----- .../docker/image/dockerTestEntrypoint.sh | 2 +- quickstart/docker/image/run-controller.sh | 2 +- quickstart/docker/image/run-with-ziti-cli.sh | 12 +++---- quickstart/docker/red.nw.attach.sh | 2 +- .../docker/simplified-docker-compose.yml | 20 +++++------ quickstart/test/quickstart_test.go | 10 +++--- 14 files changed, 63 insertions(+), 69 deletions(-) diff --git a/quickstart/README.md b/quickstart/README.md index f3b528aa0..7e16850b3 100644 --- a/quickstart/README.md +++ b/quickstart/README.md @@ -41,7 +41,7 @@ the scripts in these folders before running them. ## Express By far the easiest way to establish an environment quickly is to simply run the express install script -found at [./quickstart/local/express/express-dev-env.sh](). +found at [./quickstart/docker/image/ziti-cli-functions.sh](). ### What It Does diff --git a/quickstart/docker/README.md b/quickstart/docker/README.md index a281b66b3..4cdee9c60 100644 --- a/quickstart/docker/README.md +++ b/quickstart/docker/README.md @@ -22,7 +22,7 @@ Build Docker Image For Publication 1. build the docker image: `docker build image -t openziti/quickstart` 1. exec into a container and make sure it's the version you expect: `docker run --rm -it openziti/quickstart ziti --version` 1. cleanup: `rm ziti-*tar.gz; rm -rf ziti-bin` -2. + Push Docker Image to dockerhub ------------------ 1. `source ./image/ziti-cli-functions.sh` diff --git a/quickstart/docker/attach.container.to.compose.sh b/quickstart/docker/attach.container.to.compose.sh index 869485d01..e7edd5034 100644 --- a/quickstart/docker/attach.container.to.compose.sh +++ b/quickstart/docker/attach.container.to.compose.sh @@ -1 +1 @@ -docker run -v docker_ziti-fs:/openziti --network docker_zitiblue --rm -it openziti/quickstart /bin/bash +docker run -v docker_ziti-fs:/persistent --network docker_zitiblue --rm -it openziti/quickstart /bin/bash diff --git a/quickstart/docker/blue.nw.attach.sh b/quickstart/docker/blue.nw.attach.sh index 49f34a3ad..d849014d8 100644 --- a/quickstart/docker/blue.nw.attach.sh +++ b/quickstart/docker/blue.nw.attach.sh @@ -1 +1 @@ -docker run --cap-add=NET_ADMIN --device /dev/net/tun --name ziti-tunneler-blue --user root --network docker_zitiblue -v docker_ziti-fs:/openziti --rm -it openziti/quickstart /bin/bash +docker run --cap-add=NET_ADMIN --device /dev/net/tun --name ziti-tunneler-blue --user root --network docker_zitiblue -v docker_ziti-fs:/persistent --rm -it openziti/quickstart /bin/bash diff --git a/quickstart/docker/buildLocalDev.sh b/quickstart/docker/buildLocalDev.sh index 5e709cf24..dbdcd55ba 100755 --- a/quickstart/docker/buildLocalDev.sh +++ b/quickstart/docker/buildLocalDev.sh @@ -54,7 +54,7 @@ if [ -d "${ZITI_DOCKER_ROOT}/image/ziti.ignore" ]; then rm -rf "${ZITI_DOCKER_ROOT}/image/ziti.ignore" fi -echo "Ziti Version: $(docker run --rm -it openziti/quickstart:dev /openziti/ziti-bin/ziti --version)" +echo "Ziti Version: $(docker run --rm -it openziti/quickstart:dev /var/openziti/ziti-bin/ziti --version)" vers="$(echo "${ZITI_BINARIES_VERSION}" | cut -c 2-100)" docker tag "openziti/quickstart:dev" "openziti/quickstart:dev" diff --git a/quickstart/docker/docker-compose.yml b/quickstart/docker/docker-compose.yml index 75be2af1f..681238f16 100644 --- a/quickstart/docker/docker-compose.yml +++ b/quickstart/docker/docker-compose.yml @@ -17,9 +17,9 @@ services: aliases: - ziti-edge-controller volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: - - "/mutable-ziti/scripts/run-controller.sh" + - "/var/openziti/scripts/run-controller.sh" ziti-controller-init-container: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -38,11 +38,11 @@ services: aliases: - ziti-edge-controller-init-container volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: - - "/mutable-ziti/scripts/run-with-ziti-cli.sh" + - "/var/openziti/scripts/run-with-ziti-cli.sh" command: - - "/mutable-ziti/scripts/access-control.sh" + - "/var/openziti/scripts/access-control.sh" ziti-edge-router: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -59,9 +59,9 @@ services: - zitiblue - zitired volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: /bin/bash - command: "/mutable-ziti/scripts/run-router.sh edge" + command: "/var/openziti/scripts/run-router.sh edge" ziti-edge-router-wss: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -79,9 +79,9 @@ services: - zitiblue - zitired volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: /bin/bash - command: "/mutable-ziti/scripts/run-router.sh wss" + command: "/var/openziti/scripts/run-router.sh wss" ziti-fabric-router-br: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -97,9 +97,9 @@ services: - zitiblue - zitired volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: /bin/bash - command: "/mutable-ziti/scripts/run-router.sh fabric" + command: "/var/openziti/scripts/run-router.sh fabric" ziti-private-red: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -114,9 +114,9 @@ services: networks: - zitired volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: /bin/bash - command: "/mutable-ziti/scripts/run-router.sh private" + command: "/var/openziti/scripts/run-router.sh private" ziti-private-blue: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -131,9 +131,9 @@ services: networks: - zitiblue volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: /bin/bash - command: "/mutable-ziti/scripts/run-router.sh private" + command: "/var/openziti/scripts/run-router.sh private" web-test-blue: image: crccheck/hello-world @@ -149,14 +149,14 @@ services: ziti-console: image: openziti/zac environment: - - ZAC_SERVER_CERT_CHAIN=/openziti/pki/ziti-controller-intermediate/certs/ziti-controller-server.cert - - ZAC_SERVER_KEY=/openziti/pki/ziti-controller-intermediate/keys/ziti-controller-server.key + - ZAC_SERVER_CERT_CHAIN=/persistent/pki/ziti-controller-intermediate/certs/ziti-controller-server.cert + - ZAC_SERVER_KEY=/persistent/pki/ziti-controller-intermediate/keys/ziti-controller-server.key ports: - "1408:1408" - "8443:8443" working_dir: /usr/src/app volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent networks: - zitiblue diff --git a/quickstart/docker/image/Dockerfile b/quickstart/docker/image/Dockerfile index c48b173c9..becee11b1 100644 --- a/quickstart/docker/image/Dockerfile +++ b/quickstart/docker/image/Dockerfile @@ -4,24 +4,19 @@ RUN apt update && \ apt install jq curl netcat-openbsd vim inetutils-ping net-tools lsof -y RUN useradd -ms /bin/bash ziti && \ - mkdir /openziti && chown ziti:ziti /openziti && \ - mkdir /openziti/scripts && chown ziti:ziti /openziti/scripts && \ - mkdir /openziti/shared && chown ziti:ziti /openziti/shared && \ - mkdir /mutable-ziti && chown ziti:ziti /mutable-ziti + mkdir /persistent && chown ziti:ziti /persistent && \ + mkdir /persistent/scripts && chown ziti:ziti /persistent/scripts USER ziti -WORKDIR /openziti +WORKDIR /persistent -ENV ZITI_HOME=/openziti +ENV ZITI_HOME=/persistent ENV ZITI_SHARED="${ZITI_HOME}/shared" ENV ENV_FILE="${ZITI_HOME}/ziti.env" ENV ZITI_NETWORK=ziti -# Don't put these paths on volume shared in docker-compose deployment (https://github.com/openziti/ziti/issues/912) -ENV MUTABLE_HOME=/mutable-ziti -ENV ZITI_BIN_DIR="${MUTABLE_HOME}/ziti-bin" -ENV ZITI_SCRIPTS="${MUTABLE_HOME}/scripts" - -RUN mkdir -p "${ZITI_SCRIPTS}" +# Don't put these paths on shared volume in docker-compose deployment (https://github.com/openziti/ziti/issues/912) +ENV ZITI_BIN_DIR=/var/openziti/ziti-bin +ENV ZITI_SCRIPTS=/var/openziti/scripts # copy the ziti binaries to a directory already on the path COPY --chown=ziti ziti.ignore "${ZITI_BIN_DIR}" diff --git a/quickstart/docker/image/TestDockerfile b/quickstart/docker/image/TestDockerfile index 1d67e0df3..bd8c0e787 100644 --- a/quickstart/docker/image/TestDockerfile +++ b/quickstart/docker/image/TestDockerfile @@ -4,20 +4,19 @@ RUN apt update && \ apt install jq curl vim psmisc -y RUN useradd -ms /bin/bash ziti && \ - mkdir /openziti && chown ziti:ziti /openziti && \ - mkdir /openziti/scripts && chown ziti:ziti /openziti/scripts && \ - mkdir /openziti/shared && chown ziti:ziti /openziti/shared + mkdir /persistent && chown ziti:ziti /persistent && \ + mkdir /persistent/scripts && chown ziti:ziti /persistent/scripts USER ziti -WORKDIR /openziti +WORKDIR /persistent -ENV ZITI_HOME=/openziti -ENV ZITI_BIN_DIR="${ZITI_HOME}/ziti-bin" -ENV ZITI_SCRIPTS="${ZITI_HOME}/scripts" +ENV ZITI_HOME=/persistent +ENV ZITI_SHARED="${ZITI_HOME}/shared" ENV ENV_FILE="${ZITI_HOME}/ziti.env" -ENV ZITI_NETWORK=localhost - -RUN mkdir -p "${ZITI_SCRIPTS}" +ENV ZITI_NETWORK=ziti +# Don't put these paths on shared volume in docker-compose deployment (https://github.com/openziti/ziti/issues/912) +ENV ZITI_BIN_DIR=/var/openziti/ziti-bin +ENV ZITI_SCRIPTS=/var/openziti/scripts COPY --chown=ziti ziti.ignore "${ZITI_BIN_DIR}" COPY --chown=ziti ziti-cli-functions.sh "${ZITI_SCRIPTS}/" diff --git a/quickstart/docker/image/dockerTestEntrypoint.sh b/quickstart/docker/image/dockerTestEntrypoint.sh index d11b11f59..3511f0fed 100755 --- a/quickstart/docker/image/dockerTestEntrypoint.sh +++ b/quickstart/docker/image/dockerTestEntrypoint.sh @@ -6,4 +6,4 @@ fi touch runonce source "${ZITI_SCRIPTS}/ziti-cli-functions.sh" -expressInstall "${ZITI_NETWORK}" \ No newline at end of file +expressInstall "localhost" \ No newline at end of file diff --git a/quickstart/docker/image/run-controller.sh b/quickstart/docker/image/run-controller.sh index 4c7933af1..21a0c34b3 100755 --- a/quickstart/docker/image/run-controller.sh +++ b/quickstart/docker/image/run-controller.sh @@ -1,6 +1,6 @@ #!/bin/bash -ziti_controller_cfg='/openziti/ziti-edge-controller.yaml' +ziti_controller_cfg="${ZITI_HOME}/ziti-edge-controller.yaml" export ZITI_CONTROLLER_RAWNAME=ziti-controller export ZITI_EDGE_CONTROLLER_RAWNAME=ziti-edge-controller diff --git a/quickstart/docker/image/run-with-ziti-cli.sh b/quickstart/docker/image/run-with-ziti-cli.sh index e231c9ee5..34cf0f0e1 100755 --- a/quickstart/docker/image/run-with-ziti-cli.sh +++ b/quickstart/docker/image/run-with-ziti-cli.sh @@ -15,15 +15,15 @@ if [[ ! -f $1 ]]; then fi # Should we execute? -initFile="/openziti/access-control.init" +initFile="${ZITI_HOME}/access-control.init" if [[ -f "${initFile}" ]]; then echo " " - echo "*****************************************************" - echo " docker-compose init file has been detected" - echo " the initialization of the docker-compose environment has already happened" - echo " if you wish to allow this volume to be re-initialized, delete the file" + echo "*****************************************************************" + echo " docker-compose init file has been detected, the initialization " + echo " of the docker-compose environment has already happened. If you " + echo " wish to allow this volume to be re-initialized, delete the file " echo " located at ${initFile}" - echo "*****************************************************" + echo "*****************************************************************" echo " " exit 0 fi diff --git a/quickstart/docker/red.nw.attach.sh b/quickstart/docker/red.nw.attach.sh index bdc82a7b0..d09f38521 100644 --- a/quickstart/docker/red.nw.attach.sh +++ b/quickstart/docker/red.nw.attach.sh @@ -1 +1 @@ -docker run --cap-add=NET_ADMIN --device /dev/net/tun --name ziti-tunneler-red --user root --network docker_zitired -v docker_ziti-fs:/openziti --rm -it openziti/quickstart /bin/bash +docker run --cap-add=NET_ADMIN --device /dev/net/tun --name ziti-tunneler-red --user root --network docker_zitired -v docker_ziti-fs:/persistent --rm -it openziti/quickstart /bin/bash diff --git a/quickstart/docker/simplified-docker-compose.yml b/quickstart/docker/simplified-docker-compose.yml index 4c398a6d8..94e0287e8 100644 --- a/quickstart/docker/simplified-docker-compose.yml +++ b/quickstart/docker/simplified-docker-compose.yml @@ -14,9 +14,9 @@ services: aliases: - ziti-edge-controller volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: - - "/mutable-ziti/scripts/run-controller.sh" + - "/var/openziti/scripts/run-controller.sh" ziti-controller-init-container: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -35,11 +35,11 @@ services: aliases: - ziti-edge-controller-init-container volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: - - "/mutable-ziti/scripts/run-with-ziti-cli.sh" + - "/var/openziti/scripts/run-with-ziti-cli.sh" command: - - "/mutable-ziti/scripts/access-control.sh" + - "/var/openziti/scripts/access-control.sh" ziti-edge-router: image: "${ZITI_IMAGE}:${ZITI_VERSION}" @@ -54,22 +54,22 @@ services: - zitiblue - zitired volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent entrypoint: /bin/bash - command: "/mutable-ziti/scripts/run-router.sh edge" + command: "/var/openziti/scripts/run-router.sh edge" ziti-console: image: openziti/zac environment: - - ZAC_SERVER_CERT_CHAIN=/openziti/pki/ziti-controller-intermediate/certs/ziti-controller-server.cert - - ZAC_SERVER_KEY=/openziti/pki/ziti-controller-intermediate/keys/ziti-controller-server.key + - ZAC_SERVER_CERT_CHAIN=/persistent/pki/ziti-controller-intermediate/certs/ziti-controller-server.cert + - ZAC_SERVER_KEY=/persistent/pki/ziti-controller-intermediate/keys/ziti-controller-server.key depends_on: - ziti-controller ports: - "1408:1408" - "8443:8443" volumes: - - ziti-fs:/openziti + - ziti-fs:/persistent networks: - zitiblue diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index 05bf77b5b..887109b62 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -220,13 +220,13 @@ func TestQuickStartEnvFile(t *testing.T) { expectedValues := []string{ "export ZITI_EDGE_ROUTER_RAWNAME=\"localhost-edge-router\"", "export ZITI_EDGE_CONTROLLER_RAWNAME=\"localhost\"", - "export ZITI_HOME_OS_SPECIFIC=\"/openziti\"", - "export ZITI_HOME=\"/openziti\"", - "export ZITI_BIN_DIR=\"/openziti/ziti-bin\"", + "export ZITI_HOME_OS_SPECIFIC=\"/persistent\"", + "export ZITI_HOME=\"/persistent\"", + "export ZITI_BIN_DIR=\"/var/openziti/ziti-bin\"", "export ZITI_EDGE_CTRL_ADVERTISED=\"localhost:1280\"", "export ZITI_USER=\"admin\"", "export ZITI_PWD=\"admin\"", - "export ZITI_PKI_OS_SPECIFIC=\"/openziti/pki\"", + "export ZITI_PKI_OS_SPECIFIC=\"/persistent/pki\"", "export ZITI_EDGE_CONTROLLER_ROOTCA_NAME=\"localhost-root-ca\"", "export ZITI_EDGE_CONTROLLER_INTERMEDIATE_NAME=\"localhost-intermediate\"", } @@ -251,7 +251,7 @@ func TestQuickStartEnvFile(t *testing.T) { if err != nil { fmt.Printf("Error: %s\n", output) } - cpString := containerId + ":/openziti/localhost.env" + cpString := containerId + ":/persistent/localhost.env" cmd := exec.Command("docker", "cp", cpString, ".") err = cmd.Run() if err != nil { From 24a855c292bd7df4b079a574c6a4617bba322b5c Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Tue, 6 Dec 2022 19:46:42 -0500 Subject: [PATCH 41/46] unbotch the merge conflict resolution --- quickstart/docker/image/dockerTestEntrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/docker/image/dockerTestEntrypoint.sh b/quickstart/docker/image/dockerTestEntrypoint.sh index 3cffb4e50..0389e148e 100755 --- a/quickstart/docker/image/dockerTestEntrypoint.sh +++ b/quickstart/docker/image/dockerTestEntrypoint.sh @@ -8,4 +8,4 @@ touch runonce source "${ZITI_SCRIPTS}/ziti-cli-functions.sh" # Set the default password to be a specific value, if not set the password will be a random string and tests will fail export ZITI_PWD=admin -expressInstall "${ZITI_NETWORK}" +expressInstall "localhost" \ No newline at end of file From 14186663eed344aa24e8b1d28591d071243f2326 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Wed, 7 Dec 2022 12:31:55 -0500 Subject: [PATCH 42/46] Setting ZITI_BIN_ROOT explicitly for docker environments Removing overwrite of ZITI_BIN_ROOT closes #917 Signed-off-by: gberl002 --- quickstart/docker/image/Dockerfile | 1 + quickstart/docker/image/ziti-cli-functions.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/quickstart/docker/image/Dockerfile b/quickstart/docker/image/Dockerfile index becee11b1..8c93ce969 100644 --- a/quickstart/docker/image/Dockerfile +++ b/quickstart/docker/image/Dockerfile @@ -16,6 +16,7 @@ ENV ENV_FILE="${ZITI_HOME}/ziti.env" ENV ZITI_NETWORK=ziti # Don't put these paths on shared volume in docker-compose deployment (https://github.com/openziti/ziti/issues/912) ENV ZITI_BIN_DIR=/var/openziti/ziti-bin +ENV ZITI_BIN_ROOT="${ZITI_BIN_DIR}" ENV ZITI_SCRIPTS=/var/openziti/scripts # copy the ziti binaries to a directory already on the path diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 50304fa95..456198648 100755 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -1116,8 +1116,6 @@ function ziti_createEnvFile { export ZITI_SIGNING_ROOTCA_NAME="${ZITI_SIGNING_CERT_NAME}-root-ca" export ZITI_SIGNING_INTERMEDIATE_NAME="${ZITI_SIGNING_CERT_NAME}-intermediate" - export ZITI_BIN_ROOT="${ZITI_HOME}/ziti-bin" - if [[ "${ZITI_CTRL_MGMT_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_PORT="10000"; fi if [[ "${ZITI_CTRL_MGMT_HOST_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_HOST_PORT="${ZITI_CONTROLLER_HOSTNAME}:${ZITI_CTRL_MGMT_PORT}"; fi if [[ "${ZITI_CTRL_IDENTITY_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-client.cert"; fi From dff346026e54c24128202a5cfcb20c940292f267 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Fri, 9 Dec 2022 10:16:24 -0500 Subject: [PATCH 43/46] Update HA docs and developer setup instructions. Fix chain generation (#914) * Update HA docs and developer setup instructions. Fix chain generation, Add timeout to simple agent commands. Fixes #892 --- .gitignore | 2 + doc/ha/create-pki.sh | 20 ++ doc/ha/ctrl1.yml | 18 +- doc/ha/ctrl2.yml | 13 +- doc/ha/ctrl3.yml | 13 +- doc/ha/dev-setup.md | 102 +++++++++++ doc/ha/overview.md | 262 ++++++++++++++++++++++++--- go.mod | 4 +- go.sum | 8 +- ziti/cmd/agentcli/agent_ch_simple.go | 5 +- ziti/cmd/pki_create_intermediate.go | 5 + ziti/cmd/pki_create_server.go | 2 +- ziti/pki/pki/pki.go | 6 +- ziti/pki/store/local.go | 38 ++-- ziti/pki/store/store.go | 11 +- 15 files changed, 426 insertions(+), 83 deletions(-) create mode 100755 doc/ha/create-pki.sh create mode 100644 doc/ha/dev-setup.md diff --git a/.gitignore b/.gitignore index 3bab62e2e..8574236bb 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ linux-build go.work go.work.sum .github/workflows/localtest.yml +doc/ha/pki +doc/ha/data diff --git a/doc/ha/create-pki.sh b/doc/ha/create-pki.sh new file mode 100755 index 000000000..fbcd9b921 --- /dev/null +++ b/doc/ha/create-pki.sh @@ -0,0 +1,20 @@ +# Create the trust root, a self-signed CA +ziti pki create ca --trust-domain ha.test --pki-root ./pki --ca-file ca --ca-name 'HA Example Trust Root' + +# Create the controller 1 intermediate/signing cert +ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl1 --intermediate-name 'Controller One Signing Cert' + +# Create the controller 1 server cert +ziti pki create server --pki-root ./pki --ca-name ctrl1 --dns localhost --ip 127.0.0.1 --server-name ctrl1 --spiffe-id 'controller/ctrl1' + +# Create the controller 2 intermediate/signing cert +ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl2 --intermediate-name 'Controller Two Signing Cert' + +# Create the controller 2 server cert +ziti pki create server --pki-root ./pki --ca-name ctrl2 --dns localhost --ip 127.0.0.1 --server-name ctrl2 --spiffe-id 'controller/ctrl2' + +# Create the controller 3 intermediate/signing cert +ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl3 --intermediate-name 'Controller Three Signing Cert' + +# Create the controller 3 server cert +ziti pki create server --pki-root ./pki --ca-name ctrl3 --dns localhost --ip 127.0.0.1 --server-name ctrl3 --spiffe-id 'controller/ctrl3' diff --git a/doc/ha/ctrl1.yml b/doc/ha/ctrl1.yml index 71ef577c9..8ec3eb0a3 100644 --- a/doc/ha/ctrl1.yml +++ b/doc/ha/ctrl1.yml @@ -1,15 +1,17 @@ v: 3 raft: - minClusterSize: 1 + minClusterSize: 3 advertiseAddress: tls:localhost:6262 - dataDir: ${ZITI_DATA}/ctrl1 + dataDir: ./data/ctrl1 + bootstrapMembers: + - tls:127.0.0.1:6363 + - tls:127.0.0.1:6464 identity: - cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ctrl-client.cert.pem - server_cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ctrl-server.cert.pem - key: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/private/ctrl.key.pem - ca: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ca-chain.cert.pem + cert: ./pki/ctrl1/certs/server.cert + key: ./pki/ctrl1/keys/server.key + ca: ./pki/ctrl1/certs/server.chain.pem ctrl: listener: tls:127.0.0.1:6262 @@ -22,8 +24,8 @@ edge: address: 127.0.0.1:1280 enrollment: signingCert: - cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/intermediate.cert.pem - key: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/private/intermediate.key.decrypted.pem + cert: ./pki/ctrl1/certs/ctrl1.cert + key: ./pki/ctrl1/keys/ctrl1.key edgeIdentity: duration: 5m edgeRouter: diff --git a/doc/ha/ctrl2.yml b/doc/ha/ctrl2.yml index 0ad00aa06..bdbf2b983 100644 --- a/doc/ha/ctrl2.yml +++ b/doc/ha/ctrl2.yml @@ -3,13 +3,12 @@ v: 3 raft: minClusterSize: 3 advertiseAddress: tls:localhost:6363 - dataDir: ${ZITI_DATA}/ctrl2 + dataDir: ./data/ctrl2 identity: - cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ctrl-client.cert.pem - server_cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ctrl-server.cert.pem - key: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/private/ctrl.key.pem - ca: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ca-chain.cert.pem + cert: ./pki/ctrl2/certs/server.cert + key: ./pki/ctrl2/keys/server.key + ca: ./pki/ctrl2/certs/server.chain.pem ctrl: listener: tls:127.0.0.1:6363 @@ -22,8 +21,8 @@ edge: address: 127.0.0.1:1380 enrollment: signingCert: - cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/intermediate.cert.pem - key: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/private/intermediate.key.decrypted.pem + cert: ./pki/ctrl2/certs/ctrl2.cert + key: ./pki/ctrl2/keys/ctrl2.key edgeIdentity: duration: 5m edgeRouter: diff --git a/doc/ha/ctrl3.yml b/doc/ha/ctrl3.yml index 3620b1f0d..cdbb4123d 100644 --- a/doc/ha/ctrl3.yml +++ b/doc/ha/ctrl3.yml @@ -3,13 +3,12 @@ v: 3 raft: minClusterSize: 3 advertiseAddress: tls:localhost:6464 - dataDir: ${ZITI_DATA}/ctrl3 + dataDir: ./data/ctrl3 identity: - cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ctrl-client.cert.pem - server_cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ctrl-server.cert.pem - key: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/private/ctrl.key.pem - ca: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/ca-chain.cert.pem + cert: ./pki/ctrl3/certs/server.cert + key: ./pki/ctrl3/keys/server.key + ca: ./pki/ctrl3/certs/server.chain.pem ctrl: listener: tls:127.0.0.1:6464 @@ -22,8 +21,8 @@ edge: address: 127.0.0.1:1480 enrollment: signingCert: - cert: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/certs/intermediate.cert.pem - key: ${ZITI_SOURCE}/ziti/etc/ca/intermediate/private/intermediate.key.decrypted.pem + cert: ./pki/ctrl3/certs/ctrl3.cert + key: ./pki/ctrl3/keys/ctrl3.key edgeIdentity: duration: 5m edgeRouter: diff --git a/doc/ha/dev-setup.md b/doc/ha/dev-setup.md new file mode 100644 index 000000000..c14d0203d --- /dev/null +++ b/doc/ha/dev-setup.md @@ -0,0 +1,102 @@ +# HA Setup for Development + +**NOTE: HA is a work in progress and not yet usable for anything other than developing HA** + +To set up a local three node HA cluster, do the following. + +## Create a CA + +Create a self-signed certificate authority (CA) for the trust-root of your cluster + +``` +ziti pki create ca --trust-domain ha.test --pki-root ./pki --ca-file ca --ca-name 'HA Example Trust Root' +``` + +## Create Controller Certs + +We are going to create an intermediate CA for each controller. We'll use this intermediate CA +for the following purposes: + +1. To create a cert which will represent the controller. It will be used + 1. On the client side when dialing other controllers in the cluster + 2. On the server side when receiving connections from other controllers + 3. On the server side when receiving connections from routers + 4. On the server when handling REST API requests +2. To create identity certs as part of the identity enrollment process +3. To create router certs as part of the router enrollment process + +### Notes + +#### Client vs Server Certs + +You may use separate certs and keys for client and server connections, but it's not necessary. +When you use a server cert on the client side it exposes information about what IPs and DNS entries +the cert is valid for, but since we're only connecting to other controllers, this should not be +a concern. However, the option to use separate certs is available, should you wish to use it. + +#### REST Endpoint Certs + +You may also use a different set of certs for the REST endpoint. + +#### Sharing Signing Certs + +You could use the same signing cert for all controllers in a cluster. However, if a signing +cert is ever compromised, all certs signed by the signing cert would need to be revoked. By +using a separate cert for each controller we limit the fallout from an individual controller +or cert being compromised. + +### Create the Controller 1 signing and server certs + +```shell +# Create the controller 1 intermediate/signing cert +ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl1 --intermediate-name 'Controller One Signing Cert' + +# Create the controller 1 server cert +ziti pki create server --pki-root ./pki --ca-name ctrl1 --dns localhost --ip 127.0.0.1 --server-name ctrl1 --spiffe-id 'controller/ctrl1' + +# Create the controller 2 intermediate/signing cert +ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl2 --intermediate-name 'Controller Two Signing Cert' + +# Create the controller 2 server cert +ziti pki create server --pki-root ./pki --ca-name ctrl2 --dns localhost --ip 127.0.0.1 --server-name ctrl2 --spiffe-id 'controller/ctrl2' + +# Create the controller 3 intermediate/signing cert +ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl3 --intermediate-name 'Controller Three Signing Cert' + +# Create the controller 3 server cert +ziti pki create server --pki-root ./pki --ca-name ctrl3 --dns localhost --ip 127.0.0.1 --server-name ctrl3 --spiffe-id 'controller/ctrl3' +``` + +## Running the Controllers + +1. The controller configuration files have relative paths, so make sure you're running things from this directory. +2. Start all three controllers + 1. `ziti controller run ctrl1.yml` + 2. `ziti controller run ctrl2.yml` + 3. `ziti controller run ctrl3.yml` + 4. All three are configured with `minClusterSize` of 3, so they will wait to be joined to a raft cluster + 5. The ctrl1.yml config file has the other two controllers as bootstrap members, so when it starts the first controller will start trying form the raft cluster. +3. Initialize the edge using the agent + 1. `ziti agent controller init admin admin 'Default Admin'` + 2. You can of course use different values if you desire + +You should now have a three node cluster running. You can log into each controller individually. + +1. `ziti edge login localhost:1280` +2. `ziti edge -i ctrl2 login localhost:1380` +3. `ziti edge -i ctrl3 login localhost:1480` + +You could then create some model data on any controller: + +``` +ziti learn demo setup echo client +ziti learn demo setup echo single-sdk-hosted +``` + +Any view the results on any controller + +``` +ziti edge ls services +ziti edge -i ctrl2 ls services +ziti edge -i ctrl3 ls services +``` diff --git a/doc/ha/overview.md b/doc/ha/overview.md index b37054b9d..04c436fd7 100644 --- a/doc/ha/overview.md +++ b/doc/ha/overview.md @@ -1,42 +1,244 @@ -# HA Setup for Development +# OpenZiti HA -**NOTE: HA is a work in progress and not yet usable for anything other than developing HA** +This document gives a brief overview of how OpenZiti HA works and how it differs from running +OpenZiti in non-HA mode. -To set up a local three node HA cluster, do the following. +## Operational Considerations -1. Ensure ZITI_SOURCE is set to the directory under which you have ziti checked out - 1. Ex: if you have ziti checked out to ~/work/ziti, then set ZITI_SOURCE to ~/work -1. Create a directory where you want to store controller databases and raft data. -1. Set ZITI_DATA to this directory -1. Run `ziti-controller run ctrl1.yml` with the ctrl1.yml in this directory. - 1. This first controller is going to start a 1 node cluster, because raft/minClusterSize is set to 1 -1. Initialize the edge by doing `ziti agent controller init admin admin 'Default Admin'` - 1. You can of course use different values if you desire -1. Start the second and third controllers - 1. These are both configured with `minClusterSize` of 3, so they will wait to be joined to a raft cluster -1. Find the pid of the first ziti-controller instance -1. Add the first controller - 1. `ziti agent controller raft-join $(cat $ZITI_DATA/ctrl1/id) tls:localhost:6363` -1. Join the second controller - 1. `ziti agent controller raft-join $(cat $ZITI_DATA/ctrl2/id) tls:localhost:6464` +### System of Record -You should now have a three node cluster running. You can log into each controller individually. +In controller that's not configured for HA, the bolt database is the system of record. In +an HA setup, the raft journal is the system of record. The raft journal is stored in two places, +a snapshot directory and a bolt database of raft journal entries. -1. `ziti edge login localhost:1280` -1. `ziti edge -i ctrl2 login localhost:1380` -1. `ziti edge -i ctrl3 login localhost:1480` +So a non-HA setup will have: -You could then create some model data on any controller: +* ctrl.db -``` -ziti demo setup echo client -ziti demo setup echo single-sdk-hosted +An HA setup will have: + +* raft.db - the bolt database containing raft journal entries +* snapshots/ - a directory containing raft snapshots. Each snapshot is snapshot of the controller bolt db +* ctrl.db - the controller bolt db, with the current state of the model + +The location of all three is controlled by the raft/dataDir config property. + +```yaml +raft: + dataDir: /var/ziti/data/ ``` -Any view the results on any controller +When an HA controller starts up, it will first apply the newest snapshot, then any newer journal entries +that aren't yet contained in a snapshot. This means that an HA controller should start with a +blank DB that can be overwritten by snapshot and/or have journal entries applied to it. So an HA +controller will delete or rename the existing controller database and start with a fresh bolt db. +### Bootstrapping + +#### Cluster Initialization + +Initial cluster setup can be configured either in the config file or via agent commands. + +The controller will not fully start until the raft cluster has bootstrapped. The minimum +number of cluster members is set in the config file. Recommended cluster sizes are +3, 5 or 7. A cluster size of 1 is mostly useful for testing and development. + +**Config File Example** + +```yaml +raft: + dataDir: /var/ziti/data/ + minClusterSize: 3 + bootstrapMembers: + - tls:192.168.1.100 + - tls:192.168.1.101 ``` -ziti edge ls services -ziti edge -i ctrl2 ls services -ziti edge -i ctrl3 ls services + +**Agent Comands** + +There are now three new agent commands specific to the controller. + +**Adding Members** + +```shell +# Adding Members +ziti agent controller raft-join + +# Listing Members +ziti agent controller raft-list + +# Removing Members +ziti agent controller raft-remove ``` + +#### Edge Admin Initialization + +Because RAFT is now the system of record, the previous pattern for configuring the default +admin won't work. In a non-HA system you initialized the controller raft DB with an admin +user directly. If you do this with an HA system, the changes you made directly to the DB +will be lost and replaced by whatever is in raft. To initialize an HA controller cluster +use the new agent command. + +```shell +ziti agent controller init +``` + +The controller will not fully start until the edge admin has been initialized. + +### Snapshot Application and Restarts + +If a controller receives a snapshot to apply after starting up, it will apply the snapshot and +then terminate. This assumes that there is a restart script which will bring the controller +back up after it terminates. + +This should only happen if a controller is connected to the cluster and then gets disconnected +for long enough that a snapshot is created while it's disconnected. Because applying a snapshot +requires replacing the underlying controller bolt DB, the easiest way to do that is restart. +That way we don't have to worry about replacing the bolt DB underneath a running system. + +### Metrics + +In an HA system, routers will send metrics to all controllers to which they are connected. +There is a new `doNotPropagate` flag in the metrics message, which will be set to false +until the router has successfully delivered the metrics message to a controller. The flag +will then be set to true. So the first controller to get the metrics message is expected +to deliver the metrics message to the events system for external integrators. The other +controllers will have `doNotPropage` set to true, and will only use the metrics message +internally, to update routing data. + +### Certificates + +There are many ways to set up certificates, so this will just cover a recommended configuration. + +The primary thing to ensure is that controllers have a shared root of trust. A configuration +that works would be as follows: + +1. Create a self-signed root CA +2. Create an intermediate signing cert for each controller +3. Create a server cert using the signing cert for each controller +4. Make sure that the CA bundle for each server includes both the root CA and the intermediate CA for that server + +See [Developer Setup](./dev-setup.md) for the commands to make this happen and a bit more discussion +of certs. + +## Distributed Model + +When looking at how to make the OpenZiti controller model distributed, we first looked at +what characteristics we needed for the model data. + +Model data is the information the controller needs to figure out what it can do. This +includes things like: + +* Services +* Routers +* Terminator +* Identities +* Policies +* Configs + +### Model Data Characteristics + +* All data required on every controller +* Read characteristics + * Reads happen all the time, from every client and as well as admins + * Speed is very important. They affect how every client perceives the system. + * Availability is very important. Without reading definitions, can’t create new connections + * Can be against stale data, if we get consistency within a reasonable timeframe (seconds to minutes) +* Write characteristics + * Writes only happen from administrators + * Speed needs to be reasonable, but doesn't need to be blazing fast + * Write availability can be interrupted, since it primarily affects management operations + * Must be consistent. Write validation can’t happen with stale data. Don’t want to have to deal with reconciling concurrent, contradictory write operations. +* Generally involves controller to controller coordination + +Of the distribution mechanisms we looked at, RAFT had the best fit. + +### RAFT Characteristics + +* Writes + * Consistency over availability + * Good but not stellar performance +* Reads + * Every node has full state + * Local state is always internally consistent, but maybe slightly behind the leader + * No coordination required for reads + * Fast reads + * Reads work even when other nodes are unavailable + * If latest data is desired, reads can be forwarded to the current leader + +So the OpenZiti controller uses RAFT to distribute the data model. Specifically it uses the +[HashiCorp Raft Library](https://github.com/hashicorp/raft/). + +### Updates + +The basic flow for model updates is as follows: + +1. A client requests a model update via the REST API. +2. The controller checks if it is the raft cluster leader. If it is not, it forwards the request to the leader. +3. Once the request is on the leader, it applies the model update to the raft log. This involves getting a quorum of the controllers to accept the update. +4. One the update has been accepted, it will be executed on each node of the cluster. This will generate create one or more changes to the bolt database. +5. The results of the operation (success or failure) are returned to the controller which received the original REST request. +6. The controller waits until the operation has been applied locally. +7. The result is returned to the REST client. + +### Reads + +Reads are always done to the local bolt database for performance. The assumption is that if something +like a policy change is delayed, it may temporarily allow a circuit to be created, but as soon as +the policy update is applied, it will make changes to circuits as necessary. + +## Runtime Data + +In addition to model data, the controller also manages some amount of runtime data. This data is +for running OpenZiti's core functions, i.e. managing the flow of data across the mesh, along with +related authentication data. So this includes things like: + +* Links +* Circuits +* API Sessions +* Sessions +* Posture Data + +### Runtime Data Characteristics + +Runtime data has different characteristics than the model data does. + +* Not necessarily shared across controllers +* Reads **and** writes must be very fast +* Generally involves sdk to controller or controller to router coordination + +Because writes must also be fast, RAFT is not a good candidate for storing this data. +Good performance is critical for these components, so they are each evaluated individually. + +### Links + +Each controller currently needs to know about links so that it can make routing decisions. +However, links exist on routers. So, routers are the source of record for links. +When a router connects to a controller, the router will tell the controller about any +links that it already has. The controller will ask to fill in any missing links and +the controller will ensure that it doesn't create duplicate links if multiple +controllers request the same link be created. If there are duplicates, the router +will inform the controller of the existing link. + +The allows the routers to properly handle link dials from multiple routers and keep +controllers up to date with the current known links. + +### Circuits + +Circuits were and continue to be stored in memory for both standalone and HA mode +controllers.Circuits are not distributed. Rather, each controller remains responsible +for any circuits that it created. + +When a router needs to initiate circuit creation it will pick the one with the lowest +response time and send a circuit creation request to that router. The controller +will establish a route. Route tables as well as the xgress endpoints now track +which controller is responsible for the associated circuit. This way when failures +or other notifications need to be sent, the router knows which controller to talk to. + +This gets routing working with multiple controllers without a major refactor. Future +work will likely delegate more routing control to the routers, so routing should +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. \ No newline at end of file diff --git a/go.mod b/go.mod index 6ae36080b..4fc06391c 100644 --- a/go.mod +++ b/go.mod @@ -22,8 +22,8 @@ require ( github.com/michaelquigley/pfxlog v0.6.9 github.com/openziti/agent v1.0.6 github.com/openziti/channel/v2 v2.0.20 - github.com/openziti/edge v0.24.59 - github.com/openziti/fabric v0.21.27 + github.com/openziti/edge v0.24.61 + github.com/openziti/fabric v0.21.28 github.com/openziti/foundation/v2 v2.0.8 github.com/openziti/identity v1.0.26 github.com/openziti/runzmd v1.0.5 diff --git a/go.sum b/go.sum index d37f9d8dd..e875d0e1f 100644 --- a/go.sum +++ b/go.sum @@ -698,10 +698,10 @@ github.com/openziti/channel/v2 v2.0.20 h1:bm7+EMz94aEC74dcVwbw5EPd/+/zofDmTGGIhf github.com/openziti/channel/v2 v2.0.20/go.mod h1:wrNdnG22WnX9sSZlGDF6H14PxTn2S8KIZYE1sc5JMLA= 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.59 h1:n5KRvqLdIAMgZVug4vkjW8F7A02aAdz0mP5jFFg+HTI= -github.com/openziti/edge v0.24.59/go.mod h1:tFwfmPgpipO1nQB9CNsy6WNBffAWYVR4leYJL3VjodU= -github.com/openziti/fabric v0.21.27 h1:oB9iELm/s/IzX9oGE1GCy1thoBDUtXp8N7Ruq3021uA= -github.com/openziti/fabric v0.21.27/go.mod h1:MHK/9Ysr5pNpTaeyBWBvFSV2EhpHSevPhor66eYGMDk= +github.com/openziti/edge v0.24.61 h1:QEGKIj66KEWP7f1aHu4B+jJruUuSoMX8dFRYU7JpNV0= +github.com/openziti/edge v0.24.61/go.mod h1:HHbIBpV//bOG8+EgcS0teNaoUGH6XS394ZTgD1RU75I= +github.com/openziti/fabric v0.21.28 h1:4XM1qBvtb06lOI/qPODiXp4OBVTeKoBUR3OcuWf1JeE= +github.com/openziti/fabric v0.21.28/go.mod h1:/BeJht2ApM5FyOyVDPkWG4zoKArKq8qdjPIn81ZOOVo= github.com/openziti/foundation/v2 v2.0.8 h1:0Y7GG7C+84yC7OxfqnRJjZGQaVqtkRKuCWzCrfFQts4= github.com/openziti/foundation/v2 v2.0.8/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= github.com/openziti/identity v1.0.26 h1:t0LrFC6vQgYoJF45GPQBP+6IPwP8kgpctTo10hJicH4= diff --git a/ziti/cmd/agentcli/agent_ch_simple.go b/ziti/cmd/agentcli/agent_ch_simple.go index ac97ef999..1931974a9 100644 --- a/ziti/cmd/agentcli/agent_ch_simple.go +++ b/ziti/cmd/agentcli/agent_ch_simple.go @@ -31,6 +31,7 @@ import ( type SimpleChAgentCmdOptions struct { AgentOptions requestType int32 + timeout time.Duration } func NewSimpleChAgentCustomCmd(name string, appId AgentAppId, op int32, p common.OptionsProvider) *cobra.Command { @@ -52,6 +53,8 @@ func NewSimpleChAgentCustomCmd(name string, appId AgentAppId, op int32, p common }, } + cmd.Flags().DurationVarP(&options.timeout, "timeout", "t", 5*time.Second, "How long to wait for operation to complete") + return cmd } @@ -75,7 +78,7 @@ func (o *SimpleChAgentCmdOptions) makeRequest(conn net.Conn) error { } msg := channel.NewMessage(o.requestType, nil) - reply, err := msg.WithTimeout(5 * time.Second).SendForReply(ch) + reply, err := msg.WithTimeout(o.timeout).SendForReply(ch) if err != nil { return err } diff --git a/ziti/cmd/pki_create_intermediate.go b/ziti/cmd/pki_create_intermediate.go index 21cad1e52..eb921a6cf 100644 --- a/ziti/cmd/pki_create_intermediate.go +++ b/ziti/cmd/pki_create_intermediate.go @@ -123,6 +123,11 @@ func (o *PKICreateIntermediateOptions) Run() error { return errors.Wrap(err, "cannot sign") } + // Concat the newly-created intermediate cert with the signing cert to create an intermediate.chain.pem file + if err := o.Flags.PKI.Chain(signer, req); err != nil { + return errors.Wrap(err, "unable to generate cert chain") + } + log.Infoln("Success") return nil diff --git a/ziti/cmd/pki_create_server.go b/ziti/cmd/pki_create_server.go index 469248d58..59e959189 100644 --- a/ziti/cmd/pki_create_server.go +++ b/ziti/cmd/pki_create_server.go @@ -157,7 +157,7 @@ func (o *PKICreateServerOptions) Run() error { // Concat the newly-created server cert with the intermediate cert to create a server.chain.pem file if err := o.Flags.PKI.Chain(signer, req); err != nil { - return errors.Wrap(err, "cannot sign") + return errors.Wrap(err, "unable to generate cert chain") } log.Infoln("Success") diff --git a/ziti/pki/pki/pki.go b/ziti/pki/pki/pki.go index 232daed0a..f9207a8da 100644 --- a/ziti/pki/pki/pki.go +++ b/ziti/pki/pki/pki.go @@ -154,7 +154,11 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error { // Chain will... func (e *ZitiPKI) Chain(signer *certificate.Bundle, req *Request) error { - if err := e.Store.Chain(signer.Name, req.Name); err != nil { + destCA := signer.Name + if req.Template.IsCA { + destCA = req.Name + } + if err := e.Store.Chain(signer.Name, destCA, req.Name); err != nil { return fmt.Errorf("failed saving generated chain: %v", err) } return nil diff --git a/ziti/pki/store/local.go b/ziti/pki/store/local.go index 3611ad3c3..f6a1eaf90 100644 --- a/ziti/pki/store/local.go +++ b/ziti/pki/store/local.go @@ -23,7 +23,6 @@ import ( "fmt" "github.com/openziti/ziti/ziti/pki/certificate" "io" - "io/ioutil" "math/big" "os" "path/filepath" @@ -50,7 +49,7 @@ var ( // 4 Serial // 5 Filename // 6 Subject - indexRegexp = regexp.MustCompile("^(V|R|E)\t([0-9]{12}Z)\t([0-9]{12}Z)?\t([0-9a-fA-F]{2,})\t([^\t]+)\t(.+)") + indexRegexp = regexp.MustCompile("^([VRE])\t([0-9]{12}Z)\t([0-9]{12}Z)?\t([0-9a-fA-F]{2,})\t([^\t]+)\t(.+)") ) // Local lets us store a Certificate Authority on the local filesystem. @@ -80,7 +79,7 @@ func (l *Local) Exists(caName, name string) bool { return false } -// Fetch fetchs the private key and certificate for a given name signed by caName. +// Fetch fetches the private key and certificate for a given name signed by caName. func (l *Local) Fetch(caName, name string) ([]byte, []byte, error) { filepath.Join(l.Root, caName) @@ -96,12 +95,12 @@ func (l *Local) Fetch(caName, name string) ([]byte, []byte, error) { return k, c, nil } -// Fetch fetchs the private key and certificate for a given name signed by caName. +// FetchKeyBytes fetchs the private key and certificate for a given name signed by caName. func (l *Local) FetchKeyBytes(caName, name string) ([]byte, error) { filepath.Join(l.Root, caName) keyPath, _ := l.path(caName, name) - bytes, err := ioutil.ReadFile(keyPath) + bytes, err := os.ReadFile(keyPath) if err != nil { return nil, fmt.Errorf("failed reading %v: %v", keyPath, err) } @@ -109,7 +108,7 @@ func (l *Local) FetchKeyBytes(caName, name string) ([]byte, error) { } func readPEM(path string) ([]byte, error) { - bytes, err := ioutil.ReadFile(path) + bytes, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("failed reading %v: %v", path, err) } @@ -135,18 +134,18 @@ func (l *Local) Add(caName, name string, isCa bool, key, cert []byte) error { } // Chain concats an intermediate cert and a newly signed certificate bundle and adds the chained cert to the store. -func (l *Local) Chain(caName, name string) error { +func (l *Local) Chain(caName, destCaName, name string) error { chainName := name + ".chain.pem" - if l.Exists(caName, chainName) { - return fmt.Errorf("a bundle already exists for the name %v within CA %v", chainName, caName) + if l.Exists(destCaName, chainName) { + return fmt.Errorf("a bundle already exists for the name %v within CA %v", chainName, destCaName) } - if err := l.writeChainBundle(caName, name, chainName); err != nil { + if err := l.writeChainBundle(caName, destCaName, name, chainName); err != nil { return fmt.Errorf("failed writing chain %v to the local filesystem: %v", chainName, err) } return nil } -// Add adds the given csr to the local filesystem. +// AddCSR adds the given csr to the local filesystem. func (l *Local) AddCSR(caName, name string, isCa bool, key, cert []byte) error { if l.Exists(caName, name) { return fmt.Errorf("a CSR already exists for the name %v within CA %v", name, caName) @@ -157,7 +156,7 @@ func (l *Local) AddCSR(caName, name string, isCa bool, key, cert []byte) error { return nil } -// Add adds the given key to the local filesystem. +// AddKey adds the given 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) @@ -217,7 +216,7 @@ func (l *Local) writeBundle(caName, name string, isCa bool, key, cert []byte) er } // writeChainBundle concats... -func (l *Local) writeChainBundle(caName, name string, chainName string) error { +func (l *Local) writeChainBundle(caName, destCaName, name string, chainName string) error { caDir := filepath.Join(l.Root, caName) if _, err := os.Stat(caDir); err != nil { if err := InitCADir(caDir); err != nil { @@ -225,10 +224,15 @@ func (l *Local) writeChainBundle(caName, name string, chainName string) error { } } - caPath := filepath.Join(l.Root, caName, LocalCertsDir, caName+".cert") - caIn, err := os.Open(caPath) + caChainPath := filepath.Join(l.Root, caName, LocalCertsDir, caName+".chain.pem") + caIn, err := os.Open(caChainPath) if err != nil { - return fmt.Errorf("failed to open CA: %v: %v", caPath, err) + // no chain path, likely means we're using the root as the CA, so fallback to the cert + caPath := filepath.Join(l.Root, caName, LocalCertsDir, caName+".cert") + caIn, err = os.Open(caPath) + if err != nil { + return fmt.Errorf("failed to open CA: %v: %v", caPath, err) + } } defer caIn.Close() @@ -239,7 +243,7 @@ func (l *Local) writeChainBundle(caName, name string, chainName string) error { } defer serverCertIn.Close() - chainCertPath := filepath.Join(l.Root, caName, LocalCertsDir, chainName) + chainCertPath := filepath.Join(l.Root, destCaName, LocalCertsDir, chainName) out, err := os.OpenFile(chainCertPath, os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return fmt.Errorf("failed to open chain file: %v: %v", chainCertPath, err) diff --git a/ziti/pki/store/store.go b/ziti/pki/store/store.go index d0aff3cfa..0ac99c53f 100644 --- a/ziti/pki/store/store.go +++ b/ziti/pki/store/store.go @@ -23,7 +23,7 @@ import ( "math/big" ) -// Store reprents a way to store a Certificate Authority. +// Store represents a way to store a Certificate Authority. type Store interface { // Add adds a newly signed certificate bundle to the store. // @@ -37,14 +37,15 @@ type Store interface { // Returns an error if it failed to store the bundle. Add(string, string, bool, []byte, []byte) error - // Chain concats an intermediate cert and a newly signed certificate bundle and adds the chained cert to the store. + // Chain concats a signing cert and a newly signed certificate bundle and adds the chained cert to the store. // // Args: - // The intermediate CA name. + // The signing CA name. + // The destination CA name. // The certificate bundle name. // // Returns an error if it failed to store the bundle. - Chain(string, string) error + Chain(string, string, string) error // AddCSR adds a CSR to the store. // @@ -58,7 +59,7 @@ type Store interface { // Returns an error if it failed to store the bundle. AddCSR(string, string, bool, []byte, []byte) error - // Add adds a new private key to the store. + // AddKey adds a new private key to the store. // // Args: // The intermediate CA name From 1798a4eaee08652820c3cd7ed5bbe98d077463ba Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 12 Dec 2022 10:42:58 -0500 Subject: [PATCH 44/46] Update ha docs and update deps --- doc/ha/overview.md | 36 ++++++++++++++++++++++ go.mod | 38 +++++++++++------------ go.sum | 75 +++++++++++++++++++++++----------------------- 3 files changed, 93 insertions(+), 56 deletions(-) diff --git a/doc/ha/overview.md b/doc/ha/overview.md index 04c436fd7..6756fdd6e 100644 --- a/doc/ha/overview.md +++ b/doc/ha/overview.md @@ -118,9 +118,45 @@ that works would be as follows: 3. Create a server cert using the signing cert for each controller 4. Make sure that the CA bundle for each server includes both the root CA and the intermediate CA for that server +Note that controller server certs must contain a SPIFFE id of the form + +``` +spiffe:///controller/ +``` + +So if your trust domain is `example.com` and your controller id is `ctrl1`, then your SPIFFE id +would be: + +``` +spiffe://example.com/controller/ctrl1 +``` + +**SPIFFE ID Notes:** + +* This ID must be set as the only URI in the `X509v3 Subject Alternative Name` field in the certificate. +* These IDs are used to allow the controllers to identify each during the mTLS negotiation. +* The OpenZiti CLI supports creating SPIFFE IDs in your certs + * Use the `--trust-domain` flag when creating CAs + * Use the `--spiffe-id` flag when creating server or client certificates + See [Developer Setup](./dev-setup.md) for the commands to make this happen and a bit more discussion of certs. +### Open Ports + +Controllers now establish connections with each other, for two purposes. + +1. Forwarding model updates to the leader, so they can be applied to the raft cluster +2. raft communication + +Both kinds of traffic flow over the same connection. + +These connections do not require any extra open ports as we are using the control +channel listener to listen to both router and controller connections. As part of +the connection process the connection type is provided and the appropriate +authentication and connection setup happens based on the connection type. If no +connection type is provided, it's assumed to be a router. + ## Distributed Model When looking at how to make the OpenZiti controller model distributed, we first looked at diff --git a/go.mod b/go.mod index 4fc06391c..11e5620ac 100644 --- a/go.mod +++ b/go.mod @@ -20,16 +20,16 @@ require ( github.com/jedib0t/go-pretty/v6 v6.4.0 github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 github.com/michaelquigley/pfxlog v0.6.9 - github.com/openziti/agent v1.0.6 - github.com/openziti/channel/v2 v2.0.20 - github.com/openziti/edge v0.24.61 - github.com/openziti/fabric v0.21.28 - github.com/openziti/foundation/v2 v2.0.8 - github.com/openziti/identity v1.0.26 - github.com/openziti/runzmd v1.0.5 - github.com/openziti/sdk-golang v0.18.10 - github.com/openziti/storage v0.1.28 - github.com/openziti/transport/v2 v2.0.45 + github.com/openziti/agent v1.0.7 + github.com/openziti/channel/v2 v2.0.24 + github.com/openziti/edge v0.24.75 + github.com/openziti/fabric v0.21.36 + github.com/openziti/foundation/v2 v2.0.9 + github.com/openziti/identity v1.0.28 + github.com/openziti/runzmd v1.0.7 + github.com/openziti/sdk-golang v0.18.19 + github.com/openziti/storage v0.1.30 + github.com/openziti/transport/v2 v2.0.48 github.com/openziti/xweb/v2 v2.0.2 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pborman/uuid v1.2.0 @@ -43,7 +43,7 @@ require ( github.com/spf13/viper v1.10.0 github.com/stretchr/testify v1.8.1 go.etcd.io/bbolt v1.3.6 - golang.org/x/net v0.2.0 + golang.org/x/net v0.4.0 google.golang.org/grpc v1.42.0 google.golang.org/protobuf v1.28.1 gopkg.in/AlecAivazis/survey.v1 v1.8.7 @@ -116,7 +116,7 @@ require ( github.com/kataras/go-events v0.0.3-0.20201007151548-c411dc70c0a6 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kr/pty v1.1.8 // indirect - github.com/kyokomi/emoji/v2 v2.2.10 // indirect + github.com/kyokomi/emoji/v2 v2.2.11 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/lucsky/cuid v1.2.1 // indirect github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect @@ -143,7 +143,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.2 // indirect - github.com/openziti/metrics v1.2.0 // indirect + github.com/openziti/metrics v1.2.2 // indirect github.com/openziti/x509-claims v1.0.3 // indirect github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect @@ -172,14 +172,14 @@ require ( go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect go.opentelemetry.io/otel v1.11.1 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect - golang.org/x/crypto v0.3.0 // indirect - golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect - golang.org/x/image v0.1.0 // indirect + golang.org/x/crypto v0.4.0 // indirect + golang.org/x/exp v0.0.0-20221211140036-ad323defaf05 // indirect + golang.org/x/image v0.2.0 // indirect golang.org/x/mod v0.6.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/term v0.2.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/term v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect golang.org/x/tools v0.2.0 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/ini.v1 v1.66.2 // indirect diff --git a/go.sum b/go.sum index e875d0e1f..81bceaca0 100644 --- a/go.sum +++ b/go.sum @@ -546,8 +546,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= -github.com/kyokomi/emoji/v2 v2.2.10 h1:1z5eMVcxFifsmEoNpdeq4UahbcicgQ4FEHuzrCVwmiI= -github.com/kyokomi/emoji/v2 v2.2.10/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= +github.com/kyokomi/emoji/v2 v2.2.11 h1:Pf/ZWVTbnAVkHOLJLWjPxM/FmgyPe+d85cv/OLP5Yus= +github.com/kyokomi/emoji/v2 v2.2.11/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= @@ -692,32 +692,32 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openziti/agent v1.0.6 h1:9CE7tPHRk/agfl8UNlFYIEg925RlNdVyILrCmxuHag4= -github.com/openziti/agent v1.0.6/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= -github.com/openziti/channel/v2 v2.0.20 h1:bm7+EMz94aEC74dcVwbw5EPd/+/zofDmTGGIhfTcz9k= -github.com/openziti/channel/v2 v2.0.20/go.mod h1:wrNdnG22WnX9sSZlGDF6H14PxTn2S8KIZYE1sc5JMLA= +github.com/openziti/agent v1.0.7 h1:tEZlYQ5/y7oeuYUAdqN6AAayQAloL8Ms6prSddaUDVY= +github.com/openziti/agent v1.0.7/go.mod h1:6APWgkPP6Uxf1/VyirdTVLAJxwam2vVyakrVw6yvs40= +github.com/openziti/channel/v2 v2.0.24 h1:mg9/+VMyXKXfbTZ06quwjRcTQAqU/MEMm+KxAboRLEo= +github.com/openziti/channel/v2 v2.0.24/go.mod h1:Y75U/q7l2U+Iib+rfSXO0IscYvksfwWjgdGDXcM/WwY= 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.61 h1:QEGKIj66KEWP7f1aHu4B+jJruUuSoMX8dFRYU7JpNV0= -github.com/openziti/edge v0.24.61/go.mod h1:HHbIBpV//bOG8+EgcS0teNaoUGH6XS394ZTgD1RU75I= -github.com/openziti/fabric v0.21.28 h1:4XM1qBvtb06lOI/qPODiXp4OBVTeKoBUR3OcuWf1JeE= -github.com/openziti/fabric v0.21.28/go.mod h1:/BeJht2ApM5FyOyVDPkWG4zoKArKq8qdjPIn81ZOOVo= -github.com/openziti/foundation/v2 v2.0.8 h1:0Y7GG7C+84yC7OxfqnRJjZGQaVqtkRKuCWzCrfFQts4= -github.com/openziti/foundation/v2 v2.0.8/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= -github.com/openziti/identity v1.0.26 h1:t0LrFC6vQgYoJF45GPQBP+6IPwP8kgpctTo10hJicH4= -github.com/openziti/identity v1.0.26/go.mod h1:b/fapA3IvFcMa69IsIRODDHiezi/DaYm+jKqFKNn1vM= +github.com/openziti/edge v0.24.75 h1:siioCtoR1ZgiLO1NRqyUT+cEO9UtN6jNTKzs/978ZOk= +github.com/openziti/edge v0.24.75/go.mod h1:UYTO4JPv8Wud7rWbrA5XImyGUZIMdliSTRCXe3ZYXN0= +github.com/openziti/fabric v0.21.36 h1:AIqNFL+W0uPhItroVcr7+9uJB4fd9S46y0c9I/7P2bk= +github.com/openziti/fabric v0.21.36/go.mod h1:HBtR0TQ7kLWjp08ynloTV2CaJNRdFbybsEUlJQ0xjwo= +github.com/openziti/foundation/v2 v2.0.9 h1:4Z53AzfCcI8XK46eeoSDabroVk1GS2An04WDjNfwmio= +github.com/openziti/foundation/v2 v2.0.9/go.mod h1:Z0gnQsGJb/H/B+pixLtmCIpw1dBllD4QoT6LeD35WzA= +github.com/openziti/identity v1.0.28 h1:0Rjss3aBT4a2iC8IEXxzj2kfld5LTSD3eEUQkx8Uy+E= +github.com/openziti/identity v1.0.28/go.mod h1:5eDB+JOGuvu6XsA8dAkVDMdoyiylQBS5UqLLMAbiV9Y= github.com/openziti/jwks v1.0.2 h1:32BGXIAnefS+v7uXKPb1x8/cQ7srek6Ai06dsrMTY4E= github.com/openziti/jwks v1.0.2/go.mod h1:KwO0x9FBG0aoJS5f6nH5xeHoplyR1H143SMI9kF0mC8= -github.com/openziti/metrics v1.2.0 h1:s/LUPdCaX1i8ZPRgEQNhg4ekUeID0P2I1TVFa4NpQuE= -github.com/openziti/metrics v1.2.0/go.mod h1:ZGAUFO3Q89j2U4zAxNraZfepwMpP4lkMepEnh2zO+lA= -github.com/openziti/runzmd v1.0.5 h1:H+SHafF+g6lr34/5yc8uwMH9Ra74q0uwG63ZdH7Kcgw= -github.com/openziti/runzmd v1.0.5/go.mod h1:tHlzIpZwgWP7OORUVe11bLiKq4Veo51t5S9SjQrjLCw= -github.com/openziti/sdk-golang v0.18.10 h1:eBkH8In+1nkJjDMHmQUDmnOg7yYo+2KDjz05tZ4ip2o= -github.com/openziti/sdk-golang v0.18.10/go.mod h1:PQA1J9Hkg4dxvXI1OZLhtBiTYvspnonAah8LtOruc8g= -github.com/openziti/storage v0.1.28 h1:h9TlQHdjRZQ+GfZ66D8y4kNRvHnMNcmB7BiysuHJAy8= -github.com/openziti/storage v0.1.28/go.mod h1:eo3uH/2yOmesRRposgSZgVYKRZhmvHWx0/EdWb1c5v4= -github.com/openziti/transport/v2 v2.0.45 h1:wL9Q6jB2CeZ5Fxw3AMIVNY1r+PQrLuyoIsmmrB56Z9Y= -github.com/openziti/transport/v2 v2.0.45/go.mod h1:dpf6sh+PexxXggeVzCerrEP2cO2kcC3el3UkwFwnPTc= +github.com/openziti/metrics v1.2.2 h1:L2V1yc+eIp8ARn74Pv4jL8YSJaMskaGW3DJdmWt+hi8= +github.com/openziti/metrics v1.2.2/go.mod h1:I9s/rq19W7XPNMgR/zLQr1Yz9rAXzajuf9hneWM2JIE= +github.com/openziti/runzmd v1.0.7 h1:2EC3bVjjAuFsECaZbwTOJdDbSk3I8JpfaI2ruGdEGiA= +github.com/openziti/runzmd v1.0.7/go.mod h1:0AlunP33eJ/S21az+ACP9/INVeUSR80pELXYXs2hK0I= +github.com/openziti/sdk-golang v0.18.19 h1:mtoSdGLgCabo/wLTpafMY7aqWZ7hU3YrwKduTRvYrL4= +github.com/openziti/sdk-golang v0.18.19/go.mod h1:AVmYqSCfUQ1pQQKfhgCqO+Bkc2sYzzn7W6KoHO7TZsM= +github.com/openziti/storage v0.1.30 h1:ZrX3SYNrElSrZ0fDbU1F9bPz4a+aghD+9h1qXAbJfIg= +github.com/openziti/storage v0.1.30/go.mod h1:mvjbhHA9nAE0tTCG2ywwvaZnuLYnqejxyFbtmK9ErJw= +github.com/openziti/transport/v2 v2.0.48 h1:9j8UcJ+4qXEUS9jvf3AbnajEbJwh+hZe6D4dbzD8tUc= +github.com/openziti/transport/v2 v2.0.48/go.mod h1:665EJFwx9/gbr6u/25j1CoxvV17X0TttQv0Pb0YK0DU= 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= @@ -1007,8 +1007,8 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= +golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= 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= @@ -1019,14 +1019,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-20221126150942-6ab00d035af9 h1:yZNXmy+j/JpX19vZkVktWqAo7Gny4PBWYYK3zskGpx4= -golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20221211140036-ad323defaf05 h1:T8EldfGCcveFMewH5xAYxxoX3PSQMrsechlUGVFlQBU= +golang.org/x/exp v0.0.0-20221211140036-ad323defaf05/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk= -golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c= +golang.org/x/image v0.2.0 h1:/DcQ0w3VHKCC5p0/P2B0JpAZ9Z++V2KOo2fyU89CXBQ= +golang.org/x/image v0.2.0/go.mod h1:la7oBXb9w3YFjBqaAwtynVioc1ZvOnNteUNrifGNmAI= 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= @@ -1109,8 +1109,8 @@ golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= 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= @@ -1226,12 +1226,13 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.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.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= 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= @@ -1241,8 +1242,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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= From 3b52e7fa0cb5b28609338cd0f5b021e3aaffa745 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 12 Dec 2022 11:47:04 -0500 Subject: [PATCH 45/46] Add component updates to changelog --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fbe6387f..af1e6b3bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,33 @@ * `ziti edge enroll` now has a verbose option for additional debugging * The `ziti edge` CLI now support create/delete transit-router. This allows transit/fabric routers to be provisioned using an enrollment process, rather than requiring certs to be created externally. Note that this requires that the fabric router config file has a `csr` section. +## Component Updates and Bug Fixes + +* github.com/openziti/agent: [v1.0.5 -> v1.0.7](https://github.com/openziti/agent/compare/v1.0.5...v1.0.7) +* github.com/openziti/channel/v2: [v2.0.12 -> v2.0.24](https://github.com/openziti/channel/compare/v2.0.12...v2.0.24) +* github.com/openziti/edge: [v0.24.36 -> v0.24.75](https://github.com/openziti/edge/compare/v0.24.36...v0.24.75) + * [Issue #1253](https://github.com/openziti/edge/issues/1253) - Panic in controller getting hello from edge router + * [Issue #1233](https://github.com/openziti/edge/issues/1233) - edge-routers ref link in identities endpoint is incorrectly keyed + * [Issue #1234](https://github.com/openziti/edge/issues/1234) - identities missing service-config link ref + * [Issue #1232](https://github.com/openziti/edge/issues/1232) - edge management api identity-types endpoint produces incorrect links + +* github.com/openziti/fabric: [v0.21.17 -> v0.21.36](https://github.com/openziti/fabric/compare/v0.21.17...v0.21.36) + * [Issue #525](https://github.com/openziti/fabric/issues/525) - Update metrics message propagation from router to controller for HA + +* github.com/openziti/foundation/v2: [v2.0.7 -> v2.0.9](https://github.com/openziti/foundation/compare/v2.0.7...v2.0.9) +* github.com/openziti/identity: [v1.0.20 -> v1.0.28](https://github.com/openziti/identity/compare/v1.0.20...v1.0.28) +* github.com/openziti/runzmd: [v1.0.3 -> v1.0.7](https://github.com/openziti/runzmd/compare/v1.0.3...v1.0.7) +* github.com/openziti/sdk-golang: [v0.16.146 -> v0.18.19](https://github.com/openziti/sdk-golang/compare/v0.16.146...v0.18.19) +* github.com/openziti/storage: [v0.1.26 -> v0.1.30](https://github.com/openziti/storage/compare/v0.1.26...v0.1.30) +* github.com/openziti/transport/v2: [v2.0.38 -> v2.0.48](https://github.com/openziti/transport/compare/v2.0.38...v2.0.48) +* github.com/openziti/metrics: [v1.1.5 -> v1.2.2](https://github.com/openziti/metrics/compare/v1.1.5...v1.2.2) +* github.com/openziti/ziti: [v0.26.11 -> v0.26.12](https://github.com/openziti/ziti/compare/v0.26.11...v0.26.12) + * [Issue #892](https://github.com/openziti/ziti/issues/892) - Add timeout to ziti agent controller snapshot-db command + * [Issue #917](https://github.com/openziti/ziti/issues/917) - ZITI_BIN_ROOT is incorrect in docker env + * [Issue #912](https://github.com/openziti/ziti/issues/912) - Binaries not updated in docker-compose env with new image + * [Issue #897](https://github.com/openziti/ziti/issues/897) - Add CLI options to manage /edge/v1/transit-routers + * [Issue #706](https://github.com/openziti/ziti/issues/706) - Add port check to quickstart + # Release 0.26.11 ## What's New From 44a2bdaa52e3908f3229f712f8d26dedf2b546af Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Mon, 12 Dec 2022 12:01:09 -0500 Subject: [PATCH 46/46] bump the version to 0.27 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 992221508..5a9e6bda2 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.26 +0.27