command

package
v0.0.0-...-9d0dce2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2018 License: Apache-2.0, MPL-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultConfigPath is the default path to the configuration file
	DefaultConfigPath = "~/.vault"

	// ConfigPathEnv is the environment variable that can be used to
	// override where the Vault configuration is.
	ConfigPathEnv = "VAULT_CONFIG_PATH"
)

Variables

View Source
var Formatters = map[string]Formatter{
	"json":  JsonFormatter{},
	"table": TableFormatter{},
	"yaml":  YamlFormatter{},
	"yml":   YamlFormatter{},
}

Functions

func DefaultTokenHelper

func DefaultTokenHelper() (token.TokenHelper, error)

DefaultTokenHelper returns the token helper that is configured for Vault.

func MakeShutdownCh

func MakeShutdownCh() chan struct{}

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 MakeSighupCh

func MakeSighupCh() chan struct{}

MakeSighupCh returns a channel that can be used for SIGHUP reloading. This channel will send a message for every SIGHUP received.

func OutputList

func OutputList(ui cli.Ui, format string, secret *api.Secret) int

func OutputSecret

func OutputSecret(ui cli.Ui, format string, secret *api.Secret) int

func PrintRawField

func PrintRawField(ui cli.Ui, secret *api.Secret, field string) int

Types

type AuditDisableCommand

type AuditDisableCommand struct {
	meta.Meta
}

AuditDisableCommand is a Command that mounts a new mount.

func (*AuditDisableCommand) Help

func (c *AuditDisableCommand) Help() string

func (*AuditDisableCommand) Run

func (c *AuditDisableCommand) Run(args []string) int

func (*AuditDisableCommand) Synopsis

func (c *AuditDisableCommand) Synopsis() string

type AuditEnableCommand

type AuditEnableCommand struct {
	meta.Meta
	// contains filtered or unexported fields
}

AuditEnableCommand is a Command that mounts a new mount.

func (*AuditEnableCommand) Help

func (c *AuditEnableCommand) Help() string

func (*AuditEnableCommand) Run

func (c *AuditEnableCommand) Run(args []string) int

func (*AuditEnableCommand) Synopsis

func (c *AuditEnableCommand) Synopsis() string

type AuditListCommand

type AuditListCommand struct {
	meta.Meta
}

AuditListCommand is a Command that lists the enabled audits.

func (*AuditListCommand) Help

func (c *AuditListCommand) Help() string

func (*AuditListCommand) Run

func (c *AuditListCommand) Run(args []string) int

func (*AuditListCommand) Synopsis

func (c *AuditListCommand) Synopsis() string

type AuthCommand

type AuthCommand struct {
	meta.Meta

	Handlers map[string]AuthHandler
	// contains filtered or unexported fields
}

AuthCommand is a Command that handles authentication.

func (*AuthCommand) Help

func (c *AuthCommand) Help() string

func (*AuthCommand) Run

func (c *AuthCommand) Run(args []string) int

func (*AuthCommand) Synopsis

func (c *AuthCommand) Synopsis() string

type AuthDisableCommand

type AuthDisableCommand struct {
	meta.Meta
}

AuthDisableCommand is a Command that enables a new endpoint.

func (*AuthDisableCommand) Help

func (c *AuthDisableCommand) Help() string

func (*AuthDisableCommand) Run

func (c *AuthDisableCommand) Run(args []string) int

func (*AuthDisableCommand) Synopsis

func (c *AuthDisableCommand) Synopsis() string

type AuthEnableCommand

type AuthEnableCommand struct {
	meta.Meta
}

AuthEnableCommand is a Command that enables a new endpoint.

func (*AuthEnableCommand) Help

func (c *AuthEnableCommand) Help() string

func (*AuthEnableCommand) Run

func (c *AuthEnableCommand) Run(args []string) int

func (*AuthEnableCommand) Synopsis

func (c *AuthEnableCommand) Synopsis() string

type AuthHandler

type AuthHandler interface {
	Auth(*api.Client, map[string]string) (string, error)
	Help() string
}

AuthHandler is the interface that any auth handlers must implement to enable auth via the CLI.

type CapabilitiesCommand

