credentials

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataStoreType DataStoreType
	VaultConfig   *VaultConfig
}

Config holds the selected backend and provider config (Vault).

func (*Config) String

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the Config fields are set correctly.

type CredentialManager

type CredentialManager interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error

	// BMC credential operations
	GetBMC(ctx context.Context, mac net.HardwareAddr) (*credential.Credential, error)
	PutBMC(ctx context.Context, mac net.HardwareAddr, credentials *credential.Credential) error
	PatchBMC(ctx context.Context, mac net.HardwareAddr, credentials *credential.Credential) error
	DeleteBMC(ctx context.Context, mac net.HardwareAddr) error

	// NVOS credential operations
	GetNVOS(ctx context.Context, mac net.HardwareAddr) (*credential.Credential, error)
	PutNVOS(ctx context.Context, mac net.HardwareAddr, credentials *credential.Credential) error
	PatchNVOS(ctx context.Context, mac net.HardwareAddr, credentials *credential.Credential) error
	DeleteNVOS(ctx context.Context, mac net.HardwareAddr) error

	// List all registered MACs
	Keys(ctx context.Context) ([]net.HardwareAddr, error)
}

CredentialManager defines a key-value store for BMC and NVOS credentials keyed by MAC address.

func New

func New(ctx context.Context, config *Config) (CredentialManager, error)

New creates a new Credential Manager based on the given configuration.

type DataStoreType

type DataStoreType string

DataStoreType selects credential store backend.

const (
	DatastoreTypeVault    DataStoreType = "Vault"
	DatastoreTypeInMemory DataStoreType = "InMemory"
)

type InMemoryCredentialManager

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

InMemoryCredentialManager implements the CredentialManager interface with an in-memory store.

func NewInMemoryCredentialManager

func NewInMemoryCredentialManager() *InMemoryCredentialManager

func (*InMemoryCredentialManager) DeleteBMC

DeleteBMC removes the BMC credential for mac (no error if absent).

func (*InMemoryCredentialManager) DeleteNVOS

DeleteNVOS removes the NVOS credential for mac (no error if absent).

func (*InMemoryCredentialManager) GetBMC

GetBMC returns the BMC credential for mac or an error if missing/invalid.

func (*InMemoryCredentialManager) GetNVOS

GetNVOS returns the NVOS credential for mac or an error if missing/invalid.

func (*InMemoryCredentialManager) Keys

Keys returns all MACs with stored credentials (checking for BMC credentials).

func (*InMemoryCredentialManager) PatchBMC

PatchBMC updates the BMC credential for mac (replaces current value).

func (*InMemoryCredentialManager) PatchNVOS

PatchNVOS updates the NVOS credential for mac (replaces current value).

func (*InMemoryCredentialManager) PutBMC

PutBMC stores the BMC credential for mac. If an identical entry exists, this is a no-op. If a different entry exists, the new value overwrites (with a warning log).

func (*InMemoryCredentialManager) PutNVOS

PutNVOS stores the NVOS credential for mac. If an identical entry exists, this is a no-op. If a different entry exists, the new value overwrites (with a warning log).

func (*InMemoryCredentialManager) Start

Start InMemoryCredentialManager (NO-OP)

func (*InMemoryCredentialManager) Stop

Stop InMemoryCredentialManager (NO-OP)

type VaultConfig

type VaultConfig struct {
	Address string
	Token   string
}

VaultConfig configures access to Vault (address and token). The token should be scoped minimally for KV operations.

func (*VaultConfig) NewManager

func (c *VaultConfig) NewManager() (*VaultCredentialManager, error)

NewManager initializes a Vault client with the configured address and token. TLS verification is skipped to handle self-signed certificates in Kubernetes environments.

func (VaultConfig) String

func (c VaultConfig) String() string

String returns the canonical string form of the version.

func (*VaultConfig) Validate

func (c *VaultConfig) Validate() error

Validate ensures required Vault fields are provided.

type VaultCredentialManager

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

VaultCredentialManager implements the CredentialManager interface with a Vault store.

func (*VaultCredentialManager) DeleteBMC

DeleteBMC removes the BMC credential from Vault.

func (*VaultCredentialManager) DeleteNVOS

func (m *VaultCredentialManager) DeleteNVOS(ctx context.Context, mac net.HardwareAddr) error

DeleteNVOS removes the NVOS credential from Vault.

func (*VaultCredentialManager) GetBMC

GetBMC retrieves and validates BMC credentials for the given MAC from Vault.

func (*VaultCredentialManager) GetNVOS

GetNVOS retrieves and validates NVOS credentials for the given MAC from Vault.

func (*VaultCredentialManager) Keys

Keys returns a list of MACs for which the credential manager has BMC secrets for.

func (*VaultCredentialManager) PatchBMC

PatchBMC unconditionally replaces the BMC credentials in Vault.

func (*VaultCredentialManager) PatchNVOS

PatchNVOS unconditionally replaces the NVOS credentials in Vault.

func (*VaultCredentialManager) PutBMC

PutBMC writes BMC credentials to Vault. If an identical entry exists this is a no-op; if a different entry exists it is overwritten with a warning; if the existing entry could not be read (transient Vault failure, corrupted secret, etc.) the write proceeds with a warning so credential rotation is not blocked. Use PatchBMC for the same effect without the existence check.

func (*VaultCredentialManager) PutNVOS

PutNVOS writes NVOS credentials to Vault. See PutBMC for the precise upsert semantics (match → skip, differ → warn-and-overwrite, unreadable → warn-and-overwrite).

func (*VaultCredentialManager) Start

Start ensures the Vault engine is mounted at the configured path.

func (*VaultCredentialManager) Stop

Stop performs no cleanup.

Jump to

Keyboard shortcuts

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