vault

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LDAPAuthMethod is used for creating a client capable of LDAP authentication.
	LDAPAuthMethod = "ldap"

	// TokenAuthMethod is used for creating a client capable of token authentication.
	TokenAuthMethod = "token"
)

Variables

View Source
var (
	// ErrInvalidAuthMethod defines the error type when the
	// AuthMethod provided to the client is unsupported.
	ErrInvalidAuthMethod = errors.New("invalid auth method provided")

	// LDAPUserPath defines the path the user information gets
	// written to after success LDAP authentication.
	LDAPUserPath = "/auth/ldap/login/%s"
)
View Source
var Flags = []cli.Flag{

	&cli.StringFlag{
		Name:    "log.level",
		Usage:   "set log level - options: (trace|debug|info|warn|error|fatal|panic)",
		Value:   "info",
		EnvVars: []string{"PARAMETER_LOG_LEVEL", "VAULT_LOG_LEVEL", "VELA_LOG_LEVEL", "LOG_LEVEL"},
	},

	&cli.StringFlag{
		Name:    "config.addr",
		Usage:   "address to the instance",
		EnvVars: []string{"PARAMETER_ADDR", "SECRET_VAULT_ADDR", "VELA_VAULT_ADDR", "VAULT_ADDR"},
	},
	&cli.StringFlag{
		Name:    "config.auth-method",
		Usage:   "authentication method for interfacing instance - options: (token|ldap)",
		EnvVars: []string{"PARAMETER_AUTH_METHOD", "SECRET_AUTH_METHOD", "VAULT_AUTH_METHOD"},
	},
	&cli.StringFlag{
		Name:    "config.password",
		Usage:   "password for server authentication with LDAP",
		EnvVars: []string{"PARAMETER_PASSWORD", "SECRET_VAULT_PASSWORD", "VELA_VAULT_PASSWORD", "VAULT_PASSWORD"},
	},
	&cli.StringFlag{
		Name:    "config.token",
		Usage:   "token for server authentication",
		EnvVars: []string{"PARAMETER_TOKEN", "SECRET_VAULT_TOKEN", "VELA_VAULT_TOKEN", "VAULT_TOKEN"},
	},
	&cli.StringFlag{
		Name:    "config.username",
		Usage:   "username for server authentication with LDAP",
		EnvVars: []string{"PARAMETER_USERNAME", "SECRET_VAULT_USERNAME", "VELA_VAULT_USERNAME", "VAULT_USERNAME"},
	},
}

Flags represents all supported command line interface (CLI) flags for the runtime.

https://pkg.go.dev/github.com/urfave/cli?tab=doc#Flag

Functions

This section is empty.

Types

type Client

type Client struct {
	Vault *api.Client
}

client represents an internal struct for managing calls to a Vault instance

Vault client docs: https://pkg.go.dev/github.com/hashicorp/vault/api?tab=doc

func New

func New(s *Setup) (*Client, error)

New returns a Secret implementation that integrates with a Vault secrets engine.

func NewMock

func NewMock(t *testing.T) (*Client, error)

NewMock returns a test unsealed Vault to integrate with a Vault secret provider.

This function is intended for running tests only.

Docs: https://pkg.go.dev/github.com/hashicorp/vault/vault?tab=doc

func (*Client) Read

func (c *Client) Read(path string) (*api.Secret, error)

Read is a function to capture the secret for the provided path.

type Setup

type Setup struct {
	// specifies the address of the vault instances
	Addr string
	// specifies the authentication method to use
	AuthMethod string
	// specifies the password for authentication with LDAP auth method
	Password string
	// specifies the token for the vault instances
	Token string
	// specifies the username for authentication with LDAP auth method
	Username string
}

Setup represents the configuration necessary for creating a Vault client capable of integrating with a Vault instance.

Jump to

Keyboard shortcuts

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