vault

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrefixToVKVPath

func AddPrefixToVKVPath(p, mountPath, apiPrefix string) string

AddPrefixToVKVPath in v2 di/bluh will become di/data/bluh and an optional version param in the url

func AssemblePath

func AssemblePath(path string, client *vaultApi.Client) (string, error)

func IsRootPath

func IsRootPath(basePath string) bool

func IsStorage

func IsStorage(pType string) bool

func KvPreflightVersionRequest

func KvPreflightVersionRequest(client *vaultApi.Client, path string) (string, int, error)

KvPreflightVersionRequest taken from vault/command/kv_helpers.go check if the path given is kv v2 or v1

func PathToWebURL

func PathToWebURL(vaultAddr, path string) string

Vault path to Web url ${mount}/database/user -> https://${vaulrAddr}/ui/vault/secrets/${mount}/show/database/user

func SecretToListOfStr

func SecretToListOfStr(s *vaultApi.Secret) ([]string, error)

Types

type Authenticator

type Authenticator interface {
	Auth() (*vaultApi.Client, error)
	GetVaultAddr() string
}

func NewLdapAuth

func NewLdapAuth(username, password, vaultAddr string) Authenticator

type Client

type Client[A Authenticator] interface {
	Read(secretPath, optionalSecretVersion string) (map[string]interface{}, error)
	ListMounts() (map[string]*vaultApi.MountOutput, error)
	ListTree(basePath string) ([]*Node, error)
	ListTreeFiltered(basePath string) ([]*Node, error)
	GetVaultAddr() string
}

func NewClient

func NewClient[A Authenticator](a A) Client[Authenticator]

type LdapAuthenticator

type LdapAuthenticator struct {
	// contains filtered or unexported fields
}

func (*LdapAuthenticator) Auth

func (la *LdapAuthenticator) Auth() (*vaultApi.Client, error)

func (*LdapAuthenticator) GetVaultAddr

func (la *LdapAuthenticator) GetVaultAddr() string

type Node

type Node struct {
	T           NodeType
	KeyValue    string
	BaseKeyPath string
}

func NewNode

func NewNode(n, base string) *Node

func (*Node) GetFullPath

func (n *Node) GetFullPath() string

type NodeType

type NodeType string
const (
	Secret NodeType = "secret"
	Folder NodeType = "folder"
)

type Vaultclient

type Vaultclient[A Authenticator] struct {
	Auth A
	// contains filtered or unexported fields
}

func (*Vaultclient[A]) GetVaultAddr

func (v *Vaultclient[A]) GetVaultAddr() string

func (*Vaultclient[A]) ListMounts

func (v *Vaultclient[A]) ListMounts() (map[string]*vaultApi.MountOutput, error)

func (*Vaultclient[A]) ListTree

func (c *Vaultclient[A]) ListTree(basePath string) ([]*Node, error)

func (*Vaultclient[A]) ListTreeFiltered

func (v *Vaultclient[A]) ListTreeFiltered(basePath string) ([]*Node, error)

List keys including mounts, filter out non secrets / non expandable paths by expandable I mean things like secret engines, they are not expandable

func (*Vaultclient[A]) Read

func (v *Vaultclient[A]) Read(secretPath, optionalSecretVersion string) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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