vaultutil

package module
v0.0.0-...-8db782f Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

README

vaultutil

A utility tool which uses the Haschicorp Vault API. This tool can be used to authenticate using Vault's HTTP api.

Features

  • Authenticate using ldap backend
  • Authenticate using userpass backend
  • HTTP Api call support for custom paths

Usage

go get github.com/gobins/vaultutil

The following environment variables needs to be set for authentication

LDAP Authentication
  • VAULT_LUSER
  • VAULT_LPASSWORD
Userpass Authentication
  • VAULT_USER
  • VAULT_PASSWORD
Creating a client

client, err := GetVaultClient("userpass")

or

client, err := GetVaultClient("ldap")

client.Authenticate()

Retrieving Auth Token

token = client.GetToken()

Support

vaultutil has been tested with the following versions

  • 0.6
  • 0.6.1

Contributing

Please contribute by sending a pull request.

If there is an issue due to API changes, please raise an issue.

Documentation

Index

Constants

View Source
const VaultAddress = "VAULT_ADDR"

Variables

This section is empty.

Functions

func ApplyGroupPolicy

func ApplyGroupPolicy(c *vaultapi.Client, group_name, policy_name string) error

func ApplyUserPolicy

func ApplyUserPolicy(c *vaultapi.Client, user_name, policy_name string) error

func CreateMount

func CreateMount(c *vaultapi.Client, mount_data MountData) error

func CreateUpdatePolicy

func CreateUpdatePolicy(c *vaultapi.Client, policy_name, policy_file string) error

func CreateUpdateSSHKey

func CreateUpdateSSHKey(c *vaultapi.Client, ssh_path, key_name, key_value string) (*vaultapi.Secret, error)

func CreateUpdateSSHRole

func CreateUpdateSSHRole(c *vaultapi.Client, ssh_path, role_name string, role SSHRoleData) (*vaultapi.Secret, error)

func DeleteGroup

func DeleteGroup(c *vaultapi.Client, groupname string) (*vaultapi.Secret, error)

func DeleteMount

func DeleteMount(c *vaultapi.Client, mount_path string) error

func DeletePolicy

func DeletePolicy(c *vaultapi.Client, policy_name string) error

func DeleteSSHKey

func DeleteSSHKey(c *vaultapi.Client, ssh_path, key_name string) (*vaultapi.Secret, error)

func DisableAuditBackend

func DisableAuditBackend(c *vaultapi.Client, audit_path string) error

func DisableAuthBackend

func DisableAuthBackend(c *vaultapi.Client, mount_path string) error

func DoRemount

func DoRemount(c *vaultapi.Client, mount_path, new_mount_path string) error

func EnableAuthBackend

func EnableAuthBackend(c *vaultapi.Client, mount_path, authType, desc string) error

func GetAuditBackends

func GetAuditBackends(c *vaultapi.Client) error

func GetAuditHash

func GetAuditHash(c *vaultapi.Client, path, data string) error

func GetCapability

func GetCapability(c *vaultapi.Client, token, path string) error

func GetGroupPolicy

func GetGroupPolicy(c *vaultapi.Client, group_name string) (*vaultapi.Secret, error)

func GetGroups

func GetGroups(c *vaultapi.Client) (*vaultapi.Secret, error)

func GetKeyStatus

func GetKeyStatus(c *vaultapi.Client) error

func GetLeader

func GetLeader(c *vaultapi.Client) error

func GetSSHRole

func GetSSHRole(c *vaultapi.Client, ssh_path, role_name string) (*vaultapi.Secret, error)

func GetSelfCapability

func GetSelfCapability(c *vaultapi.Client, path string) error

func GetVaultClient

func GetVaultClient(credtype string) (*vaultClient, error)

func ListMounts

func ListMounts(c *vaultapi.Client) (map[string]*vaultapi.MountOutput, error)

func ReadPolicy

func ReadPolicy(c *vaultapi.Client, policy_name string) (string, error)

func RenewLease

func RenewLease(c *vaultapi.Client, lease_id, increment_duration string) error

func RevokeForce

func RevokeForce(c *vaultapi.Client, path string) error

func RevokeGroupPolicy

func RevokeGroupPolicy(c *vaultapi.Client, group_name string) error

func RevokeLease

func RevokeLease(c *vaultapi.Client, lease_id string) error

func RevokePrefix

func RevokePrefix(c *vaultapi.Client, path string) error

func RevokeUserPolicy

func RevokeUserPolicy(c *vaultapi.Client, user_name string) error

func RotateKeys

func RotateKeys(c *vaultapi.Client) error

func SetFileAuditBackend

func SetFileAuditBackend(c *vaultapi.Client, path, file_path string) error

func StepDownLeader

func StepDownLeader(c *vaultapi.Client) error

Types

type AuthHolder

type AuthHolder struct {
	Client_Token   string   `json:"client_token"`
	Accessor       string   `json:"accessor"`
	Policies       []string `json:"policies"`
	Metadata       `json:"metadata"`
	Lease_Duration int  `json:"lease_duration"`
	Renewable      bool `json:"renewable"`
}

type Metadata

type Metadata struct {
	Username string `json:"username"`
	Policies string `json:"policies"`
}

type MountData

type MountData struct {
	Mount_name        string
	Mount_type        string
	Backend_type      string
	Description       string
	Path              string
	Default_lease_ttl string
	Max_lease_ttl     string
}

type SSHRoleData

type SSHRoleData struct {
	Key               string
	Admin_User        string
	Default_User      string
	Cidr_List         string
	Exclude_Cidr_List string
	Port              int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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