Documentation ¶
Index ¶
- func Canonicalize(p string) string
- func DecodeErrorResponse(body []byte) error
- func IsKeyNotFound(err error) bool
- func IsNotFound(err error) bool
- func IsSecretNotFound(err error) bool
- func NewKeyNotFoundError(path, key string) error
- func NewSecretNotFoundError(path string) error
- func ParsePath(path string) (secret, key string)
- func PathHasKey(path string) bool
- type CertOptions
- type RekeyOpts
- type RekeyResponse
- type RekeyUpdateOpts
- type Secret
- func (s *Secret) DHParam(length int, skipIfExists bool) error
- func (s *Secret) Delete(key string) bool
- func (s *Secret) Empty() bool
- func (s *Secret) Format(oldKey, newKey, fmtType string, skipIfExists bool) error
- func (s *Secret) Get(key string) string
- func (s *Secret) Has(key string) bool
- func (s *Secret) JSON() string
- func (s *Secret) Keys() []string
- func (s Secret) MarshalJSON() ([]byte, error)
- func (s *Secret) Password(key string, length int, policy string, skipIfExists bool) error
- func (s *Secret) RSAKey(bits int, skipIfExists bool) error
- func (s *Secret) SSHKey(bits int, skipIfExists bool) error
- func (s *Secret) Set(key, value string, skipIfExists bool) error
- func (s *Secret) SingleValue() (string, error)
- func (s *Secret) UnmarshalJSON(b []byte) error
- func (s Secret) X509(requireKey bool) (*X509, error)
- func (s *Secret) YAML() string
- type TreeOptions
- type Vault
- func (v *Vault) CheckPKIBackend(backend string) error
- func (v *Vault) Configure(path string, params map[string]string) error
- func (v *Vault) Copy(oldpath, newpath string, skipIfExists bool, quiet bool) error
- func (v *Vault) CreateSignedCertificate(backend, role, path string, params CertOptions, skipIfExists bool) error
- func (v *Vault) Curl(method string, path string, body []byte) (*http.Response, error)
- func (v *Vault) Delete(path string) error
- func (v *Vault) DeleteTree(root string) error
- func (v *Vault) FindSigningCA(cert *X509, certPath string, signPath string) (*X509, string, error)
- func (v *Vault) Init(nkeys, threshold int) ([]string, string, error)
- func (v *Vault) IsMounted(typ, path string) (bool, error)
- func (v *Vault) List(path string) (paths []string, err error)
- func (v *Vault) Mount(typ, path string, params map[string]interface{}) error
- func (v *Vault) Mounts(typ string) ([]string, error)
- func (v *Vault) Move(oldpath, newpath string, skipIfExists bool, quiet bool) error
- func (v *Vault) MoveCopyTree(oldRoot, newRoot string, f func(string, string, bool, bool) error, ...) error
- func (v *Vault) NewRootToken(keys []string) (string, error)
- func (v *Vault) ReKey(unsealKeyCount, numToUnseal int, pgpKeys []string) ([]string, error)
- func (v *Vault) Read(path string) (secret *Secret, err error)
- func (v *Vault) RenewLease() error
- func (v *Vault) RetrievePem(backend, path string) ([]byte, error)
- func (v *Vault) RevokeCertificate(backend, serial string) error
- func (v *Vault) SaveSealKeys(keys []string)
- func (v *Vault) Seal() (bool, error)
- func (v *Vault) SealKeys() (int, error)
- func (v *Vault) Strongbox() (map[string]string, error)
- func (v *Vault) Tree(path string, options TreeOptions) (tree.Node, error)
- func (v *Vault) Unseal(keys []string) error
- func (v *Vault) Write(path string, s *Secret) error
- type X509
- func (x X509) CheckStrength(bits ...int) error
- func (x X509) Expired() bool
- func (ca *X509) HasRevoked(cert *X509) bool
- func (x *X509) IntermediarySubject(n int) string
- func (x X509) IsCA() bool
- func (x *X509) Issuer() string
- func (x *X509) MakeCA(serial int64)
- func (ca *X509) Revoke(cert *X509)
- func (ca *X509) SaveTo(v *Vault, path string, skipIfExists bool) error
- func (x X509) Secret(skipIfExists bool) (*Secret, error)
- func (ca *X509) Sign(x *X509, ttl time.Duration) error
- func (x *X509) Subject() string
- func (x X509) ValidFor(names ...string) (bool, error)
- func (x X509) ValidForDomain(domain string) bool
- func (x X509) ValidForEmail(email string) bool
- func (x X509) ValidForIP(ip net.IP) bool
- func (x X509) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Canonicalize ¶ added in v0.4.1
func DecodeErrorResponse ¶ added in v0.0.22
func IsKeyNotFound ¶ added in v0.1.5
IsKeyNotFound returns true if the given error was created with NewKeyNotFoundError(). False otherwise.
func IsNotFound ¶ added in v0.0.26
IsNotFound returns true if the given error is a SecretNotFound error
or a KeyNotFound error. Returns false otherwise.
func IsSecretNotFound ¶ added in v0.1.5
IsSecretNotFound returns true if the given error was created with NewSecretNotFoundError(). False otherwise.
func NewKeyNotFoundError ¶ added in v0.0.26
NewKeyNotFoundError returns an error object describing the key that could not be located within the secret it was searched for in. Returning a KeyNotFound error should semantically mean that the secret it would've been contained in was located in the vault.
func NewSecretNotFoundError ¶ added in v0.0.26
NewSecretNotFoundError returns an error with a message descibing the path which could not be found in the secret backend.
func ParsePath ¶ added in v0.0.26
ParsePath splits the given path string into its respective secret path
and contained key parts
func PathHasKey ¶ added in v0.1.5
PathHasKey returns true if the given path has a key specified in its syntax. False otherwise.
Types ¶
type CertOptions ¶ added in v0.0.22
type RekeyResponse ¶ added in v0.3.0
type RekeyUpdateOpts ¶ added in v0.3.0
type Secret ¶
type Secret struct {
// contains filtered or unexported fields
}
A Secret contains a set of key/value pairs that store anything you want, including passwords, RSAKey keys, usernames, etc.
func (*Secret) Delete ¶ added in v0.1.5
Delete removes the entry with the given key from the Secret. Returns true if there was a matching object to delete. False otherwise.
func (*Secret) Empty ¶ added in v0.1.5
Empty returns true if there are no key-value pairs in this Secret object. False otherwise.
func (*Secret) JSON ¶
JSON converts a Secret to its JSON representation and returns it as a string. Returns an empty string if there were any errors.
func (Secret) MarshalJSON ¶ added in v0.0.3
func (*Secret) RSAKey ¶
RSAKey generates a new public/private keypair, and stores it in the secret, under the 'public' and 'private' keys.
func (*Secret) SSHKey ¶
SSHKey generates a new public/private keypair, and stores it in the secret, under the 'public' and 'private' keys.
func (*Secret) SingleValue ¶ added in v0.0.26
SingleValue converts a secret to a string representing the value extracted. Returns an error if there are not exactly one results in the secret object
func (*Secret) UnmarshalJSON ¶ added in v0.0.3
type TreeOptions ¶ added in v0.0.26
type TreeOptions struct { UseANSI bool /* Use ANSI colorizing sequences */ HideLeaves bool /* Hide leaf nodes of the tree (actual secrets) */ ShowKeys bool /* Include keys in the output */ InSubbranch bool /* If true, suppresses key output on branches */ StripSlashes bool /* If true, strip the trailing slashes from interior nodes */ }
type Vault ¶
A Vault represents a means for interacting with a remote Vault instance (unsealed and pre-authenticated) to read and write secrets.
func NewVault ¶
NewVault creates a new Vault object. If an empty token is specified, the current user's token is read from ~/.vault-token.
func (*Vault) CheckPKIBackend ¶ added in v0.1.3
func (*Vault) Copy ¶
Copy copies secrets from one path to another. With a secret:key specified: key -> key is good. key -> no-key is okay - we assume to keep old key name no-key -> key is bad. That makes no sense and the user should feel bad. Returns KeyNotFoundError if there is no such specified key in the secret at oldpath
func (*Vault) CreateSignedCertificate ¶ added in v0.0.22
func (v *Vault) CreateSignedCertificate(backend, role, path string, params CertOptions, skipIfExists bool) error
func (*Vault) DeleteTree ¶ added in v0.0.21
DeleteTree recursively deletes the leaf nodes beneath the given root until the root has no children, and then deletes that.
func (*Vault) FindSigningCA ¶ added in v0.8.0
func (*Vault) List ¶ added in v0.0.3
List returns the set of (relative) paths that are directly underneath the given path. Intermediate path nodes are suffixed with a single "/", whereas leaf nodes (the secrets themselves) are not.
func (*Vault) Move ¶
Move moves secrets from one path to another. A move is semantically a copy and then a deletion of the original item. For more information on the behavior of Move pertaining to keys, look at Copy.
func (*Vault) MoveCopyTree ¶ added in v0.0.21
func (v *Vault) MoveCopyTree(oldRoot, newRoot string, f func(string, string, bool, bool) error, skipIfExists bool, quiet bool) error
MoveCopyTree will recursively copy all nodes from the root to the new location. This function will get confused about 'secret:key' syntax, so don't let those get routed here - they don't make sense for a recursion anyway.
func (*Vault) NewRootToken ¶ added in v0.7.0
func (*Vault) Read ¶
Read checks the Vault for a Secret at the specified path, and returns it. If there is nothing at that path, a nil *Secret will be returned, with no error.
func (*Vault) RenewLease ¶ added in v0.6.0
func (*Vault) RetrievePem ¶ added in v0.0.22
func (*Vault) RevokeCertificate ¶ added in v0.0.22
func (*Vault) SaveSealKeys ¶ added in v0.8.1
type X509 ¶ added in v0.1.4
type X509 struct { Intermediaries []*x509.Certificate Certificate *x509.Certificate PrivateKey *rsa.PrivateKey Serial *big.Int CRL *pkix.CertificateList KeyUsage x509.KeyUsage ExtKeyUsage []x509.ExtKeyUsage }