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 ¶
- func BuiltIn() catalog.BuiltIn
- type Config
- type Plugin
- func (p *Plugin) Configure(ctx context.Context, req *configv1.ConfigureRequest) (*configv1.ConfigureResponse, error)
- func (p *Plugin) GenerateKey(ctx context.Context, req *keymanagerv1.GenerateKeyRequest) (*keymanagerv1.GenerateKeyResponse, error)
- func (p *Plugin) GetPublicKey(_ context.Context, req *keymanagerv1.GetPublicKeyRequest) (*keymanagerv1.GetPublicKeyResponse, error)
- func (p *Plugin) GetPublicKeys(_ context.Context, _ *keymanagerv1.GetPublicKeysRequest) (*keymanagerv1.GetPublicKeysResponse, error)
- func (p *Plugin) SetLogger(log hclog.Logger)
- func (p *Plugin) SignData(ctx context.Context, req *keymanagerv1.SignDataRequest) (*keymanagerv1.SignDataResponse, error)
- func (p *Plugin) Validate(_ context.Context, req *configv1.ValidateRequest) (*configv1.ValidateResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (*Plugin) Configure ¶
func (p *Plugin) Configure(ctx context.Context, req *configv1.ConfigureRequest) (*configv1.ConfigureResponse, error)
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 ¶
func (p *Plugin) GenerateKey(ctx context.Context, req *keymanagerv1.GenerateKeyRequest) (*keymanagerv1.GenerateKeyResponse, error)
GenerateKey creates a new asymmetric key pair in the KMIP server.
func (*Plugin) GetPublicKey ¶
func (p *Plugin) GetPublicKey(_ context.Context, req *keymanagerv1.GetPublicKeyRequest) (*keymanagerv1.GetPublicKeyResponse, error)
GetPublicKey returns the cached public key for the given SPIRE key ID.
func (*Plugin) GetPublicKeys ¶
func (p *Plugin) GetPublicKeys(_ context.Context, _ *keymanagerv1.GetPublicKeysRequest) (*keymanagerv1.GetPublicKeysResponse, error)
GetPublicKeys returns all cached public keys.
func (*Plugin) SignData ¶
func (p *Plugin) SignData(ctx context.Context, req *keymanagerv1.SignDataRequest) (*keymanagerv1.SignDataResponse, error)
SignData signs pre-hashed data using the private key identified by req.KeyId.
func (*Plugin) Validate ¶
func (p *Plugin) Validate(_ context.Context, req *configv1.ValidateRequest) (*configv1.ValidateResponse, error)
Validate validates the plugin configuration without applying it.