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 ¶
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 ¶
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 (*Plugin) AidAttestation ¶
func (p *Plugin) AidAttestation(stream nodeattestorv1.NodeAttestor_AidAttestationServer) error
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 ¶
func (p *Plugin) Configure(ctx context.Context, req *configv1.ConfigureRequest) (*configv1.ConfigureResponse, error)
Configure validates and applies the plugin_data block.