type CapabilitiesCommand struct {
	meta.Meta
}

CapabilitiesCommand is a Command that enables a new endpoint.

func (*CapabilitiesCommand) Help

func (c *CapabilitiesCommand) Help() string

func (*CapabilitiesCommand) Run

func (c *CapabilitiesCommand) Run(args []string) int

func (*CapabilitiesCommand) Synopsis

func (c *CapabilitiesCommand) Synopsis() string

type DefaultConfig

type DefaultConfig struct {
	// TokenHelper is the executable/command that is executed for storing
	// and retrieving the authentication token for the Vault CLI. If this
	// is not specified, then vault's internal token store will be used, which
	// stores the token on disk unencrypted.
	TokenHelper string `hcl:"token_helper"`
}

Config is the CLI configuration for Vault that can be specified via a `$HOME/.vault` file which is HCL-formatted (therefore HCL or JSON).

func Config

func Config() (*DefaultConfig, error)

Config loads the configuration and returns it. If the configuration is already loaded, it is returned.

func LoadConfig

func LoadConfig(path string) (*DefaultConfig, error)

LoadConfig reads the configuration from the given path. If path is empty, then the default path will be used, or the environment variable if set.

func ParseConfig

func ParseConfig(contents string) (*DefaultConfig, error)

ParseConfig parses the given configuration as a string.

type DeleteCommand

type DeleteCommand struct {
	meta.Meta
}

DeleteCommand is a Command that puts data into the Vault.

func (*DeleteCommand) Help

func (c *DeleteCommand) Help() string

func (*DeleteCommand) Run

func (c *DeleteCommand) Run(args []string) int

func (*DeleteCommand) Synopsis

func (c *DeleteCommand) Synopsis() string

type Formatter

type Formatter interface {
	Output(ui cli.Ui, secret *api.Secret, data interface{}) error
}

type GenerateRootCommand

type GenerateRootCommand struct {
	meta.Meta

	// Key can be used to pre-seed the key. If it is set, it will not
	// be asked with the `password` helper.
	Key string

	// The nonce for the rekey request to send along
	Nonce string
}

GenerateRootCommand is a Command that generates a new root token.

func (*GenerateRootCommand) Help

func (c *GenerateRootCommand) Help() string

func (*GenerateRootCommand) Run

func (c *GenerateRootCommand) Run(args []string) int

func (*GenerateRootCommand) Synopsis

func (c *GenerateRootCommand) Synopsis() string

type InitCommand

type InitCommand struct {
	meta.Meta
}

InitCommand is a Command that initializes a new Vault server.

func (*InitCommand) Help

func (c *InitCommand) Help() string

func (*InitCommand) Run

func (c *InitCommand) Run(args []string) int

func (*InitCommand) Synopsis

func (c *InitCommand) Synopsis() string

type JsonFormatter

type JsonFormatter struct {
}

An output formatter for json output of an object

func (JsonFormatter) Output

func (j JsonFormatter) Output(ui cli.Ui, secret *api.Secret, data interface{}) error

type KeyStatusCommand

type KeyStatusCommand struct {
	meta.Meta
}

KeyStatusCommand is a Command that provides information about the key status

func (*KeyStatusCommand) Help

func (c *KeyStatusCommand) Help() string

func (*KeyStatusCommand) Run

func (c *KeyStatusCommand) Run(args []string) int

func (*KeyStatusCommand) Synopsis

func (c *KeyStatusCommand) Synopsis() string

type ListCommand

type ListCommand struct {
	meta.Meta
}

ListCommand is a Command that lists data from the Vault.

func (*ListCommand) Help

func (c *ListCommand) Help() string

func (*ListCommand) Run

func (c *ListCommand) Run(args []string) int

func (*ListCommand) Synopsis

func (c *ListCommand) Synopsis() string

type MountCommand

type MountCommand struct {
	meta.Meta
}

MountCommand is a Command that mounts a new mount.

func (*MountCommand) Help

func (c *MountCommand) Help() string

func (*MountCommand) Run

func (c *MountCommand) Run(args []string) int

func (*MountCommand) Synopsis

func (c *MountCommand) Synopsis() string

