The name. The name. The name!

This commit is contained in:
Jeff Mitchell committed 2020-08-10 17:15:02 -04:00
1 parent 1c836c430b
commit 6661117d4c
321 files changed
+1295 -1300

No files matched your search

+18 -18
View File
@@ -16,8 +16,8 @@ import (
"sync"
"syscall"
"github.com/hashicorp/watchtower/api"
"github.com/hashicorp/watchtower/api/authtokens"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authtokens"
"github.com/mitchellh/cli"
"github.com/pkg/errors"
"github.com/posener/complete"
@@ -31,7 +31,7 @@ const (
// NotSetValue is a flag value for a not-set value
NotSetValue = "(not set)"
envTokenName = "WATCHTOWER_TOKEN_NAME"
envTokenName = "BOUNDARY_TOKEN_NAME"
)
// reRemoveWhitespace is a regular expression for stripping whitespace from
@@ -159,7 +159,7 @@ func (c *Command) Client() (*api.Client, error) {
}
// Turn off retries on the CLI
if os.Getenv(api.EnvWatchtowerMaxRetries) == "" {
if os.Getenv(api.EnvBoundaryMaxRetries) == "" {
c.client.SetMaxRetries(0)
}
@@ -169,7 +169,7 @@ func (c *Command) Client() (*api.Client, error) {
tokenName = c.FlagTokenName
}
if tokenName != "none" {
token, err := keyring.Get("HashiCorp Watchtower Auth Token", tokenName)
token, err := keyring.Get("HashiCorp Boundary Auth Token", tokenName)
if err != nil {
if err == keyring.ErrNotFound {
c.UI.Info("No saved credential found, continuing without")
@@ -235,16 +235,16 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: FlagNameAddr,
Target: &c.flagAddr,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerAddr,
EnvVar: api.EnvBoundaryAddr,
Completion: complete.PredictAnything,
Usage: "Addr of the Watchtower controller, as a complete URL (e.g. https://watchtower.example.com:9200).",
Usage: "Addr of the Boundary controller, as a complete URL (e.g. https://boundary.example.com:9200).",
})
f.StringVar(&StringVar{
Name: FlagNameScope,
Target: &c.flagScope,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerScopeId,
EnvVar: api.EnvBoundaryScopeId,
Completion: complete.PredictAnything,
Usage: `Scope in which to make the request. If not specified, will default to the scope of a saved token (if found), otherwise will default to "global".`,
})
@@ -253,7 +253,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: FlagNameCACert,
Target: &c.flagTLSCACert,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerCACert,
EnvVar: api.EnvBoundaryCACert,
Completion: complete.PredictFiles("*"),
Usage: "Path on the local disk to a single PEM-encoded CA " +
"certificate to verify the Controller or Worker's server's SSL certificate. This " +
@@ -264,7 +264,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: FlagNameCAPath,
Target: &c.flagTLSCAPath,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerCAPath,
EnvVar: api.EnvBoundaryCAPath,
Completion: complete.PredictDirs("*"),
Usage: "Path on the local disk to a directory of PEM-encoded CA " +
"certificates to verify the SSL certificate of the Controller.",
@@ -274,10 +274,10 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: FlagNameClientCert,
Target: &c.flagTLSClientCert,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerClientCert,
EnvVar: api.EnvBoundaryClientCert,
Completion: complete.PredictFiles("*"),
Usage: "Path on the local disk to a single PEM-encoded CA " +
"certificate to use for TLS authentication to the Watchtower Controller. If " +
"certificate to use for TLS authentication to the Boundary Controller. If " +
"this flag is specified, -client-key is also required.",
})
@@ -285,7 +285,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: FlagNameClientKey,
Target: &c.flagTLSClientKey,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerClientKey,
EnvVar: api.EnvBoundaryClientKey,
Completion: complete.PredictFiles("*"),
Usage: "Path on the local disk to a single PEM-encoded private key " +
"matching the client certificate from -client-cert.",
@@ -295,19 +295,19 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: FlagTLSServerName,
Target: &c.flagTLSServerName,
Default: NotSetValue,
EnvVar: api.EnvWatchtowerTLSServerName,
EnvVar: api.EnvBoundaryTLSServerName,
Completion: complete.PredictAnything,
Usage: "Name to use as the SNI host when connecting to the Watchtower " +
Usage: "Name to use as the SNI host when connecting to the Boundary " +
"server via TLS.",
})
f.BoolVar(&BoolVar{
Name: FlagNameTLSInsecure,
Target: &c.flagTLSInsecure,
EnvVar: api.EnvWatchtowerTLSInsecure,
EnvVar: api.EnvBoundaryTLSInsecure,
Usage: "Disable verification of TLS certificates. Using this option " +
"is highly discouraged as it decreases the security of data " +
"transmissions to and from the Watchtower server.",
"transmissions to and from the Boundary server.",
})
}
@@ -350,7 +350,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
Name: "format",
Target: &c.flagFormat,
Default: "table",
EnvVar: EnvWatchtowerCLIFormat,
EnvVar: EnvBoundaryCLIFormat,
Completion: complete.PredictSet("table", "json", "yaml"),
Usage: "Print the output in the given format. Valid formats " +
"are \"table\", \"json\", or \"yaml\".",
+3 -3
View File
@@ -2,7 +2,7 @@ package base
const (
// FlagNameAddr is the flag used in the base command to read in the
// address of the Watchtower server.
// address of the Boundary server.
FlagNameAddr = "addr"
// FlagNameScope is the flag used in the base command to read in the scope
// in which to make a request.
@@ -28,6 +28,6 @@ const (
)
const (
EnvWatchtowerCLINoColor = `WATCHTOWER_CLI_NO_COLOR`
EnvWatchtowerCLIFormat = `WATCHTOWER_CLI_FORMAT`
EnvBoundaryCLINoColor = `BOUNDARY_CLI_NO_COLOR`
EnvBoundaryCLIFormat = `BOUNDARY_CLI_FORMAT`
)
+2 -2
View File
@@ -398,11 +398,11 @@ var Formatters = map[string]Formatter{
func Format(ui cli.Ui) string {
switch t := ui.(type) {
case *WatchtowerUI:
case *BoundaryUI:
return t.Format
}
format := os.Getenv(EnvWatchtowerCLIFormat)
format := os.Getenv(EnvBoundaryCLIFormat)
if format == "" {
format = "table"
}
+1 -1
View File
@@ -96,7 +96,7 @@ func tcpListenerFactory(l *configutil.Listener, logger hclog.Logger, ui cli.Ui)
"addr": l.Address,
}
if _, ok := os.LookupEnv("WATCHTOWER_LOG_CONNECTION_MUXING"); !ok {
if _, ok := os.LookupEnv("BOUNDARY_LOG_CONNECTION_MUXING"); !ok {
logger = nil
}
alpnMux := alpnmux.New(ln, logger)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
)
func StartMemProfiler(logger hclog.Logger) {
profileDir := filepath.Join(os.TempDir(), "watchtowerprof")
profileDir := filepath.Join(os.TempDir(), "boundaryprof")
if err := os.MkdirAll(profileDir, 0700); err != nil {
logger.Debug("could not create profile directory", "error", err)
return
+11 -11
View File
@@ -14,6 +14,11 @@ import (
"sync"
"github.com/armon/go-metrics"
"github.com/hashicorp/boundary/globals"
"github.com/hashicorp/boundary/internal/auth/password"
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/iam"
"github.com/hashicorp/boundary/version"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/go-hclog"
wrapping "github.com/hashicorp/go-kms-wrapping"
@@ -25,11 +30,6 @@ import (
"github.com/hashicorp/vault/sdk/helper/logging"
"github.com/hashicorp/vault/sdk/helper/mlock"
"github.com/hashicorp/vault/sdk/logical"
"github.com/hashicorp/watchtower/globals"
"github.com/hashicorp/watchtower/internal/auth/password"
"github.com/hashicorp/watchtower/internal/db"
"github.com/hashicorp/watchtower/internal/iam"
"github.com/hashicorp/watchtower/version"
"github.com/jinzhu/gorm"
"github.com/mitchellh/cli"
"google.golang.org/grpc/grpclog"
@@ -107,7 +107,7 @@ func (b *Server) SetupLogging(flagLogLevel, flagLogFormat, configLogLevel, confi
namedGRPCLogFaker := b.Logger.Named("grpclogfaker")
grpclog.SetLogger(&GRPCLogFaker{
Logger: namedGRPCLogFaker,
Log: os.Getenv("WATCHTOWER_GRPC_LOGGING") != "",
Log: os.Getenv("BOUNDARY_GRPC_LOGGING") != "",
})
b.Info["log level"] = logLevel.String()
@@ -181,9 +181,9 @@ func (b *Server) SetupMetrics(ui cli.Ui, telemetry *configutil.Telemetry) error
b.InmemSink, _, b.PrometheusEnabled, err = configutil.SetupTelemetry(&configutil.SetupTelemetryOpts{
Config: telemetry,
Ui: ui,
ServiceName: "watchtower",
DisplayName: "Watchtower",
UserAgent: "watchtower",
ServiceName: "boundary",
DisplayName: "Boundary",
UserAgent: "boundary",
})
if err != nil {
return fmt.Errorf("Error initializing telemetry: %w", err)
@@ -209,7 +209,7 @@ func (b *Server) PrintInfo(ui cli.Ui, mode string) {
// Server configuration output
padding := 24
sort.Strings(b.InfoKeys)
ui.Output(fmt.Sprintf("==> Watchtower %s configuration:\n", mode))
ui.Output(fmt.Sprintf("==> Boundary %s configuration:\n", mode))
for _, k := range b.InfoKeys {
ui.Output(fmt.Sprintf(
"%s%s: %s",
@@ -221,7 +221,7 @@ func (b *Server) PrintInfo(ui cli.Ui, mode string) {
// Output the header that the server has started
if !b.CombineLogs {
ui.Output(fmt.Sprintf("==> Watchtower %s started! Log data will stream in below:\n", mode))
ui.Output(fmt.Sprintf("==> Boundary %s started! Log data will stream in below:\n", mode))
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"golang.org/x/crypto/ssh/terminal"
)
type WatchtowerUI struct {
type BoundaryUI struct {
cli.Ui
Format string
}
+9 -9
View File
@@ -5,15 +5,15 @@ import (
"os/signal"
"syscall"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/watchtower/internal/cmd/commands/authenticate"
"github.com/hashicorp/watchtower/internal/cmd/commands/config"
"github.com/hashicorp/watchtower/internal/cmd/commands/controller"
"github.com/hashicorp/watchtower/internal/cmd/commands/dev"
"github.com/hashicorp/watchtower/internal/cmd/commands/hosts"
"github.com/hashicorp/watchtower/internal/cmd/commands/roles"
"github.com/hashicorp/watchtower/internal/cmd/commands/scopes"
"github.com/hashicorp/watchtower/internal/cmd/commands/worker"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/commands/authenticate"
"github.com/hashicorp/boundary/internal/cmd/commands/config"
"github.com/hashicorp/boundary/internal/cmd/commands/controller"
"github.com/hashicorp/boundary/internal/cmd/commands/dev"
"github.com/hashicorp/boundary/internal/cmd/commands/hosts"
"github.com/hashicorp/boundary/internal/cmd/commands/roles"
"github.com/hashicorp/boundary/internal/cmd/commands/scopes"
"github.com/hashicorp/boundary/internal/cmd/commands/worker"
"github.com/mitchellh/cli"
)
@@ -1,7 +1,7 @@
package authenticate
import (
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/mitchellh/cli"
"github.com/mitchellh/go-wordwrap"
)
@@ -13,18 +13,18 @@ type Command struct {
}
func (c *Command) Synopsis() string {
return wordwrap.WrapString("Authenticate the Watchtower commandline client", base.TermWidth)
return wordwrap.WrapString("Authenticate the Boundary commandline client", base.TermWidth)
}
func (c *Command) Help() string {
return base.WrapForHelpText([]string{
"Usage: watchtower authenticate [sub command] [options] [args]",
"Usage: boundary authenticate [sub command] [options] [args]",
"",
" This command authenticates the Watchtower commandline client using a specified auth method. Examples:",
" This command authenticates the Boundary commandline client using a specified auth method. Examples:",
"",
" Authenticate with password auth method:",
"",
" $ watchtower authenticate password -name foo -password bar",
" $ boundary authenticate password -name foo -password bar",
"",
" Please see the auth method subcommand help for detailed usage information.",
})
+11 -11
View File
@@ -8,9 +8,9 @@ import (
"strings"
"time"
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/vault/sdk/helper/password"
"github.com/hashicorp/watchtower/api/authmethods"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/mitchellh/go-wordwrap"
@@ -21,9 +21,9 @@ import (
var _ cli.Command = (*PasswordCommand)(nil)
var _ cli.CommandAutocomplete = (*PasswordCommand)(nil)
var envPassword = "WATCHTOWER_AUTHENTICATE_PASSWORD"
var envName = "WATCHTOWER_AUTHENTICATE_NAME"
var envMethodId = "WATCHTOWER_AUTHENTICATE_METHOD_ID"
var envPassword = "BOUNDARY_AUTHENTICATE_PASSWORD"
var envName = "BOUNDARY_AUTHENTICATE_NAME"
var envMethodId = "BOUNDARY_AUTHENTICATE_METHOD_ID"
type PasswordCommand struct {
*base.Command
@@ -34,20 +34,20 @@ type PasswordCommand struct {
}
func (c *PasswordCommand) Synopsis() string {
return wordwrap.WrapString("Invoke the password auth method to authenticate with Watchtower", base.TermWidth)
return wordwrap.WrapString("Invoke the password auth method to authenticate with Boundary", base.TermWidth)
}
func (c *PasswordCommand) Help() string {
return base.WrapForHelpText([]string{
"Usage: watchtower authenticate password [options] [args]",
"Usage: boundary authenticate password [options] [args]",
"",
" Invoke the password auth method to authenticate the Watchtower CLI:",
" Invoke the password auth method to authenticate the Boundary CLI:",
"",
" $ watchtower authenticate password -name=foo -password=bar",
" $ boundary authenticate password -name=foo -password=bar",
"",
" If more than one instance of the password auth method exists, use the -method-id flag:",
"",
` $ watchtower authenticate password -method-id am_12345 -name foo -password "bar"`,
` $ boundary authenticate password -method-id am_12345 -name foo -password "bar"`,
}) + c.Flags().Help()
}
@@ -156,7 +156,7 @@ func (c *PasswordCommand) Run(args []string) int {
c.UI.Error(fmt.Sprintf("Error marshaling auth token to save to system credential store: %s", err))
return 1
}
if err := keyring.Set("HashiCorp Watchtower Auth Token", tokenName, base64.RawStdEncoding.EncodeToString(marshaled)); err != nil {
if err := keyring.Set("HashiCorp Boundary Auth Token", tokenName, base64.RawStdEncoding.EncodeToString(marshaled)); err != nil {
c.UI.Error(fmt.Sprintf("Error saving auth token to system credential store: %s", err))
return 1
}
+6 -6
View File
@@ -3,7 +3,7 @@ package config
import (
"strings"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/mitchellh/cli"
)
@@ -14,23 +14,23 @@ type Command struct {
}
func (c *Command) Synopsis() string {
return "Manage sensitive values in Watchtower's configuration files"
return "Manage sensitive values in Boundary's configuration files"
}
func (c *Command) Help() string {
helpText := `
Usage: watchtower config <subcommand> [options] [args]
Usage: boundary config <subcommand> [options] [args]
This command groups subcommands for operators interacting with Watchtower's
This command groups subcommands for operators interacting with Boundary's
config files. Here are a few examples of config commands:
Encrypt sensitive values in a config file:
$ watchtower config encrypt config.hcl
$ boundary config encrypt config.hcl
Decrypt sensitive values in a config file:
$ watchtower config decrypt config.hcl
$ boundary config decrypt config.hcl
Please see the individual subcommand help for detailed usage information.`
@@ -6,9 +6,9 @@ import (
"os"
"strings"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/vault/internalshared/configutil"
"github.com/hashicorp/vault/sdk/helper/strutil"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
@@ -38,9 +38,9 @@ func (c *EncryptDecryptCommand) Help() string {
subCmd = "Encrypt"
}
helpText := `
Usage: watchtower config %s [options] [args]
Usage: boundary config %s [options] [args]
%s sensitive values in a Watchtower's configuration file. These values must be marked
%s sensitive values in a Boundary's configuration file. These values must be marked
with {{%s()}} as appropriate. This can only be used with string parameters, and
the markers must be inside the quote marks delimiting the string; as an example:
@@ -49,7 +49,7 @@ Usage: watchtower config %s [options] [args]
By default this will print the new configuration out. To overwrite into the same
file use the -overwrite flag.
$ watchtower config %s -overwrite config.hcl
$ boundary config %s -overwrite config.hcl
`
helpText = fmt.Sprintf(helpText, strings.ToLower(subCmd), subCmd, strings.ToLower(subCmd), strings.ToLower(subCmd))
@@ -9,7 +9,7 @@ import (
"strings"
"testing"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/mitchellh/cli"
"github.com/stretchr/testify/assert"
)
+16 -16
View File
@@ -6,16 +6,16 @@ import (
"strings"
"sync"
"github.com/hashicorp/boundary/globals"
"github.com/hashicorp/boundary/internal/auth/password"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/config"
"github.com/hashicorp/boundary/internal/servers/controller"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/vault/internalshared/configutil"
"github.com/hashicorp/vault/sdk/helper/mlock"
"github.com/hashicorp/vault/sdk/helper/strutil"
"github.com/hashicorp/watchtower/globals"
"github.com/hashicorp/watchtower/internal/auth/password"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/watchtower/internal/cmd/config"
"github.com/hashicorp/watchtower/internal/servers/controller"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
@@ -55,16 +55,16 @@ type Command struct {
}
func (c *Command) Synopsis() string {
return "Start a Watchtower controller"
return "Start a Boundary controller"
}
func (c *Command) Help() string {
helpText := `
Usage: watchtower controller [options]
Usage: boundary controller [options]
Start a controller with a configuration file:
$ watchtower controller -config=/etc/watchtower/controller.hcl
$ boundary controller -config=/etc/boundary/controller.hcl
For a full list of examples, please see the documentation.
@@ -91,7 +91,7 @@ func (c *Command) Flags() *base.FlagSets {
Name: "log-level",
Target: &c.flagLogLevel,
Default: base.NotSetValue,
EnvVar: "WATCHTOWER_LOG_LEVEL",
EnvVar: "BOUNDARY_LOG_LEVEL",
Completion: complete.PredictSet("trace", "debug", "info", "warn", "err"),
Usage: "Log verbosity level. Supported values (in order of more detail to less) are " +
"\"trace\", \"debug\", \"info\", \"warn\", and \"err\".",
@@ -149,14 +149,14 @@ func (c *Command) Flags() *base.FlagSets {
f.StringVar(&base.StringVar{
Name: "dev-api-listen-address",
Target: &c.flagDevControllerAPIListenAddr,
EnvVar: "WATCHTOWER_DEV_CONTROLLER_API_LISTEN_ADDRESS",
EnvVar: "BOUNDARY_DEV_CONTROLLER_API_LISTEN_ADDRESS",
Usage: "Address to bind the controller to in \"dev\" mode for \"api\" purpose.",
})
f.StringVar(&base.StringVar{
Name: "dev-cluster-listen-address",
Target: &c.flagDevControllerClusterListenAddr,
EnvVar: "WATCHTOWER_DEV_CONTROLLER_CLUSTER_LISTEN_ADDRESS",
EnvVar: "BOUNDARY_DEV_CONTROLLER_CLUSTER_LISTEN_ADDRESS",
Usage: "Address to bind the controller to in \"dev\" mode for \"cluster\" purpose.",
})
@@ -216,14 +216,14 @@ func (c *Command) Run(args []string) int {
}
// If mlockall(2) isn't supported, show a warning. We disable this in dev
// because it is quite scary to see when first using Watchtower. We also disable
// because it is quite scary to see when first using Boundary. We also disable
// this if the user has explicitly disabled mlock in configuration.
if !c.flagDev && !c.Config.DisableMlock && !mlock.Supported() {
c.UI.Warn(base.WrapAtLength(
"WARNING! mlock is not supported on this system! An mlockall(2)-like " +
"syscall to prevent memory from being swapped to disk is not " +
"supported on this system. For better security, only run Watchtower on " +
"systems where this call is supported. If you are running Watchtower" +
"supported on this system. For better security, only run Boundary on " +
"systems where this call is supported. If you are running Boundary" +
"in a Docker container, provide the IPC_LOCK cap to the container."))
}
@@ -452,7 +452,7 @@ func (c *Command) WaitForInterrupt() int {
for !shutdownTriggered {
select {
case <-shutdownCh:
c.UI.Output("==> Watchtower controller shutdown triggered")
c.UI.Output("==> Boundary controller shutdown triggered")
if err := c.controller.Shutdown(); err != nil {
c.UI.Error(fmt.Errorf("Error with controller shutdown: %w", err).Error())
@@ -461,7 +461,7 @@ func (c *Command) WaitForInterrupt() int {
shutdownTriggered = true
case <-c.SighupCh:
c.UI.Output("==> Watchtower controller reload triggered")
c.UI.Output("==> Boundary controller reload triggered")
// Check for new log level
var level hclog.Level
@@ -2,7 +2,7 @@
package controller
import "github.com/hashicorp/watchtower/internal/cmd/base"
import "github.com/hashicorp/boundary/internal/cmd/base"
func init() {
devOnlyControllerFlags = addDevOnlyControllerFlags
@@ -12,7 +12,7 @@ func addDevOnlyControllerFlags(c *Command, f *base.FlagSet) {
f.StringVar(&base.StringVar{
Name: "dev-passthrough-directory",
Target: &c.flagDevPassthroughDirectory,
EnvVar: "WATCHTOWER_DEV_PASSTHROUGH_DIRECTORY",
EnvVar: "BOUNDARY_DEV_PASSTHROUGH_DIRECTORY",
Usage: "Enables a passthrough directory in the webserver at /",
})
}
+13 -13
View File
@@ -6,11 +6,11 @@ import (
"strings"
"sync"
"github.com/hashicorp/watchtower/internal/auth/password"
"github.com/hashicorp/watchtower/internal/cmd/base"
controllercmd "github.com/hashicorp/watchtower/internal/cmd/commands/controller"
workercmd "github.com/hashicorp/watchtower/internal/cmd/commands/worker"
"github.com/hashicorp/watchtower/internal/cmd/config"
"github.com/hashicorp/boundary/internal/auth/password"
"github.com/hashicorp/boundary/internal/cmd/base"
controllercmd "github.com/hashicorp/boundary/internal/cmd/commands/controller"
workercmd "github.com/hashicorp/boundary/internal/cmd/commands/worker"
"github.com/hashicorp/boundary/internal/cmd/config"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
@@ -45,16 +45,16 @@ type Command struct {
}
func (c *Command) Synopsis() string {
return "Start a Watchtower dev environment"
return "Start a Boundary dev environment"
}
func (c *Command) Help() string {
helpText := `
Usage: watchtower dev [options]
Usage: boundary dev [options]
Start a dev environment:
$ watchtower dev
$ boundary dev
For a full list of examples, please see the documentation.
@@ -71,7 +71,7 @@ func (c *Command) Flags() *base.FlagSets {
Name: "log-level",
Target: &c.flagLogLevel,
Default: base.NotSetValue,
EnvVar: "WATCHTOWER_LOG_LEVEL",
EnvVar: "BOUNDARY_LOG_LEVEL",
Completion: complete.PredictSet("trace", "debug", "info", "warn", "err"),
Usage: "Log verbosity level. Supported values (in order of more detail to less) are " +
"\"trace\", \"debug\", \"info\", \"warn\", and \"err\".",
@@ -122,14 +122,14 @@ func (c *Command) Flags() *base.FlagSets {
f.StringVar(&base.StringVar{
Name: "dev-api-listen-address",
Target: &c.flagDevControllerAPIListenAddr,
EnvVar: "WATCHTOWER_DEV_CONTROLLER_API_LISTEN_ADDRESS",
EnvVar: "BOUNDARY_DEV_CONTROLLER_API_LISTEN_ADDRESS",
Usage: "Address to bind to for controller \"api\" purpose.",
})
f.StringVar(&base.StringVar{
Name: "dev-cluster-listen-address",
Target: &c.flagDevControllerClusterListenAddr,
EnvVar: "WATCHTOWER_DEV_CONTROLLER_CLUSTER_LISTEN_ADDRESS",
EnvVar: "BOUNDARY_DEV_CONTROLLER_CLUSTER_LISTEN_ADDRESS",
Usage: "Address to bind to for controller \"cluster\" purpose.",
})
@@ -321,7 +321,7 @@ func (c *Command) Run(args []string) int {
for !shutdownTriggered {
select {
case <-c.ShutdownCh:
c.UI.Output("==> Watchtower dev environment shutdown triggered")
c.UI.Output("==> Boundary dev environment shutdown triggered")
childShutdownCh <- struct{}{}
childShutdownCh <- struct{}{}
@@ -329,7 +329,7 @@ func (c *Command) Run(args []string) int {
shutdownTriggered = true
case <-c.SighupCh:
c.UI.Output("==> Watchtower dev environment reload triggered")
c.UI.Output("==> Boundary dev environment reload triggered")
for _, v := range c.childSighupCh {
v <- struct{}{}
}
+2 -2
View File
@@ -2,7 +2,7 @@
package dev
import "github.com/hashicorp/watchtower/internal/cmd/base"
import "github.com/hashicorp/boundary/internal/cmd/base"
func init() {
devOnlyControllerFlags = addDevOnlyControllerFlags
@@ -12,7 +12,7 @@ func addDevOnlyControllerFlags(c *Command, f *base.FlagSet) {
f.StringVar(&base.StringVar{
Name: "dev-passthrough-directory",
Target: &c.flagDevPassthroughDirectory,
EnvVar: "WATCHTOWER_DEV_PASSTHROUGH_DIRECTORY",
EnvVar: "BOUNDARY_DEV_PASSTHROUGH_DIRECTORY",
Usage: "Enables a passthrough directory in the webserver at /",
})
}
+4 -4
View File
@@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"github.com/hashicorp/watchtower/api/hosts"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/api/hosts"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -29,14 +29,14 @@ func (c *CreateCommand) Synopsis() string {
func (c *CreateCommand) Help() string {
helpText := `
Usage: watchtower hosts create
Usage: boundary hosts create
Creates a host in the given host catalog. This command will result in an
error for any catalog that does not support manual host creation.
Example:
$ watchtower hosts create -catalog-id=<id> -address=<addr> -name=<name>
$ boundary hosts create -catalog-id=<id> -address=<addr> -name=<name>
` + c.Flags().Help()
+25 -25
View File
@@ -6,16 +6,16 @@ import (
"strings"
"time"
"github.com/hashicorp/watchtower/api/roles"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/api/roles"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/mitchellh/go-wordwrap"
)
func synopsisFunc(inFunc string) string {
if inFunc == "" {
return wordwrap.WrapString("Manage Watchtower roles", base.TermWidth)
return wordwrap.WrapString("Manage Boundary roles", base.TermWidth)
}
return wordwrap.WrapString(fmt.Sprintf("%s a role within Watchtower", textproto.CanonicalMIMEHeaderKey(inFunc)), base.TermWidth)
return wordwrap.WrapString(fmt.Sprintf("%s a role within Boundary", textproto.CanonicalMIMEHeaderKey(inFunc)), base.TermWidth)
}
func principalsGrantsSynopsisFunc(inFunc string, principals bool) string {
@@ -32,22 +32,22 @@ func principalsGrantsSynopsisFunc(inFunc string, principals bool) string {
case strings.HasPrefix(inFunc, "remove"):
in = fmt.Sprintf("Remove %s from", switchStr)
}
return wordwrap.WrapString(fmt.Sprintf("%s a role within Watchtower", in), base.TermWidth)
return wordwrap.WrapString(fmt.Sprintf("%s a role within Boundary", in), base.TermWidth)
}
func baseHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles [sub command] [options] [args]",
"Usage: boundary roles [sub command] [options] [args]",
"",
" This command allows operations on Watchtower roles. Examples:",
" This command allows operations on Boundary roles. Examples:",
"",
" Create a role:",
"",
` $ watchtower roles create -name foo -description "For ProdOps usage"`,
` $ boundary roles create -name foo -description "For ProdOps usage"`,
"",
" Add a grant to a role:",
"",
` $ watchtower roles add-grants -id r_1234567890 -grant "type=host-catalog;actions=create,delete"`,
` $ boundary roles add-grants -id r_1234567890 -grant "type=host-catalog;actions=create,delete"`,
"",
" Please see the role subcommand help for detailed usage information.",
})
@@ -55,11 +55,11 @@ func baseHelp() string {
func createHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles create [options] [args]",
"Usage: boundary roles create [options] [args]",
"",
" Create a role. Example:",
"",
` $ watchtower roles create -name ops -description "Role for ops grants"`,
` $ boundary roles create -name ops -description "Role for ops grants"`,
"",
"",
})
@@ -67,71 +67,71 @@ func createHelp() string {
func updateHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles update [options] [args]",
"Usage: boundary roles update [options] [args]",
"",
" Update a role given its ID. Example:",
"",
` $ watchtower roles update -id r_1234567890 -description "Development host grants"`,
` $ boundary roles update -id r_1234567890 -description "Development host grants"`,
})
}
func readHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles read [options] [args]",
"Usage: boundary roles read [options] [args]",
"",
" Read a role given its ID. Example:",
"",
` $ watchtower roles read -id r_1234567890`,
` $ boundary roles read -id r_1234567890`,
})
}
func deleteHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles delete [options] [args]",
"Usage: boundary roles delete [options] [args]",
"",
" Delete a role given its ID. Example:",
"",
` $ watchtower roles delete -id r_1234567890`,
` $ boundary roles delete -id r_1234567890`,
})
}
func listHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles list [options] [args]",
"Usage: boundary roles list [options] [args]",
"",
" List roles within a scope. Example:",
"",
` $ watchtower roles list -org o_1234567890`,
` $ boundary roles list -org o_1234567890`,
})
}
func addPrincipalsHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles add-principals [options] [args]",
"Usage: boundary roles add-principals [options] [args]",
"",
` Adds principals (users, groups) to a role given its ID. The "user" and "group" flags can be specified multiple times. Example:`,
"",
` $ watchtower roles add-principals -id r_1234567890 -user u_1234567890`,
` $ boundary roles add-principals -id r_1234567890 -user u_1234567890`,
})
}
func setPrincipalsHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles set-principals [options] [args]",
"Usage: boundary roles set-principals [options] [args]",
"",
` Sets the complete set of principals (users, groups) on a role given its ID. The "user" and "group" flags can be specified multiple times. Example:`,
"",
` $ watchtower roles set-principals -id r_1234567890 -user u_anon -group sg_1234567890`,
` $ boundary roles set-principals -id r_1234567890 -user u_anon -group sg_1234567890`,
})
}
func removePrincipalsHelp() string {
return base.WrapForHelpText([]string{
"Usage: watchtower roles remove-principals [options] [args]",
"Usage: boundary roles remove-principals [options] [args]",
"",
` Removes principals (users, groups) from a role given its ID. The "user" and "group" flags can be specified multiple times. Example:`,
"",
` $ watchtower roles remove-principals -id r_1234567890 -group sg_1234567890`,
` $ boundary roles remove-principals -id r_1234567890 -group sg_1234567890`,
})
}
+5 -5
View File
@@ -3,11 +3,11 @@ package roles
import (
"fmt"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/roles"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/perms"
"github.com/hashicorp/vault/sdk/helper/strutil"
"github.com/hashicorp/watchtower/api"
"github.com/hashicorp/watchtower/api/roles"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/watchtower/internal/perms"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -39,7 +39,7 @@ func (c *Command) Synopsis() string {
case "add-grants", "set-grants", "remove-grants":
return principalsGrantsSynopsisFunc(c.Func, false)
}
return "Manage Watchtower roles"
return "Manage Boundary roles"
}
var helpMap = map[string]func() string{
+4 -4
View File
@@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"github.com/hashicorp/watchtower/api/scopes"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -27,14 +27,14 @@ func (c *CreateScopeCommand) Synopsis() string {
func (c *CreateScopeCommand) Help() string {
helpText := `
Usage: watchtower scopes create
Usage: boundary scopes create
Creates a new scope within the scope specified by the ID from the
"scope" parameter or the associated environment variable.
Example:
$ watchtower scopes create -scope=<scope_id> -name=<name>
$ boundary scopes create -scope=<scope_id> -name=<name>
` + c.Flags().Help()
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"fmt"
"time"
"github.com/hashicorp/watchtower/api/scopes"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/internal/cmd/base"
)
func printScope(in *scopes.Scope) string {
+4 -4
View File
@@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"github.com/hashicorp/watchtower/api/scopes"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -26,13 +26,13 @@ func (c *ReadScopeCommand) Synopsis() string {
func (c *ReadScopeCommand) Help() string {
helpText := `
Usage: watchtower scopes read
Usage: boundary scopes read
Returns information about a scope specified by the ID. The request will take place within the scope of the caller's authentication token.
Example:
$ watchtower scopes read -id=<scope_id>
$ boundary scopes read -id=<scope_id>
` + c.Flags().Help()
+13 -13
View File
@@ -6,13 +6,13 @@ import (
"strings"
"sync"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/config"
"github.com/hashicorp/boundary/internal/servers/worker"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/vault/internalshared/configutil"
"github.com/hashicorp/vault/sdk/helper/mlock"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/watchtower/internal/cmd/config"
"github.com/hashicorp/watchtower/internal/servers/worker"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
@@ -44,16 +44,16 @@ type Command struct {
}
func (c *Command) Synopsis() string {
return "Start a Watchtower worker"
return "Start a Boundary worker"
}
func (c *Command) Help() string {
helpText := `
Usage: watchtower worker [options]
Usage: boundary worker [options]
Start a worker with a configuration file:
$ watchtower worker -config=/etc/watchtower/worker.hcl
$ boundary worker -config=/etc/boundary/worker.hcl
For a full list of examples, please see the documentation.
@@ -80,7 +80,7 @@ func (c *Command) Flags() *base.FlagSets {
Name: "log-level",
Target: &c.flagLogLevel,
Default: base.NotSetValue,
EnvVar: "WATCHTOWER_LOG_LEVEL",
EnvVar: "BOUNDARY_LOG_LEVEL",
Completion: complete.PredictSet("trace", "debug", "info", "warn", "err"),
Usage: "Log verbosity level. Supported values (in order of more detail to less) are " +
"\"trace\", \"debug\", \"info\", \"warn\", and \"err\".",
@@ -106,7 +106,7 @@ func (c *Command) Flags() *base.FlagSets {
f.StringVar(&base.StringVar{
Name: "dev-listen-address",
Target: &c.flagDevWorkerListenAddr,
EnvVar: "WATCHTOWER_DEV_WORKER_LISTEN_ADDRESS",
EnvVar: "BOUNDARY_DEV_WORKER_LISTEN_ADDRESS",
Usage: "Address to bind the worker to in \"dev\" mode.",
})
@@ -157,14 +157,14 @@ func (c *Command) Run(args []string) int {
}
// If mlockall(2) isn't supported, show a warning. We disable this in dev
// because it is quite scary to see when first using Watchtower. We also disable
// because it is quite scary to see when first using Boundary. We also disable
// this if the user has explicitly disabled mlock in configuration.
if !c.flagDev && !c.Config.DisableMlock && !mlock.Supported() {
c.UI.Warn(base.WrapAtLength(
"WARNING! mlock is not supported on this system! An mlockall(2)-like " +
"syscall to prevent memory from being swapped to disk is not " +
"supported on this system. For better security, only run Watchtower on " +
"systems where this call is supported. If you are running Watchtower" +
"supported on this system. For better security, only run Boundary on " +
"systems where this call is supported. If you are running Boundary" +
"in a Docker container, provide the IPC_LOCK cap to the container."))
}
@@ -287,7 +287,7 @@ func (c *Command) WaitForInterrupt() int {
for !shutdownTriggered {
select {
case <-shutdownCh:
c.UI.Output("==> Watchtower worker shutdown triggered")
c.UI.Output("==> Boundary worker shutdown triggered")
if err := c.worker.Shutdown(); err != nil {
c.UI.Error(fmt.Errorf("Error with worker shutdown: %w", err).Error())
@@ -296,7 +296,7 @@ func (c *Command) WaitForInterrupt() int {
shutdownTriggered = true
case <-c.SighupCh:
c.UI.Output("==> Watchtower worker reload triggered")
c.UI.Output("==> Boundary worker reload triggered")
// Check for new log level
var level hclog.Level
+3 -3
View File
@@ -69,7 +69,7 @@ worker {
`
)
// Config is the configuration for the watchtower controller
// Config is the configuration for the boundary controller
type Config struct {
*configutil.SharedConfig `hcl:"-"`
@@ -85,7 +85,7 @@ type Worker struct {
Controllers []string `hcl:"controllers"`
}
// DevWorker is a Config that is used for dev mode of Watchtower
// DevWorker is a Config that is used for dev mode of Boundary
// workers
func DevWorker() (*Config, error) {
parsed, err := Parse(devConfig + devWorkerExtraConfig)
@@ -112,7 +112,7 @@ func devKeyGeneration() (string, string) {
return controllerKey, workerAuthKey
}
// DevController is a Config that is used for dev mode of Watchtower
// DevController is a Config that is used for dev mode of Boundary
// controllers
func DevController() (*Config, error) {
controllerKey, workerAuthKey := devKeyGeneration()
+11 -11
View File
@@ -12,8 +12,8 @@ import (
"text/tabwriter"
"github.com/fatih/color"
"github.com/hashicorp/watchtower/api"
"github.com/hashicorp/watchtower/internal/cmd/base"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/internal/cmd/base"
colorable "github.com/mattn/go-colorable"
"github.com/mitchellh/cli"
)
@@ -57,10 +57,10 @@ func setupEnv(args []string) (retArgs []string, format string, outputCurlString
}
}
envWatchtowerCLIFormat := os.Getenv(base.EnvWatchtowerCLIFormat)
envBoundaryCLIFormat := os.Getenv(base.EnvBoundaryCLIFormat)
// If we did not parse a value, fetch the env var
if format == "" && envWatchtowerCLIFormat != "" {
format = envWatchtowerCLIFormat
if format == "" && envBoundaryCLIFormat != "" {
format = envBoundaryCLIFormat
}
// Lowercase for consistency
format = strings.ToLower(format)
@@ -94,7 +94,7 @@ func RunCustom(args []string, runOpts *RunOptions) int {
// Don't use color if disabled
useColor := true
if os.Getenv(base.EnvWatchtowerCLINoColor) != "" || color.NoColor {
if os.Getenv(base.EnvBoundaryCLINoColor) != "" || color.NoColor {
useColor = false
}
@@ -123,7 +123,7 @@ func RunCustom(args []string, runOpts *RunOptions) int {
uiErrWriter = ioutil.Discard
}
ui := &base.WatchtowerUI{
ui := &base.BoundaryUI{
Ui: &cli.ColoredUi{
ErrorColor: cli.UiColorRed,
WarnColor: cli.UiColorYellow,
@@ -136,7 +136,7 @@ func RunCustom(args []string, runOpts *RunOptions) int {
Format: format,
}
serverCmdUi := &base.WatchtowerUI{
serverCmdUi := &base.BoundaryUI{
Ui: &cli.ColoredUi{
ErrorColor: cli.UiColorRed,
WarnColor: cli.UiColorYellow,
@@ -158,11 +158,11 @@ func RunCustom(args []string, runOpts *RunOptions) int {
hiddenCommands := []string{"version"}
cli := &cli.CLI{
Name: "watchtower",
Name: "boundary",
Args: args,
Commands: Commands,
HelpFunc: groupedHelpFunc(
cli.BasicHelpFunc("watchtower"),
cli.BasicHelpFunc("boundary"),
),
HelpWriter: runOpts.Stderr,
HiddenCommands: hiddenCommands,
@@ -206,7 +206,7 @@ func groupedHelpFunc(f cli.HelpFunc) cli.HelpFunc {
var b bytes.Buffer
tw := tabwriter.NewWriter(&b, 0, 2, 6, ' ', 0)
fmt.Fprintf(tw, "Usage: watchtower <command> [args]\n\n")
fmt.Fprintf(tw, "Usage: boundary <command> [args]\n\n")
fmt.Fprintf(tw, "Common commands:\n")
for _, v := range commonCommands {
printCommand(tw, v, commands[v])