openstackiid

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0 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

Overview

Package openstackiid implements the agent side of the openstack_iid SPIRE node attestor: it fetches the instance identity token that the OpenStack metadata JWT issuer (openstack-spire-issuer) hands to the instance through Nova's DynamicJSON vendordata, and sends it to SPIRE Server as the attestation payload.

The token's claims are bound to the real instance by the issuer, which authenticates Nova's service token against Keystone and cross-checks the instance and project against the Nova API before signing; this plugin relies on that invariant without being able to enforce it, and does not verify the token: it holds no keys, and SPIRE Server verifies anyway.

Index

Constants

View Source
const (
	// DefaultVendorDataURL is Nova's metadata service, as seen from inside
	// the instance.
	DefaultVendorDataURL = "http://169.254.169.254/openstack/latest/vendor_data2.json"
)

Variables

View Source
var (
	// ErrTargetMissing is returned (wrapped) when the vendordata has no
	// openstack_iid entry: Nova omits a DynamicJSON target whose call failed,
	// so the issuer was most likely unavailable.
	ErrTargetMissing = errors.New("vendordata has no " + iid.TargetName + " target")
	// ErrInvalidToken is returned (wrapped) when the vendordata carries
	// something that cannot be an openstack_iid token.
	ErrInvalidToken = errors.New("invalid token in vendordata")
	// ErrStaleToken is returned (wrapped) when the vendordata keeps serving
	// the token this plugin presented last, beyond fresh_token_timeout.
	ErrStaleToken = errors.New("vendordata keeps serving an already presented token")
)

Functions

func ConfigKeys

func ConfigKeys() []string

ConfigKeys returns the keys plugin_data accepts (the documentation's completeness test reads them).

Types

type Config

type Config struct {
	// VendorDataURL is the URL of vendor_data2.json.
	VendorDataURL string `hcl:"vendordata_url"`
	// HTTPTimeout bounds each fetch of the vendordata.
	HTTPTimeout string `hcl:"http_timeout"`
	// FreshTokenTimeout bounds the wait for a token different from the one
	// presented last.
	FreshTokenTimeout string `hcl:"fresh_token_timeout"`
}

Config is the plugin_data block of the agent configuration.

type Plugin

type Plugin struct {
	nodeattestorv1.UnimplementedNodeAttestorServer
	configv1.UnimplementedConfigServer
	// contains filtered or unexported fields
}

Plugin is the agent-side openstack_iid node attestor.

func New

func New() *Plugin

New returns an unconfigured Plugin.

func (*Plugin) AidAttestation

AidAttestation sends the token found in the vendordata as the attestation payload. It never sends the token it presented last: SPIRE Server accepts each token once, and Nova may keep serving the same one from its metadata cache, so it waits, bounded by fresh_token_timeout, for a fresh one. Errors are returned at once: retries are SPIRE Agent's business.

func (*Plugin) Configure

Configure validates and applies the plugin_data block.

func (*Plugin) SetLogger

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

SetLogger routes the plugin's logs, and those of log/slog, to SPIRE.

Jump to

Keyboard shortcuts

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