type MountTuneCommand

type MountTuneCommand struct {
	meta.Meta
}

MountTuneCommand is a Command that remounts a mounted secret backend to a new endpoint.

func (*MountTuneCommand) Help

func (c *MountTuneCommand) Help() string

func (*MountTuneCommand) Run

func (c *MountTuneCommand) Run(args []string) int

func (*MountTuneCommand) Synopsis

func (c *MountTuneCommand) Synopsis() string

type MountsCommand

type MountsCommand struct {
	meta.Meta
}

MountsCommand is a Command that lists the mounts.

func (*MountsCommand) Help

func (c *MountsCommand) Help() string

func (*MountsCommand) Run

func (c *MountsCommand) Run(args []string) int

func (*MountsCommand) Synopsis

func (c *MountsCommand) Synopsis() string

type PathHelpCommand

type PathHelpCommand struct {
	meta.Meta
}

PathHelpCommand is a Command that lists the mounts.

func (*PathHelpCommand) Help

func (c *PathHelpCommand) Help() string

func (*PathHelpCommand) Run

func (c *PathHelpCommand) Run(args []string) int

func (*PathHelpCommand) Synopsis

func (c *PathHelpCommand) Synopsis() string

type PolicyDeleteCommand

type PolicyDeleteCommand struct {
	meta.Meta
}

PolicyDeleteCommand is a Command that enables a new endpoint.

func (*PolicyDeleteCommand) Help

func (c *PolicyDeleteCommand) Help() string

func (*PolicyDeleteCommand) Run

func (c *PolicyDeleteCommand) Run(args []string) int

func (*PolicyDeleteCommand) Synopsis

func (c *PolicyDeleteCommand) Synopsis() string

type PolicyListCommand

type PolicyListCommand struct {
	meta.Meta
}

PolicyListCommand is a Command that enables a new endpoint.

func (*PolicyListCommand) Help

func (c *PolicyListCommand) Help() string

func (*PolicyListCommand) Run

func (c *PolicyListCommand) Run(args []string) int

func (*PolicyListCommand) Synopsis

func (c *PolicyListCommand) Synopsis() string

type PolicyWriteCommand

type PolicyWriteCommand struct {
	meta.Meta
}

PolicyWriteCommand is a Command that enables a new endpoint.

func (*PolicyWriteCommand) Help

func (c *PolicyWriteCommand) Help() string

func (*PolicyWriteCommand) Run

func (c *PolicyWriteCommand) Run(args []string) int

func (*PolicyWriteCommand) Synopsis

func (c *PolicyWriteCommand) Synopsis() string

type ReadCommand

type ReadCommand struct {
	meta.Meta
}

ReadCommand is a Command that reads data from the Vault.

func (*ReadCommand) Help

func (c *ReadCommand) Help() string

func (*ReadCommand) Run

func (c *ReadCommand) Run(args []string) int

func (*ReadCommand) Synopsis

func (c *ReadCommand) Synopsis() string

type RekeyCommand

type RekeyCommand struct {
	meta.Meta

	// Key can be used to pre-seed the key. If it is set, it will not
	// be asked with the `password` helper.
	Key string

	// The nonce for the rekey request to send along
	Nonce string

	// Whether to use the recovery key instead of barrier key, if available
	RecoveryKey bool
}

RekeyCommand is a Command that rekeys the vault.

func (*RekeyCommand) Help

func (c *RekeyCommand) Help() string

func (*RekeyCommand) Run

func (c *RekeyCommand) Run(args []string) int

func (*RekeyCommand) Synopsis

func (c *RekeyCommand) Synopsis() string

type RemountCommand

type RemountCommand struct {
	meta.Meta
}

RemountCommand is a Command that remounts a mounted secret backend to a new endpoint.

func (*RemountCommand) Help

func (c *RemountCommand) Help() string

func (*RemountCommand) Run

func (c *RemountCommand) Run(args []string) int

func (*RemountCommand) Synopsis

func (c *RemountCommand) Synopsis() string

type RenewCommand

type RenewCommand struct {
	meta.Meta
}

RenewCommand is a Command that mounts a new mount.

func (*RenewCommand) Help

