Help us shape the future of Go! Take the 2026 Go Developer Survey

spiffe

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package spiffe provides helpers for using the SPIFFE Workload and Broker APIs.

Index

Constants

View Source
const (
	// ControllerFlagSPIFFEBrokerEndpoint defines the flag for the gRPC URL of
	// the SPIFFE Broker endpoint, e.g.
	// dns:///spire-server.spire.svc.cluster.local:443. The Broker API may be
	// served over TCP, unlike the Workload API.
	ControllerFlagSPIFFEBrokerEndpoint = "spiffe-broker-endpoint"

	// ControllerFlagSPIFFEBrokerID defines the flag for the SPIFFE IDs of the
	// SPIFFE Broker endpoint. This flag is repeatable. Each value may be an
	// exact SPIFFE ID or a SPIFFE ID prefix, as parsed by
	// cryptov1.ParseSPIFFEID.
	ControllerFlagSPIFFEBrokerID = "spiffe-broker-id"

	// ControllerFlagAuthorizedArtifactClientSPIFFEID defines the flag for the
	// SPIFFE IDs authorized to fetch artifacts from an artifact server. This
	// flag is repeatable.
	ControllerFlagAuthorizedArtifactClientSPIFFEID = "authorized-artifact-client-spiffe-id"

	// ControllerFlagAuthorizedArtifactServerSPIFFEID defines the flag for the
	// SPIFFE IDs of artifact servers authorized by an artifact client. This
	// flag is repeatable.
	ControllerFlagAuthorizedArtifactServerSPIFFEID = "authorized-artifact-server-spiffe-id"

	// ControllerFlagAuthorizedNotifierSPIFFEID defines the flag for the
	// SPIFFE IDs authorized to send events to an event server. This flag is
	// repeatable.
	ControllerFlagAuthorizedNotifierSPIFFEID = "authorized-notifier-spiffe-id"

	// ControllerFlagAuthorizedEventServerSPIFFEID defines the flag for the
	// SPIFFE IDs of event servers authorized by an event client. This flag is
	// repeatable.
	ControllerFlagAuthorizedEventServerSPIFFEID = "authorized-event-server-spiffe-id"

	// ControllerFlagAuthorizedReceiverSPIFFEID defines the flag for the
	// SPIFFE IDs authorized to send requests to a receiver server. This flag
	// is repeatable.
	ControllerFlagAuthorizedReceiverSPIFFEID = "authorized-receiver-spiffe-id"

	// ControllerFlagAuthorizedKubeAPIServerSPIFFEID defines the flag for the
	// SPIFFE IDs of Kubernetes API servers authorized by a client. This flag
	// is repeatable.
	//
	// Note: Kubernetes does not natively support SPIFFE for API server TLS.
	// We define this flag here as per the RFC for it to be implemented after
	// Kubernetes implements native support, or Flux users request this feature
	// with maybe some custom solution they have to put a SPIFFE proxy in front
	// of their API servers.
	ControllerFlagAuthorizedKubeAPIServerSPIFFEID = "authorized-kube-apiserver-spiffe-id"
)

Controller flags. All SPIFFE ID flags are repeatable. Each value is parsed by cryptov1.ParseSPIFFEID and may be an exact SPIFFE ID, a SPIFFE ID prefix, a SPIFFE trust domain or the `spiffe://self` symbol.

Variables

This section is empty.

Functions

func BuildTLSConfig

func BuildTLSConfig(source TLSSource, peers ...string) (*tls.Config, error)

BuildTLSConfig returns a TLS configuration for mutual TLS with SPIFFE X.509-SVIDs. It presents the X.509-SVID from source and authorizes peers matching any of the given SPIFFE IDs, ID prefixes, trust domains or the `spiffe://self` forms, where the trust domain is taken from the local X.509-SVID.

The X.509-SVID and trust bundle are read from source on every handshake, so rotations are picked up automatically. The returned configuration can be used for both TLS clients and servers. Callers that need different peer authorization in each direction should build a configuration for each direction. The TLS hostname is not used for peer verification; the SPIFFE identity is verified instead.

Types

type TLSSource

type TLSSource interface {
	x509svid.Source
	x509bundle.Source
}

TLSSource provides the X.509-SVID and trust bundles used to build a TLS configuration. It is implemented by *workloadapi.X509Source.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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