2017-09-05 04:05:53 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
2017-09-08 02:05:54 +00:00
|
|
|
"fmt"
|
2017-09-05 04:05:53 +00:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
|
2018-05-25 18:37:41 +00:00
|
|
|
ad "github.com/hashicorp/vault-plugin-secrets-ad/plugin"
|
2018-03-22 03:07:16 +00:00
|
|
|
gcp "github.com/hashicorp/vault-plugin-secrets-gcp/plugin"
|
2018-03-22 02:56:52 +00:00
|
|
|
kv "github.com/hashicorp/vault-plugin-secrets-kv"
|
2017-09-05 04:05:53 +00:00
|
|
|
"github.com/hashicorp/vault/audit"
|
|
|
|
"github.com/hashicorp/vault/logical"
|
|
|
|
"github.com/hashicorp/vault/physical"
|
|
|
|
"github.com/hashicorp/vault/version"
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/aws"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/cassandra"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/consul"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/database"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/mongodb"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/mssql"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/mysql"
|
2018-01-28 19:38:19 +00:00
|
|
|
"github.com/hashicorp/vault/builtin/logical/nomad"
|
2017-09-05 04:05:53 +00:00
|
|
|
"github.com/hashicorp/vault/builtin/logical/pki"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/postgresql"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/rabbitmq"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/ssh"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/totp"
|
|
|
|
"github.com/hashicorp/vault/builtin/logical/transit"
|
|
|
|
"github.com/hashicorp/vault/builtin/plugin"
|
|
|
|
|
|
|
|
auditFile "github.com/hashicorp/vault/builtin/audit/file"
|
|
|
|
auditSocket "github.com/hashicorp/vault/builtin/audit/socket"
|
|
|
|
auditSyslog "github.com/hashicorp/vault/builtin/audit/syslog"
|
|
|
|
|
2018-03-21 21:35:31 +00:00
|
|
|
credAzure "github.com/hashicorp/vault-plugin-auth-azure/plugin"
|
2018-01-19 11:03:33 +00:00
|
|
|
credCentrify "github.com/hashicorp/vault-plugin-auth-centrify"
|
2018-01-19 10:56:34 +00:00
|
|
|
credGcp "github.com/hashicorp/vault-plugin-auth-gcp/plugin"
|
|
|
|
credKube "github.com/hashicorp/vault-plugin-auth-kubernetes"
|
2017-09-05 04:05:53 +00:00
|
|
|
credAppId "github.com/hashicorp/vault/builtin/credential/app-id"
|
|
|
|
credAppRole "github.com/hashicorp/vault/builtin/credential/approle"
|
|
|
|
credAws "github.com/hashicorp/vault/builtin/credential/aws"
|
|
|
|
credCert "github.com/hashicorp/vault/builtin/credential/cert"
|
|
|
|
credGitHub "github.com/hashicorp/vault/builtin/credential/github"
|
|
|
|
credLdap "github.com/hashicorp/vault/builtin/credential/ldap"
|
|
|
|
credOkta "github.com/hashicorp/vault/builtin/credential/okta"
|
|
|
|
credRadius "github.com/hashicorp/vault/builtin/credential/radius"
|
|
|
|
credToken "github.com/hashicorp/vault/builtin/credential/token"
|
|
|
|
credUserpass "github.com/hashicorp/vault/builtin/credential/userpass"
|
|
|
|
|
|
|
|
physAzure "github.com/hashicorp/vault/physical/azure"
|
|
|
|
physCassandra "github.com/hashicorp/vault/physical/cassandra"
|
|
|
|
physCockroachDB "github.com/hashicorp/vault/physical/cockroachdb"
|
|
|
|
physConsul "github.com/hashicorp/vault/physical/consul"
|
|
|
|
physCouchDB "github.com/hashicorp/vault/physical/couchdb"
|
|
|
|
physDynamoDB "github.com/hashicorp/vault/physical/dynamodb"
|
|
|
|
physEtcd "github.com/hashicorp/vault/physical/etcd"
|
|
|
|
physFile "github.com/hashicorp/vault/physical/file"
|
|
|
|
physGCS "github.com/hashicorp/vault/physical/gcs"
|
|
|
|
physInmem "github.com/hashicorp/vault/physical/inmem"
|
2018-02-12 23:22:41 +00:00
|
|
|
physManta "github.com/hashicorp/vault/physical/manta"
|
2017-09-05 04:05:53 +00:00
|
|
|
physMSSQL "github.com/hashicorp/vault/physical/mssql"
|
|
|
|
physMySQL "github.com/hashicorp/vault/physical/mysql"
|
|
|
|
physPostgreSQL "github.com/hashicorp/vault/physical/postgresql"
|
|
|
|
physS3 "github.com/hashicorp/vault/physical/s3"
|
2018-02-15 01:31:20 +00:00
|
|
|
physSpanner "github.com/hashicorp/vault/physical/spanner"
|
2017-09-05 04:05:53 +00:00
|
|
|
physSwift "github.com/hashicorp/vault/physical/swift"
|
|
|
|
physZooKeeper "github.com/hashicorp/vault/physical/zookeeper"
|
|
|
|
)
|
|
|
|
|
2018-02-12 23:12:16 +00:00
|
|
|
const (
|
|
|
|
// EnvVaultCLINoColor is an env var that toggles colored UI output.
|
|
|
|
EnvVaultCLINoColor = `VAULT_CLI_NO_COLOR`
|
|
|
|
// EnvVaultFormat is the output format
|
|
|
|
EnvVaultFormat = `VAULT_FORMAT`
|
2018-03-09 19:32:28 +00:00
|
|
|
|
|
|
|
// flagNameAuditNonHMACRequestKeys is the flag name used for auth/secrets enable
|
|
|
|
flagNameAuditNonHMACRequestKeys = "audit-non-hmac-request-keys"
|
|
|
|
// flagNameAuditNonHMACResponseKeys is the flag name used for auth/secrets enable
|
|
|
|
flagNameAuditNonHMACResponseKeys = "audit-non-hmac-response-keys"
|
2018-03-20 03:16:33 +00:00
|
|
|
// flagListingVisibility is the flag to toggle whether to show the mount in the UI-specific listing endpoint
|
|
|
|
flagNameListingVisibility = "listing-visibility"
|
2018-03-21 23:56:47 +00:00
|
|
|
// flagNamePassthroughRequestHeaders is the flag name used to set passthrough request headers to the backend
|
|
|
|
flagNamePassthroughRequestHeaders = "passthrough-request-headers"
|
2018-02-12 23:12:16 +00:00
|
|
|
)
|
|
|
|
|
2018-02-01 16:30:04 +00:00
|
|
|
var (
|
|
|
|
auditBackends = map[string]audit.Factory{
|
|
|
|
"file": auditFile.Factory,
|
|
|
|
"socket": auditSocket.Factory,
|
|
|
|
"syslog": auditSyslog.Factory,
|
|
|
|
}
|
|
|
|
|
|
|
|
credentialBackends = map[string]logical.Factory{
|
|
|
|
"app-id": credAppId.Factory,
|
|
|
|
"approle": credAppRole.Factory,
|
|
|
|
"aws": credAws.Factory,
|
2018-03-21 21:35:31 +00:00
|
|
|
"azure": credAzure.Factory,
|
2018-02-01 16:30:04 +00:00
|
|
|
"centrify": credCentrify.Factory,
|
|
|
|
"cert": credCert.Factory,
|
|
|
|
"gcp": credGcp.Factory,
|
|
|
|
"github": credGitHub.Factory,
|
|
|
|
"kubernetes": credKube.Factory,
|
|
|
|
"ldap": credLdap.Factory,
|
|
|
|
"okta": credOkta.Factory,
|
|
|
|
"plugin": plugin.Factory,
|
|
|
|
"radius": credRadius.Factory,
|
|
|
|
"userpass": credUserpass.Factory,
|
|
|
|
}
|
|
|
|
|
|
|
|
logicalBackends = map[string]logical.Factory{
|
2018-05-25 18:37:41 +00:00
|
|
|
"ad": ad.Factory,
|
2018-02-01 16:30:04 +00:00
|
|
|
"aws": aws.Factory,
|
|
|
|
"cassandra": cassandra.Factory,
|
|
|
|
"consul": consul.Factory,
|
|
|
|
"database": database.Factory,
|
2018-03-22 03:07:16 +00:00
|
|
|
"gcp": gcp.Factory,
|
2018-03-22 02:56:52 +00:00
|
|
|
"kv": kv.Factory,
|
2018-02-01 16:30:04 +00:00
|
|
|
"mongodb": mongodb.Factory,
|
|
|
|
"mssql": mssql.Factory,
|
|
|
|
"mysql": mysql.Factory,
|
|
|
|
"nomad": nomad.Factory,
|
|
|
|
"pki": pki.Factory,
|
|
|
|
"plugin": plugin.Factory,
|
|
|
|
"postgresql": postgresql.Factory,
|
|
|
|
"rabbitmq": rabbitmq.Factory,
|
|
|
|
"ssh": ssh.Factory,
|
|
|
|
"totp": totp.Factory,
|
|
|
|
"transit": transit.Factory,
|
|
|
|
}
|
|
|
|
|
|
|
|
physicalBackends = map[string]physical.Factory{
|
|
|
|
"azure": physAzure.NewAzureBackend,
|
|
|
|
"cassandra": physCassandra.NewCassandraBackend,
|
|
|
|
"cockroachdb": physCockroachDB.NewCockroachDBBackend,
|
|
|
|
"consul": physConsul.NewConsulBackend,
|
|
|
|
"couchdb_transactional": physCouchDB.NewTransactionalCouchDBBackend,
|
|
|
|
"couchdb": physCouchDB.NewCouchDBBackend,
|
|
|
|
"dynamodb": physDynamoDB.NewDynamoDBBackend,
|
|
|
|
"etcd": physEtcd.NewEtcdBackend,
|
|
|
|
"file_transactional": physFile.NewTransactionalFileBackend,
|
|
|
|
"file": physFile.NewFileBackend,
|
2018-03-30 16:36:37 +00:00
|
|
|
"gcs": physGCS.NewBackend,
|
2018-02-01 16:30:04 +00:00
|
|
|
"inmem_ha": physInmem.NewInmemHA,
|
|
|
|
"inmem_transactional_ha": physInmem.NewTransactionalInmemHA,
|
|
|
|
"inmem_transactional": physInmem.NewTransactionalInmem,
|
|
|
|
"inmem": physInmem.NewInmem,
|
2018-02-13 02:01:14 +00:00
|
|
|
"manta": physManta.NewMantaBackend,
|
2018-02-01 16:30:04 +00:00
|
|
|
"mssql": physMSSQL.NewMSSQLBackend,
|
|
|
|
"mysql": physMySQL.NewMySQLBackend,
|
|
|
|
"postgresql": physPostgreSQL.NewPostgreSQLBackend,
|
|
|
|
"s3": physS3.NewS3Backend,
|
2018-02-15 01:31:20 +00:00
|
|
|
"spanner": physSpanner.NewBackend,
|
2018-02-01 16:30:04 +00:00
|
|
|
"swift": physSwift.NewSwiftBackend,
|
|
|
|
"zookeeper": physZooKeeper.NewZooKeeperBackend,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2017-09-08 02:05:54 +00:00
|
|
|
// DeprecatedCommand is a command that wraps an existing command and prints a
|
|
|
|
// deprecation notice and points the user to the new command. Deprecated
|
|
|
|
// commands are always hidden from help output.
|
|
|
|
type DeprecatedCommand struct {
|
|
|
|
cli.Command
|
|
|
|
UI cli.Ui
|
|
|
|
|
|
|
|
// Old is the old command name, New is the new command name.
|
|
|
|
Old, New string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Help wraps the embedded Help command and prints a warning about deprecations.
|
|
|
|
func (c *DeprecatedCommand) Help() string {
|
|
|
|
c.warn()
|
|
|
|
return c.Command.Help()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run wraps the embedded Run command and prints a warning about deprecation.
|
|
|
|
func (c *DeprecatedCommand) Run(args []string) int {
|
2018-02-12 23:12:16 +00:00
|
|
|
if Format(c.UI) == "table" {
|
|
|
|
c.warn()
|
|
|
|
}
|
2017-09-08 02:05:54 +00:00
|
|
|
return c.Command.Run(args)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *DeprecatedCommand) warn() {
|
|
|
|
c.UI.Warn(wrapAtLength(fmt.Sprintf(
|
|
|
|
"WARNING! The \"vault %s\" command is deprecated. Please use \"vault %s\" "+
|
2018-01-18 00:31:52 +00:00
|
|
|
"instead. This command will be removed in Vault 0.11 (or later).",
|
2017-09-08 02:05:54 +00:00
|
|
|
c.Old,
|
|
|
|
c.New)))
|
|
|
|
c.UI.Warn("")
|
|
|
|
}
|
|
|
|
|
2017-09-05 04:05:53 +00:00
|
|
|
// Commands is the mapping of all the available commands.
|
|
|
|
var Commands map[string]cli.CommandFactory
|
2017-09-22 00:51:25 +00:00
|
|
|
var DeprecatedCommands map[string]cli.CommandFactory
|
2017-09-05 04:05:53 +00:00
|
|
|
|
2018-03-16 16:31:26 +00:00
|
|
|
func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
|
2017-09-08 02:05:54 +00:00
|
|
|
loginHandlers := map[string]LoginHandler{
|
2018-02-05 15:56:57 +00:00
|
|
|
"aws": &credAws.CLIHandler{},
|
|
|
|
"centrify": &credCentrify.CLIHandler{},
|
|
|
|
"cert": &credCert.CLIHandler{},
|
|
|
|
"github": &credGitHub.CLIHandler{},
|
|
|
|
"ldap": &credLdap.CLIHandler{},
|
|
|
|
"okta": &credOkta.CLIHandler{},
|
2017-09-05 04:05:53 +00:00
|
|
|
"radius": &credUserpass.CLIHandler{
|
|
|
|
DefaultMount: "radius",
|
|
|
|
},
|
|
|
|
"token": &credToken.CLIHandler{},
|
|
|
|
"userpass": &credUserpass.CLIHandler{
|
|
|
|
DefaultMount: "userpass",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-05-23 13:56:47 +00:00
|
|
|
getBaseCommand := func() *BaseCommand {
|
|
|
|
return &BaseCommand{
|
|
|
|
UI: ui,
|
|
|
|
tokenHelper: runOpts.TokenHelper,
|
|
|
|
flagAddress: runOpts.Address,
|
2018-05-23 20:45:17 +00:00
|
|
|
client: runOpts.Client,
|
2018-05-23 13:56:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-05 04:05:53 +00:00
|
|
|
Commands = map[string]cli.CommandFactory{
|
2017-09-08 02:05:54 +00:00
|
|
|
"audit": func() (cli.Command, error) {
|
|
|
|
return &AuditCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"audit disable": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuditDisableCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"audit enable": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuditEnableCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"audit list": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuditListCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"auth tune": func() (cli.Command, error) {
|
|
|
|
return &AuthTuneCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-05 04:05:53 +00:00
|
|
|
"auth": func() (cli.Command, error) {
|
|
|
|
return &AuthCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
|
|
|
Handlers: loginHandlers,
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"auth disable": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuthDisableCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"auth enable": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuthEnableCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"auth help": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuthHelpCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
|
|
|
Handlers: loginHandlers,
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"auth list": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &AuthListCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"delete": func() (cli.Command, error) {
|
|
|
|
return &DeleteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"lease": func() (cli.Command, error) {
|
|
|
|
return &LeaseCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"lease renew": func() (cli.Command, error) {
|
|
|
|
return &LeaseRenewCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"lease revoke": func() (cli.Command, error) {
|
|
|
|
return &LeaseRevokeCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"list": func() (cli.Command, error) {
|
|
|
|
return &ListCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"login": func() (cli.Command, error) {
|
|
|
|
return &LoginCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
|
|
|
Handlers: loginHandlers,
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"operator": func() (cli.Command, error) {
|
|
|
|
return &OperatorCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"operator generate-root": func() (cli.Command, error) {
|
|
|
|
return &OperatorGenerateRootCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"operator init": func() (cli.Command, error) {
|
|
|
|
return &OperatorInitCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"operator key-status": func() (cli.Command, error) {
|
|
|
|
return &OperatorKeyStatusCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"operator rekey": func() (cli.Command, error) {
|
|
|
|
return &OperatorRekeyCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"operator rotate": func() (cli.Command, error) {
|
|
|
|
return &OperatorRotateCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"operator seal": func() (cli.Command, error) {
|
|
|
|
return &OperatorSealCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"operator step-down": func() (cli.Command, error) {
|
|
|
|
return &OperatorStepDownCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"operator unseal": func() (cli.Command, error) {
|
|
|
|
return &OperatorUnsealCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"path-help": func() (cli.Command, error) {
|
|
|
|
return &PathHelpCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"policy": func() (cli.Command, error) {
|
|
|
|
return &PolicyCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"policy delete": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &PolicyDeleteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"policy fmt": func() (cli.Command, error) {
|
|
|
|
return &PolicyFmtCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"policy list": func() (cli.Command, error) {
|
|
|
|
return &PolicyListCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"policy read": func() (cli.Command, error) {
|
|
|
|
return &PolicyReadCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"policy write": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &PolicyWriteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"read": func() (cli.Command, error) {
|
|
|
|
return &ReadCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"secrets": func() (cli.Command, error) {
|
|
|
|
return &SecretsCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"secrets disable": func() (cli.Command, error) {
|
|
|
|
return &SecretsDisableCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"secrets enable": func() (cli.Command, error) {
|
|
|
|
return &SecretsEnableCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"secrets list": func() (cli.Command, error) {
|
|
|
|
return &SecretsListCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"secrets move": func() (cli.Command, error) {
|
|
|
|
return &SecretsMoveCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"secrets tune": func() (cli.Command, error) {
|
|
|
|
return &SecretsTuneCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"server": func() (cli.Command, error) {
|
|
|
|
return &ServerCommand{
|
|
|
|
BaseCommand: &BaseCommand{
|
2018-03-16 15:31:00 +00:00
|
|
|
UI: serverCmdUi,
|
2018-03-16 16:31:26 +00:00
|
|
|
tokenHelper: runOpts.TokenHelper,
|
2018-03-16 17:14:32 +00:00
|
|
|
flagAddress: runOpts.Address,
|
2017-09-05 04:05:53 +00:00
|
|
|
},
|
2018-02-01 16:30:04 +00:00
|
|
|
AuditBackends: auditBackends,
|
|
|
|
CredentialBackends: credentialBackends,
|
|
|
|
LogicalBackends: logicalBackends,
|
|
|
|
PhysicalBackends: physicalBackends,
|
|
|
|
ShutdownCh: MakeShutdownCh(),
|
|
|
|
SighupCh: MakeSighupCh(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"ssh": func() (cli.Command, error) {
|
|
|
|
return &SSHCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"status": func() (cli.Command, error) {
|
|
|
|
return &StatusCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"token": func() (cli.Command, error) {
|
|
|
|
return &TokenCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"token create": func() (cli.Command, error) {
|
2017-09-05 04:05:53 +00:00
|
|
|
return &TokenCreateCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"token capabilities": func() (cli.Command, error) {
|
|
|
|
return &TokenCapabilitiesCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"token lookup": func() (cli.Command, error) {
|
|
|
|
return &TokenLookupCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"token renew": func() (cli.Command, error) {
|
|
|
|
return &TokenRenewCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
"token revoke": func() (cli.Command, error) {
|
|
|
|
return &TokenRevokeCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"unwrap": func() (cli.Command, error) {
|
|
|
|
return &UnwrapCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"version": func() (cli.Command, error) {
|
|
|
|
return &VersionCommand{
|
|
|
|
VersionInfo: version.GetVersion(),
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"write": func() (cli.Command, error) {
|
|
|
|
return &WriteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-05 04:05:53 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2018-03-21 22:02:41 +00:00
|
|
|
"kv": func() (cli.Command, error) {
|
|
|
|
return &KVCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv put": func() (cli.Command, error) {
|
|
|
|
return &KVPutCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2018-04-23 22:00:02 +00:00
|
|
|
"kv patch": func() (cli.Command, error) {
|
|
|
|
return &KVPatchCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-04-23 22:00:02 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2018-03-21 22:02:41 +00:00
|
|
|
"kv get": func() (cli.Command, error) {
|
|
|
|
return &KVGetCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv delete": func() (cli.Command, error) {
|
|
|
|
return &KVDeleteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv list": func() (cli.Command, error) {
|
|
|
|
return &KVListCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv destroy": func() (cli.Command, error) {
|
|
|
|
return &KVDestroyCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv undelete": func() (cli.Command, error) {
|
|
|
|
return &KVUndeleteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv enable-versioning": func() (cli.Command, error) {
|
|
|
|
return &KVEnableVersioningCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv metadata": func() (cli.Command, error) {
|
|
|
|
return &KVMetadataCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv metadata put": func() (cli.Command, error) {
|
|
|
|
return &KVMetadataPutCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv metadata get": func() (cli.Command, error) {
|
|
|
|
return &KVMetadataGetCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"kv metadata delete": func() (cli.Command, error) {
|
|
|
|
return &KVMetadataDeleteCommand{
|
2018-05-23 13:56:47 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2018-03-21 22:02:41 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-05 04:05:53 +00:00
|
|
|
}
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
// Deprecated commands
|
|
|
|
//
|
2018-02-12 23:12:16 +00:00
|
|
|
// TODO: Remove not before 0.11.0
|
2017-09-22 00:51:25 +00:00
|
|
|
DeprecatedCommands = map[string]cli.CommandFactory{
|
|
|
|
"audit-disable": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "audit-disable",
|
|
|
|
New: "audit disable",
|
2018-05-23 16:34:48 +00:00
|
|
|
UI: ui,
|
2017-09-22 00:51:25 +00:00
|
|
|
Command: &AuditDisableCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-22 00:51:25 +00:00
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"audit-enable": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "audit-enable",
|
|
|
|
New: "audit enable",
|
|
|
|
UI: ui,
|
|
|
|
Command: &AuditEnableCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-22 00:51:25 +00:00
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"audit-list": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "audit-list",
|
|
|
|
New: "audit list",
|
|
|
|
UI: ui,
|
|
|
|
Command: &AuditListCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"auth-disable": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "auth-disable",
|
|
|
|
New: "auth disable",
|
|
|
|
UI: ui,
|
|
|
|
Command: &AuthDisableCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"auth-enable": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "auth-enable",
|
|
|
|
New: "auth enable",
|
|
|
|
UI: ui,
|
|
|
|
Command: &AuthEnableCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"capabilities": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "capabilities",
|
|
|
|
New: "token capabilities",
|
|
|
|
UI: ui,
|
|
|
|
Command: &TokenCapabilitiesCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"generate-root": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "generate-root",
|
|
|
|
New: "operator generate-root",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorGenerateRootCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"init": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "init",
|
|
|
|
New: "operator init",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorInitCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"key-status": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "key-status",
|
|
|
|
New: "operator key-status",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorKeyStatusCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"renew": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "renew",
|
|
|
|
New: "lease renew",
|
|
|
|
UI: ui,
|
|
|
|
Command: &LeaseRenewCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"revoke": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "revoke",
|
|
|
|
New: "lease revoke",
|
|
|
|
UI: ui,
|
|
|
|
Command: &LeaseRevokeCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"mount": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "mount",
|
|
|
|
New: "secrets enable",
|
|
|
|
UI: ui,
|
|
|
|
Command: &SecretsEnableCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"mount-tune": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "mount-tune",
|
|
|
|
New: "secrets tune",
|
|
|
|
UI: ui,
|
|
|
|
Command: &SecretsTuneCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"mounts": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "mounts",
|
|
|
|
New: "secrets list",
|
|
|
|
UI: ui,
|
|
|
|
Command: &SecretsListCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"policies": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "policies",
|
|
|
|
New: "policy read\" or \"vault policy list", // lol
|
|
|
|
UI: ui,
|
|
|
|
Command: &PoliciesDeprecatedCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"policy-delete": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "policy-delete",
|
|
|
|
New: "policy delete",
|
|
|
|
UI: ui,
|
|
|
|
Command: &PolicyDeleteCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"policy-write": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "policy-write",
|
|
|
|
New: "policy write",
|
|
|
|
UI: ui,
|
|
|
|
Command: &PolicyWriteCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"rekey": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "rekey",
|
|
|
|
New: "operator rekey",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorRekeyCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"remount": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "remount",
|
|
|
|
New: "secrets move",
|
|
|
|
UI: ui,
|
|
|
|
Command: &SecretsMoveCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"rotate": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "rotate",
|
|
|
|
New: "operator rotate",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorRotateCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"seal": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "seal",
|
|
|
|
New: "operator seal",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorSealCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"step-down": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "step-down",
|
|
|
|
New: "operator step-down",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorStepDownCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"token-create": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "token-create",
|
|
|
|
New: "token create",
|
|
|
|
UI: ui,
|
|
|
|
Command: &TokenCreateCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"token-lookup": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "token-lookup",
|
|
|
|
New: "token lookup",
|
|
|
|
UI: ui,
|
|
|
|
Command: &TokenLookupCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"token-renew": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "token-renew",
|
|
|
|
New: "token renew",
|
|
|
|
UI: ui,
|
|
|
|
Command: &TokenRenewCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"token-revoke": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "token-revoke",
|
|
|
|
New: "token revoke",
|
|
|
|
UI: ui,
|
|
|
|
Command: &TokenRevokeCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"unmount": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "unmount",
|
|
|
|
New: "secrets disable",
|
|
|
|
UI: ui,
|
|
|
|
Command: &SecretsDisableCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
"unseal": func() (cli.Command, error) {
|
|
|
|
return &DeprecatedCommand{
|
|
|
|
Old: "unseal",
|
|
|
|
New: "operator unseal",
|
|
|
|
UI: ui,
|
|
|
|
Command: &OperatorUnsealCommand{
|
2018-05-23 16:34:48 +00:00
|
|
|
BaseCommand: getBaseCommand(),
|
2017-09-08 02:05:54 +00:00
|
|
|
},
|
2017-09-22 00:51:25 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2017-09-08 02:05:54 +00:00
|
|
|
}
|
|
|
|
|
2017-09-22 00:51:25 +00:00
|
|
|
// Add deprecated commands back to the main commands so they parse.
|
|
|
|
for k, v := range DeprecatedCommands {
|
|
|
|
if _, ok := Commands[k]; ok {
|
|
|
|
// Can't deprecate an existing command...
|
|
|
|
panic(fmt.Sprintf("command %q defined as deprecated and not at the same time!", k))
|
|
|
|
}
|
|
|
|
Commands[k] = v
|
2017-09-08 02:05:54 +00:00
|
|
|
}
|
2017-09-05 04:05:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MakeShutdownCh returns a channel that can be used for shutdown
|
|
|
|
// notifications for commands. This channel will send a message for every
|
|
|
|
// SIGINT or SIGTERM received.
|
|
|
|
func MakeShutdownCh() chan struct{} {
|
|
|
|
resultCh := make(chan struct{})
|
|
|
|
|
|
|
|
shutdownCh := make(chan os.Signal, 4)
|
|
|
|
signal.Notify(shutdownCh, os.Interrupt, syscall.SIGTERM)
|
|
|
|
go func() {
|
|
|
|
<-shutdownCh
|
|
|
|
close(resultCh)
|
|
|
|
}()
|
|
|
|
return resultCh
|
|
|
|
}
|
|
|
|
|
|
|
|
// MakeSighupCh returns a channel that can be used for SIGHUP
|
|
|
|
// reloading. This channel will send a message for every
|
|
|
|
// SIGHUP received.
|
|
|
|
func MakeSighupCh() chan struct{} {
|
|
|
|
resultCh := make(chan struct{})
|
|
|
|
|
|
|
|
signalCh := make(chan os.Signal, 4)
|
|
|
|
signal.Notify(signalCh, syscall.SIGHUP)
|
|
|
|
go func() {
|
|
|
|
for {
|
|
|
|
<-signalCh
|
|
|
|
resultCh <- struct{}{}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
return resultCh
|
|
|
|
}
|