func (c *RenewCommand) Help() string

func (*RenewCommand) Run

func (c *RenewCommand) Run(args []string) int

func (*RenewCommand) Synopsis

func (c *RenewCommand) Synopsis() string

type RevokeCommand

type RevokeCommand struct {
	meta.Meta
}

RevokeCommand is a Command that mounts a new mount.

func (*RevokeCommand) Help

func (c *RevokeCommand) Help() string

func (*RevokeCommand) Run

func (c *RevokeCommand) Run(args []string) int

func (*RevokeCommand) Synopsis

func (c *RevokeCommand) Synopsis() string

type RotateCommand

type RotateCommand struct {
	meta.Meta
}

RotateCommand is a Command that rotates the encryption key being used

func (*RotateCommand) Help

func (c *RotateCommand) Help() string

func (*RotateCommand) Run

func (c *RotateCommand) Run(args []string) int

func (*RotateCommand) Synopsis

func (c *RotateCommand) Synopsis() string

type SSHCommand

type SSHCommand struct {
	meta.Meta
}

SSHCommand is a Command that establishes a SSH connection with target by generating a dynamic key

func (*SSHCommand) Help

func (c *SSHCommand) Help() string

func (*SSHCommand) Run

func (c *SSHCommand) Run(args []string) int

func (*SSHCommand) Synopsis

func (c *SSHCommand) Synopsis() string

type SSHCredentialResp

type SSHCredentialResp struct {
	KeyType  string `mapstructure:"key_type"`
	Key      string `mapstructure:"key"`
	Username string `mapstructure:"username"`
	IP       string `mapstructure:"ip"`
	Port     string `mapstructure:"port"`
}

Structure to hold the fields returned when asked for a credential from SSHh backend.

type SealCommand

type SealCommand struct {
	meta.Meta
}

SealCommand is a Command that seals the vault.

func (*SealCommand) Help

func (c *SealCommand) Help() string

func (*SealCommand) Run

func (c *SealCommand) Run(args []string) int

func (*SealCommand) Synopsis

func (c *SealCommand) Synopsis() string

type ServerCommand

type ServerCommand struct {
	AuditBackends      map[string]audit.Factory
	CredentialBackends map[string]logical.Factory
	LogicalBackends    map[string]logical.Factory

	ShutdownCh chan struct{}
	SighupCh   chan struct{}

	WaitGroup *sync.WaitGroup

	meta.Meta
	// contains filtered or unexported fields
}

ServerCommand is a Command that starts the Vault server.

func (*ServerCommand) Help

func (c *ServerCommand) Help() string

func (*ServerCommand) Reload

func (c *ServerCommand) Reload(configPath []string) error

func (*ServerCommand) Run

func (c *ServerCommand) Run(args []string) int

func (*ServerCommand) Synopsis

func (c *ServerCommand) Synopsis() string

type StatusCommand

type StatusCommand struct {
	meta.Meta
}

StatusCommand is a Command that outputs the status of whether Vault is sealed or not as well as HA information.

func (*StatusCommand) Help

func (c *StatusCommand) Help() string

func (*StatusCommand) Run

func (c *StatusCommand) Run(args []string) int

func (*StatusCommand) Synopsis

func (c *StatusCommand) Synopsis() string

type StepDownCommand

type StepDownCommand struct {
	meta.Meta
}

StepDownCommand is a Command that seals the vault.

func (*StepDownCommand) Help

func (c *StepDownCommand) Help() string

func (*StepDownCommand) Run

func (c *StepDownCommand) Run(args []string) int

func (*StepDownCommand) Synopsis

func (c *StepDownCommand) Synopsis() string

type TableFormatter

type TableFormatter struct {
}

An output formatter for table output of an object

func (TableFormatter) Output

func (t TableFormatter) Output(ui cli.Ui, secret *api.Secret, data interface{}) error

func (TableFormatter) OutputList

func (t TableFormatter) OutputList(ui cli.Ui, secret *api.Secret, list []interface{}) error

func (TableFormatter) OutputSecret

func (t TableFormatter) OutputSecret(ui cli.Ui, secret, s *api.Secret) error

type TokenCreateCommand

