secret

package
v0.0.0-...-03f94da Latest Latest
Warning

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

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

Documentation

Overview

Package secret provides functionality for generating and storing secrets both in a remote swarm and locally within supported storage such as pass stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePassphrases

func GeneratePassphrases(count uint) ([]string, error)

GeneratePassphrases generates human readable and rememberable passphrases.

func GeneratePasswords

func GeneratePasswords(count, length uint) ([]string, error)

GeneratePasswords generates passwords.

func GenerateSecrets

func GenerateSecrets(cl *dockerClient.Client, secrets map[string]Secret, server string) (map[string]string, error)

GenerateSecrets generates secrets locally and sends them to a remote server for storage.

func PassInsertSecret

func PassInsertSecret(secretValue, secretName, appName, server string) error

PassInsertSecret inserts a secret into a pass store.

func PassRmSecret

func PassRmSecret(secretName, appName, server string) error

PassRmSecret deletes a secret from a pass store.

func PollSecretsStatus

func PollSecretsStatus(cl *dockerClient.Client, app config.App) (secretStatuses, error)

PollSecretsStatus checks status of secrets by comparing the local recipe config and deploymend server state.

func ReadSecretsConfig

func ReadSecretsConfig(appEnvPath string, composeFiles []string, stackName string) (map[string]Secret, error)

ReadSecretsConfig reads secret names/versions from the recipe config. The function generalises appEnv/composeFiles because some times you have an app and some times you don't (as the caller). We need to be able to handle the "app new" case where we pass in the .env.sample and the "secret generate" case where the app is created.

Types

type Secret

type Secret struct {
	// Version comes from the secret version environment variable.
	// For example:
	//  SECRET_FOO=v1
	Version string
	// Length comes from the length modifier at the secret version environment
	// variable. For Example:
	//   SECRET_FOO=v1 # length=12
	Length int
	// RemoteName is the name of the secret on the server. For example:
	//   name: ${STACK_NAME}_test_pass_two_${SECRET_TEST_PASS_TWO_VERSION}
	// With the following:
	//   STACK_NAME=test_example_com
	//   SECRET_TEST_PASS_TWO_VERSION=v2
	// Will have this remote name:
	//   test_example_com_test_pass_two_v2
	RemoteName string
}

Secret represents a secret.

Jump to

Keyboard shortcuts

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