vault

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Software Name : Remote Key Server Version: 0.9.0 SPDX-FileCopyrightText: Copyright (c) 2020 Orange SPDX-License-Identifier: MPL-2.0

This software is distributed under the Mozilla Public License 2.0, the text of which is available at https://www.mozilla.org/en-US/MPL/2.0/ or see the "LICENSE" file for more details.

Author: Glenn Feunteun, Celine Nicolas

Software Name : Remote Key Server Version: 0.9.0 SPDX-FileCopyrightText: Copyright (c) 2020 Orange SPDX-License-Identifier: MPL-2.0

This software is distributed under the Mozilla Public License 2.0, the text of which is available at https://www.mozilla.org/en-US/MPL/2.0/ or see the "LICENSE" file for more details.

Author: Glenn Feunteun, Celine Nicolas

Index

Constants

View Source
const AdminPolicy = `` /* 636-byte string literal not displayed */
View Source
const GroupInitAccessPolicy = `
	path "auth/token/renew-self" {
		capabilities =  ["read", "create", "update"]
	}
`
View Source
const GroupSecretAccessPolicy = `` /* 187-byte string literal not displayed */
View Source
const GroupTokenAccessPolicy = `` /* 379-byte string literal not displayed */

Variables

This section is empty.

Functions

func RKSErrFromVaultErr

func RKSErrFromVaultErr(err error, msg string) *model.RksError

Types

type Configuration

type Configuration struct {
	VaultAddr        string
	Certificate      string
	PrivateKey       string
	ListenAddress    string
	VaultInitialized bool
	AdminLogin       string
	AdminPwd         string
}

Configuration options

var Config Configuration

Configs the global config struct

type Vault

type Vault struct {
	*vaultAPI.Client
	// contains filtered or unexported fields
}

func NewVaultClient

func NewVaultClient(ctx context.Context, token string) (*Vault, *model.RksError)

func NewVaultClientFromHTTPRequest

func NewVaultClientFromHTTPRequest(r *http.Request) (*Vault, *model.RksError)

func (*Vault) ConfigExists

func (v *Vault) ConfigExists() (bool, *model.RksError)

func (*Vault) CreateGroupToken

func (v *Vault) CreateGroupToken(group string) (*model.GroupToken, *model.RksError)

func (*Vault) CreateGroupTokenAndPolicies

func (v *Vault) CreateGroupTokenAndPolicies(group string) (*model.GroupToken, *model.RksError)

func (*Vault) CreateGroupTokenRole

func (v *Vault) CreateGroupTokenRole(group string) *model.RksError

func (*Vault) CreateNodeTokenFromRole

func (v *Vault) CreateNodeTokenFromRole(group string, nodeID string) (*vaultAPI.Secret, *model.RksError)

func (*Vault) CreateNodeTokenRole

func (v *Vault) CreateNodeTokenRole(group string, nodeID string) *model.RksError

func (*Vault) DeleteConfig

func (v *Vault) DeleteConfig(group string) *model.RksError

func (*Vault) DeleteGroupToken

func (v *Vault) DeleteGroupToken(group string) *model.RksError

func (*Vault) DeleteGroupTokenAndPolicies

func (v *Vault) DeleteGroupTokenAndPolicies(group string) *model.RksError

func (*Vault) EnableAdminUserpassBackend

func (v *Vault) EnableAdminUserpassBackend() *model.RksError

func (*Vault) GetGroupList

func (v *Vault) GetGroupList() ([]string, *model.RksError)

func (*Vault) GetGroupNameFromGroupToken

func (v *Vault) GetGroupNameFromGroupToken() (string, *model.RksError)

func (*Vault) GetGroupSecretList

func (v *Vault) GetGroupSecretList(group string) (*model.GroupSecrets, int, *model.RksError)

func (*Vault) GetSecretGroupList

func (v *Vault) GetSecretGroupList(fqdn string) ([]string, *model.RksError)

return a list of groupname that uses a secret return an empyt list if None

func (*Vault) GroupExists

func (v *Vault) GroupExists(group string) (bool, *model.RksError)

func (*Vault) InitKvBackend

func (v *Vault) InitKvBackend() *model.RksError

func (*Vault) KeyExists

func (v *Vault) KeyExists(path string) (bool, *model.RksError)

func (*Vault) ListKeysUnderPath

func (v *Vault) ListKeysUnderPath(path string) ([]string, *model.RksError)

List first stage of path under given path remove / at end of key if exists

func (*Vault) Login

func (v *Vault) Login(login string, adminPassword string) (*model.AdminToken, *model.RksError)

func (*Vault) PurgeGroupSecretList

func (v *Vault) PurgeGroupSecretList(group string) *model.RksError

func (*Vault) PurgeKey

func (v *Vault) PurgeKey(path string) *model.RksError

PurgeKey removes a key entirely Vault KV2 introduces new semantics to delete with possibility to remove specific version of a key/value We want a complete key/value deletion so we use rks/metadata/fqdn https://www.vaultproject.io/api/secret/kv/kv-v2.html#delete-metadata-and-all-versions

func (*Vault) ReadGroupConfig

func (v *Vault) ReadGroupConfig(group string) (*model.GroupRegInfo, *model.RksError)

func (*Vault) ReadGroupToken

func (v *Vault) ReadGroupToken(group string) (*model.GroupToken, *model.RksError)

func (*Vault) ReadSecret

func (v *Vault) ReadSecret(path string) (*vaultAPI.Secret, *model.RksError)

func (*Vault) ReadSecretIntoStruct

func (v *Vault) ReadSecretIntoStruct(path string, data interface{}) *model.RksError

ReadSecretIntoStruct read key at *path* and decodes vault secret "data" field into given data struct This function will fail if no vault secret is found

func (*Vault) ReadSecretIntoStructWithCas added in v1.0.0

func (v *Vault) ReadSecretIntoStructWithCas(path string, data interface{}) (int, *model.RksError)

func (*Vault) RevokeGroupToken

func (v *Vault) RevokeGroupToken(group string) *model.RksError

func (*Vault) RevokeNodeToken

func (v *Vault) RevokeNodeToken(group string, nodeID string) *model.RksError

func (*Vault) SecretExists

func (v *Vault) SecretExists(fqdn string) (bool, *model.RksError)

func (*Vault) WriteConfig

func (v *Vault) WriteConfig() *model.RksError

func (*Vault) WriteGroupConfig

func (v *Vault) WriteGroupConfig(group string, groupRegInfo *model.GroupRegInfo) *model.RksError

func (*Vault) WriteGroupSecretList

func (v *Vault) WriteGroupSecretList(group string, groupSecrets *model.GroupSecrets, version int) *model.RksError

func (*Vault) WriteGroupToken

func (v *Vault) WriteGroupToken(group string, groupToken *model.GroupToken) *model.RksError

func (*Vault) WriteSecret

func (v *Vault) WriteSecret(fqdn string, secret *model.Secret) *model.RksError

func (*Vault) WriteStruct

func (v *Vault) WriteStruct(path string, data interface{}) *model.RksError

func (*Vault) WriteStructWithCas added in v1.0.0

func (v *Vault) WriteStructWithCas(path string, data interface{}, version int) *model.RksError

Jump to

Keyboard shortcuts

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