type TokenCreateCommand struct {
	meta.Meta
}

TokenCreateCommand is a Command that mounts a new mount.

func (*TokenCreateCommand) Help

func (c *TokenCreateCommand) Help() string

func (*TokenCreateCommand) Run

func (c *TokenCreateCommand) Run(args []string) int

func (*TokenCreateCommand) Synopsis

func (c *TokenCreateCommand) Synopsis() string

type TokenLookupCommand

type TokenLookupCommand struct {
	meta.Meta
}

TokenLookupCommand is a Command that outputs details about the provided.

func (*TokenLookupCommand) Help

func (c *TokenLookupCommand) Help() string

func (*TokenLookupCommand) Run

func (c *TokenLookupCommand) Run(args []string) int

func (*TokenLookupCommand) Synopsis

func (c *TokenLookupCommand) Synopsis() string

type TokenRenewCommand

type TokenRenewCommand struct {
	meta.Meta
}

TokenRenewCommand is a Command that mounts a new mount.

func (*TokenRenewCommand) Help

func (c *TokenRenewCommand) Help() string

func (*TokenRenewCommand) Run

func (c *TokenRenewCommand) Run(args []string) int

func (*TokenRenewCommand) Synopsis

func (c *TokenRenewCommand) Synopsis() string

type TokenRevokeCommand

type TokenRevokeCommand struct {
	meta.Meta
}

TokenRevokeCommand is a Command that mounts a new mount.

func (*TokenRevokeCommand) Help

func (c *TokenRevokeCommand) Help() string

func (*TokenRevokeCommand) Run

func (c *TokenRevokeCommand) Run(args []string) int

func (*TokenRevokeCommand) Synopsis

func (c *TokenRevokeCommand) Synopsis() string

type UnmountCommand

type UnmountCommand struct {
	meta.Meta
}

UnmountCommand is a Command that mounts a new mount.

func (*UnmountCommand) Help

func (c *UnmountCommand) Help() string

func (*UnmountCommand) Run

func (c *UnmountCommand) Run(args []string) int

func (*UnmountCommand) Synopsis

func (c *UnmountCommand) Synopsis() string

type UnsealCommand

type UnsealCommand struct {
	meta.Meta

	// Key can be used to pre-seed the key. If it is set, it will not
	// be asked with the `password` helper.
	Key string
}

UnsealCommand is a Command that unseals the vault.

func (*UnsealCommand) Help

func (c *UnsealCommand) Help() string

func (*UnsealCommand) Run

func (c *UnsealCommand) Run(args []string) int

func (*UnsealCommand) Synopsis

func (c *UnsealCommand) Synopsis() string

type UnwrapCommand

type UnwrapCommand struct {
	meta.Meta
}

UnwrapCommand is a Command that behaves like ReadCommand but specifically for unwrapping cubbyhole-wrapped secrets

func (*UnwrapCommand) Help

func (c *UnwrapCommand) Help() string

func (*UnwrapCommand) Run

func (c *UnwrapCommand) Run(args []string) int

func (*UnwrapCommand) Synopsis

func (c *UnwrapCommand) Synopsis() string

type VersionCommand

type VersionCommand struct {
	VersionInfo *version.VersionInfo
	Ui          cli.Ui
}

VersionCommand is a Command implementation prints the version.

func (*VersionCommand) Help

func (c *VersionCommand) Help() string

func (*VersionCommand) Run

func (c *VersionCommand) Run(_ []string) int

func (*VersionCommand) Synopsis

func (c *VersionCommand) Synopsis() string

type WriteCommand

type WriteCommand struct {
	meta.Meta
	// contains filtered or unexported fields
}

WriteCommand is a Command that puts data into the Vault.

func (*WriteCommand) Help

func (c *WriteCommand) Help() string

func (*WriteCommand) Run

func (c *WriteCommand) Run(args []string) int

func (*WriteCommand) Synopsis

func (c *WriteCommand) Synopsis() string

type YamlFormatter

type YamlFormatter struct {
}

An output formatter for yaml output format of an object

func (YamlFormatter) Output

func (y YamlFormatter) Output(ui cli.Ui, secret *api.Secret, data interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL