credentials

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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 or replaces the BMC credential for mac.

func (*InMemoryCredentialManager) PutNVOS

PutNVOS stores or replaces the NVOS credential for mac.

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 replaces the BMC's credentials in Vault (equivalent to Put).

func (*VaultCredentialManager) PatchNVOS

PatchNVOS replaces the NVOS credentials in Vault (equivalent to Put).

func (*VaultCredentialManager) PutBMC

PutBMC writes the BMC credentials to Vault.

func (*VaultCredentialManager) PutNVOS

PutNVOS writes the NVOS credentials to Vault.

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