generator

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasMgr

type AliasMgr interface {
	References() ([]string, []string)
	LoadReferenceData(data map[string][]byte) error
	Generate(baseDir string, baseCmd cmdRunner) error
}

AliasMgr an interface for managing keytool aliases

type CertKeyPair

type CertKeyPair struct {
	Name   string
	RootCA *CertKeyPair
	Cert   *Certificate
	V1Spec *v1alpha1.KeySpec
	// contains filtered or unexported fields
}

CertKeyPair Private/Public certificates which optionally can be signed by a RootCA

func NewCertKeyPair

func NewCertKeyPair(keyConfig *v1alpha1.KeyConfig) (*CertKeyPair, error)

NewCertKeyPair creates new CertKeyPair type for reconciliation

func NewRootCA

func NewRootCA(keyConfig *v1alpha1.KeyConfig) *CertKeyPair

NewRootCA create a cert that is a root signing CA

func (*CertKeyPair) EnsureSecretManager

func (kp *CertKeyPair) EnsureSecretManager(ctx context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

EnsureSecretManager populates secrete manager from RootCA data

func (*CertKeyPair) Generate

func (kp *CertKeyPair) Generate() error

Generate generate a key pair

func (*CertKeyPair) InSecret

func (kp *CertKeyPair) InSecret(secObject *corev1.Secret) bool

InSecret return true if the key is one found in the secret

func (*CertKeyPair) IsEmpty

func (kp *CertKeyPair) IsEmpty() bool

IsEmpty checks if CertKeyPair has any useable

func (*CertKeyPair) LoadFromData

func (kp *CertKeyPair) LoadFromData(data map[string][]byte)

LoadFromData load data from kubernetes secret

func (*CertKeyPair) LoadReferenceData

func (kp *CertKeyPair) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads references from data

func (*CertKeyPair) LoadSecretFromManager

func (kp *CertKeyPair) LoadSecretFromManager(ctx context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

LoadSecretFromManager populates RootCA data from secret manager

func (*CertKeyPair) References

func (kp *CertKeyPair) References() ([]string, []string)

References return names of secrets that should be looked up

func (*CertKeyPair) ToKubernetes

func (kp *CertKeyPair) ToKubernetes(secObject *corev1.Secret)

ToKubernetes serializes CertKeyPair to kubernetes object

type Certificate

type Certificate struct {
	Cert          *x509.Certificate
	CertPEM       []byte
	PrivateKeyEC  *ecdsa.PrivateKey
	PrivateKeyRSA *rsa.PrivateKey
	PrivateKeyPEM []byte
}

Certificate represents a certificate and its private key

type GenConfig added in v1.0.1

type GenConfig struct {
	SecObject     *corev1.Secret
	Log           logr.Logger
	Namespace     string
	AppConfig     *v1alpha1.AppConfig
	KeysToGen     []*v1alpha1.KeyConfig
	Client        client.Client
	SecretManager secretsmanager.SecretManager
}

GenConfig container for runtime secret object generation

func (*GenConfig) GenKeys added in v1.0.1

func (g *GenConfig) GenKeys(ctx context.Context) error

GenKeys load secrets from a secret manager or generate them and save to a secret manager GenKeys generates keys until there's an error or a dependency that can't be set.

type KeyMgr

type KeyMgr interface {
	References() ([]string, []string)
	LoadReferenceData(data map[string][]byte) error
	LoadSecretFromManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error
	EnsureSecretManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error
	Generate() error
	LoadFromData(secData map[string][]byte)
	IsEmpty() bool
	ToKubernetes(secObject *corev1.Secret)
	InSecret(secObject *corev1.Secret) bool
}

KeyMgr an interface for managing secret data

type KeyTool

type KeyTool struct {
	Name   string
	V1Spec *v1alpha1.KeySpec
	// contains filtered or unexported fields
}

KeyTool an object for managing keytool aliases.

func NewKeyTool

func NewKeyTool(key *v1alpha1.KeyConfig) (*KeyTool, error)

NewKeyTool creates new keytool instance

func (*KeyTool) EnsureSecretManager

func (kt *KeyTool) EnsureSecretManager(ctx context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

EnsureSecretManager adds keytool to secret manager

func (*KeyTool) Generate

func (kt *KeyTool) Generate() error

Generate keystore and all of its aliases

func (*KeyTool) InSecret

func (kt *KeyTool) InSecret(secObject *corev1.Secret) bool

InSecret return true if the key is one found in the secret

func (*KeyTool) IsEmpty

func (kt *KeyTool) IsEmpty() bool

IsEmpty test if the keystore is empty

func (*KeyTool) LoadFromData

func (kt *KeyTool) LoadFromData(secData map[string][]byte)

LoadFromData keystore from from bytes

func (*KeyTool) LoadReferenceData

func (kt *KeyTool) LoadReferenceData(data map[string][]byte) error

LoadReferenceData load all alias reference data

func (*KeyTool) LoadSecretFromManager

func (kt *KeyTool) LoadSecretFromManager(ctx context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

LoadSecretFromManager populates keytool data from secret manager

func (*KeyTool) References

func (kt *KeyTool) References() ([]string, []string)

References all names the ids of references required for generation

func (*KeyTool) ToKubernetes

func (kt *KeyTool) ToKubernetes(secObject *corev1.Secret)

ToKubernetes serializes data to kubernetes secret

type KeyToolGenKeyPair

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

KeyToolGenKeyPair alias password manager

func NewKeyToolGenKeyPair

func NewKeyToolGenKeyPair(alias *v1alpha1.KeytoolAliasConfig) *KeyToolGenKeyPair

NewKeyToolGenKeyPair create a new password alias manager

func (*KeyToolGenKeyPair) Generate

func (kp *KeyToolGenKeyPair) Generate(baseDir string, baseCmd cmdRunner) error

Generate creates keytool password alias entry

func (*KeyToolGenKeyPair) LoadReferenceData

func (kp *KeyToolGenKeyPair) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads data from references

func (*KeyToolGenKeyPair) References

func (kp *KeyToolGenKeyPair) References() ([]string, []string)

References get list of refences needed for generated a alias

type KeyToolGenSecKey

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

KeyToolGenSecKey alias password manager

func NewKeyToolGenSecKey

func NewKeyToolGenSecKey(alias *v1alpha1.KeytoolAliasConfig) *KeyToolGenSecKey

NewKeyToolGenSecKey create a new password alias manager

func (*KeyToolGenSecKey) Generate

func (kp *KeyToolGenSecKey) Generate(baseDir string, baseCmd cmdRunner) error

Generate creates keytool password alias entry

func (*KeyToolGenSecKey) LoadReferenceData

func (kp *KeyToolGenSecKey) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads data from references

func (*KeyToolGenSecKey) References

func (kp *KeyToolGenSecKey) References() ([]string, []string)

References get list of refences needed for generated a alias

type KeyToolImportCert

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

KeyToolImportCert alias manager

func NewKeyToolImportCert

func NewKeyToolImportCert(alias *v1alpha1.KeytoolAliasConfig) *KeyToolImportCert

NewKeyToolImportCert created new

func (*KeyToolImportCert) Generate

func (k *KeyToolImportCert) Generate(baseDir string, baseCmd cmdRunner) error

Generate creates keytool certificate with its CA alias entry

func (*KeyToolImportCert) LoadReferenceData

func (k *KeyToolImportCert) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads data from references

func (*KeyToolImportCert) References

func (k *KeyToolImportCert) References() ([]string, []string)

References get list of refences needed for generated a alias

type KeyToolImportKeystore

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

KeyToolImportKeystore alias manager

func NewKeyToolImportKeystore

func NewKeyToolImportKeystore(alias *v1alpha1.KeytoolAliasConfig) *KeyToolImportKeystore

NewKeyToolImportKeystore created new

func (*KeyToolImportKeystore) Generate

func (k *KeyToolImportKeystore) Generate(baseDir string, baseCmd cmdRunner) error

Generate creates keytool password alias entry

func (*KeyToolImportKeystore) LoadReferenceData

func (k *KeyToolImportKeystore) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads data from references

func (*KeyToolImportKeystore) References

func (k *KeyToolImportKeystore) References() ([]string, []string)

References get list of refences needed for generated a alias

type KeyToolImportPassword

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

KeyToolImportPassword alias password manager

func NewKeyToolImportPassword

func NewKeyToolImportPassword(alias *v1alpha1.KeytoolAliasConfig) *KeyToolImportPassword

NewKeyToolImportPassword create a new password alias manager

func (*KeyToolImportPassword) Generate

func (kp *KeyToolImportPassword) Generate(baseDir string, baseCmd cmdRunner) error

Generate creates keytool password alias entry

func (*KeyToolImportPassword) LoadReferenceData

func (kp *KeyToolImportPassword) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads data from references

func (*KeyToolImportPassword) References

func (kp *KeyToolImportPassword) References() ([]string, []string)

References get list of refences needed for generated a alias

type Literal

type Literal struct {
	Name        string
	Value       []byte
	ConfigValue []byte
	IsBase64    bool
}

Literal randomly generated of specified length

func NewLiteral

func NewLiteral(keyConfig *v1alpha1.KeyConfig) *Literal

NewLiteral creates new Literal type for reconciliation

func (*Literal) EnsureSecretManager

func (literal *Literal) EnsureSecretManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

EnsureSecretManager populates secrets manager from Literal data

func (*Literal) Generate

func (literal *Literal) Generate() error

Generate generates data

func (*Literal) InSecret

func (literal *Literal) InSecret(secObject *corev1.Secret) bool

InSecret return true if the key is one found in the secret

func (*Literal) IsEmpty

func (literal *Literal) IsEmpty() bool

IsEmpty boolean determines if the struct is empty

func (*Literal) LoadFromData

func (literal *Literal) LoadFromData(secData map[string][]byte)

LoadFromData loads data from kubernetes secret

func (*Literal) LoadReferenceData

func (literal *Literal) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads references from data

func (*Literal) LoadSecretFromManager

func (literal *Literal) LoadSecretFromManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

LoadSecretFromManager populates Literal data from secret manager

func (*Literal) References

func (literal *Literal) References() ([]string, []string)

References return names of secrets that should be looked up

func (*Literal) ToKubernetes

func (literal *Literal) ToKubernetes(secret *corev1.Secret)

ToKubernetes "marshals" object to kubernetes object

type Password

type Password struct {
	Name       string
	Length     int
	Value      []byte
	BinaryMode bool
}

Password randomly generated of specified length

func NewPassword

func NewPassword(keyConfig *v1alpha1.KeyConfig) *Password

NewPassword creates new Password type for reconciliation

func (*Password) EnsureSecretManager

func (pwd *Password) EnsureSecretManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

EnsureSecretManager populates secrets manager from Password data

func (*Password) Generate

func (pwd *Password) Generate() error

Generate generates data

func (*Password) InSecret

func (pwd *Password) InSecret(secObject *corev1.Secret) bool

InSecret return true if the key is one found in the secret

func (*Password) IsEmpty

func (pwd *Password) IsEmpty() bool

IsEmpty boolean determines if the struct is empty

func (*Password) LoadFromData

func (pwd *Password) LoadFromData(secData map[string][]byte)

LoadFromData loads data from kubernetes secret

func (*Password) LoadReferenceData

func (pwd *Password) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads references from data

func (*Password) LoadSecretFromManager

func (pwd *Password) LoadSecretFromManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

LoadSecretFromManager populates Password data from secret manager

func (*Password) References

func (pwd *Password) References() ([]string, []string)

References return names of secrets that should be looked up

func (*Password) ToKubernetes

func (pwd *Password) ToKubernetes(secret *corev1.Secret)

ToKubernetes "marshals" object to kubernetes object

type SSH

type SSH struct {
	Name          string
	PrivateKeyRSA *rsa.PrivateKey
	PrivateKeyPEM []byte
	PublicKeyPEM  []byte
}

SSH randomly generated of specified length

func NewSSH

func NewSSH(keyConfig *v1alpha1.KeyConfig) *SSH

NewSSH creates new SSH type for reconciliation

func (*SSH) EnsureSecretManager

func (ssh *SSH) EnsureSecretManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

EnsureSecretManager populates secrets manager from SSH data

func (*SSH) Generate

func (ssh *SSH) Generate() error

Generate generates data

func (*SSH) InSecret

func (ssh *SSH) InSecret(secObject *corev1.Secret) bool

InSecret return true if the key is one found in the secret

func (*SSH) IsEmpty

func (ssh *SSH) IsEmpty() bool

IsEmpty boolean determines if the struct is empty

func (*SSH) LoadFromData

func (ssh *SSH) LoadFromData(secData map[string][]byte)

LoadFromData loads data from kubernetes secret

func (*SSH) LoadReferenceData

func (ssh *SSH) LoadReferenceData(data map[string][]byte) error

LoadReferenceData loads references from data

func (*SSH) LoadSecretFromManager

func (ssh *SSH) LoadSecretFromManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

LoadSecretFromManager populates SSH data from secret manager

func (*SSH) References

func (ssh *SSH) References() ([]string, []string)

References return names of secrets that should be looked up

func (*SSH) ToKubernetes

func (ssh *SSH) ToKubernetes(secret *corev1.Secret)

ToKubernetes "marshals" object to kubernetes object

type TrustStore

type TrustStore struct {
	Name string

	V1Spec *v1alpha1.KeySpec
	Value  []byte
	// contains filtered or unexported fields
}

TrustStore a KeyMgr for managing truststores

func NewTrustStore

func NewTrustStore(key *v1alpha1.KeyConfig) *TrustStore

NewTrustStore create an new trust store object

func (*TrustStore) EnsureSecretManager

func (ts *TrustStore) EnsureSecretManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

EnsureSecretManager adds to secret manager

func (*TrustStore) Generate

func (ts *TrustStore) Generate() error

Generate and all of its aliases

func (*TrustStore) InSecret

func (ts *TrustStore) InSecret(secObject *corev1.Secret) bool

InSecret return true if the key is one found in the secret

func (*TrustStore) IsEmpty

func (ts *TrustStore) IsEmpty() bool

IsEmpty test if empty

func (*TrustStore) LoadFromData

func (ts *TrustStore) LoadFromData(secData map[string][]byte)

LoadFromData from from bytes

func (*TrustStore) LoadReferenceData

func (ts *TrustStore) LoadReferenceData(data map[string][]byte) error

LoadReferenceData load all alias reference data

func (*TrustStore) LoadSecretFromManager

func (ts *TrustStore) LoadSecretFromManager(context context.Context, sm secretsmanager.SecretManager, secretManagerKeyNamespace string) error

LoadSecretFromManager load from secret manager

func (*TrustStore) References

func (ts *TrustStore) References() ([]string, []string)

References all names the ids of references required for generation

func (*TrustStore) ToKubernetes

func (ts *TrustStore) ToKubernetes(secObject *corev1.Secret)

ToKubernetes serializes data to kubernetes secret

Jump to

Keyboard shortcuts

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