kmip

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package kmip implements a SPIRE KeyManager plugin that stores and uses signing keys via a generic KMIP 1.4-compliant server (binary TTLV over TCP/TLS).

Key metadata (server ID, trust domain, SPIRE key ID, key type, last-update, active) is stored as custom attributes (x-spire-*) on each key object per KMIP §3.39, so the plugin works with any spec-compliant KMIP server — no vendor extensions required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltIn

func BuiltIn() catalog.BuiltIn

BuiltIn returns the catalog.BuiltIn for registering this plugin.

Types

type Config

type Config struct {
	// KMIPAddr is the TCP address of the KMIP server (e.g. "kmip.example.com:5696").
	KMIPAddr string `hcl:"kmip_addr"`
	// CACertPath is the PEM file used to verify the KMIP server TLS certificate.
	// Optional; when empty the system certificate pool is used.
	CACertPath string `hcl:"ca_cert_path"`
	// ClientCertPath is the PEM file of the mTLS client certificate.
	ClientCertPath string `hcl:"client_cert_path"`
	// ClientKeyPath is the PEM file of the mTLS client private key.
	ClientKeyPath string `hcl:"client_key_path"`
	// InsecureSkipVerify disables TLS certificate verification (test environments only).
	InsecureSkipVerify bool `hcl:"insecure_skip_verify"`
	// ServerIDValue is a stable identifier for this SPIRE server instance, provided
	// directly. Mutually exclusive with ServerIDFile.
	ServerIDValue string `hcl:"server_id_value"`
	// ServerIDFile is a path to a file containing the stable server identifier. If the
	// file does not exist, a new server ID is generated and persisted there. Mutually
	// exclusive with ServerIDValue.
	ServerIDFile string `hcl:"server_id_file"`
	// StaleKeyThreshold is how old a key's x-spire-last-update attribute must be before the
	// reclamation task considers it orphaned and destroys it.
	StaleKeyThreshold string `hcl:"stale_key_threshold"`
	// contains filtered or unexported fields
}

Config is the HCL plugin configuration.

type Plugin

type Plugin struct {
	keymanagerv1.UnsafeKeyManagerServer
	configv1.UnsafeConfigServer
	// contains filtered or unexported fields
}

Plugin implements the SPIRE KeyManager using a generic KMIP server.

func New

func New() *Plugin

New returns a new Plugin instance.

func (*Plugin) Configure

Configure parses HCL config, dials the KMIP server, recovers existing keys via Locate, and performs an immediate keep-alive sweep before starting the periodic refresh task. The startup sweep closes the gap where a server that restarts more often than keepActiveKeysFrequency would otherwise never refresh recovered keys.

func (*Plugin) GenerateKey

GenerateKey creates a new asymmetric key pair in the KMIP server.

func (*Plugin) GetPublicKey

GetPublicKey returns the cached public key for the given SPIRE key ID.

func (*Plugin) GetPublicKeys

GetPublicKeys returns all cached public keys.

func (*Plugin) SetLogger

func (p *Plugin) SetLogger(log hclog.Logger)

SetLogger satisfies the hclog.Logger setter interface used by SPIRE.

func (*Plugin) SignData

SignData signs pre-hashed data using the private key identified by req.KeyId.

func (*Plugin) Validate

Validate validates the plugin configuration without applying it.

Jump to

Keyboard shortcuts

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