SPIRE (the SPIFFE Runtime Environment)
repository·main·Indexed 25 days ago
https://github.com/spiffe/spireA toolchain of APIs designed to establish trust between software systems across diverse hosting platforms. SPIRE implements the SPIFFE standard to attest workloads and issue identities (SVIDs) via the SPIFFE Workload API. It includes the SPIRE Server, SPIRE Agent, and an OIDC Discovery Provider for exposing JWKS to validate JWTs. The system is extensible via a plugin framework and integrates with service meshes like Envoy and Istio, as well as orchestrators like Kubernetes.
What's inside SPIRE
- The SPIRE OIDC Discovery Provider is a helper utility that implements a subset of the OpenID Connect (OIDC) discovery specification. Its primary purpose is to expose a JSON Web Key Set (JWKS) used for validating JSON Web Tokens (JWTs).
Explore SPIFFE and SPIRE ecosystem integrations
mainSPIFFE and SPIRE integrate with a wide range of open-source projects, including service meshes, container runtimes, orchestrators, and security tools. Key integrations include:
- Service Meshes & Proxies: Envoy, Istio, Linkerd, NGINX, Traefik, App Mesh Controller, Emissary.
- Orchestration & Containers: Kubernetes, Docker (containerd), Dapr.
- Security & Identity: Vault, Cert-Manager, Sigstore, Ghostunnel, Keycloak, Consul, Athenz.
- Communication & CI/CD: gRPC, Tekton, Hamlet.
- Other: Parsec, Knox, Tornjak.
Overview of the Upstream Authority "vault" Plugin
mainThe
vaultUpstream Authority plugin allows SPIRE to sign intermediate CA certificates using the HashiCorp Vault PKI Engine.Important Limitation: This plugin does not support the
PublishJWTKeyRPC. Consequently, it is not suitable for nested SPIRE topologies where JWT-SVIDs are required.Overview of SPIRE Server Dashboards
mainThe SPIRE Server dashboards monitor the central control plane. The available dashboards include:
- Server (General): High-level status including the server's Trust Domain, Version, and Uptime.
- Server Requests: Tracks API request volumes for three key entities: Agent, Entry, and Bundle.
- Server Latency: Monitors the latency of core server processes, including Retrieval, Signing, Cache Reload, and Datastore interactions.
- Server Runtime Info: Tracks resource utilization, specifically Alloc Bytes (memory allocation) and Heap Objects.
Overview of SPIRE Agent Dashboards
mainThe SPIRE Agent dashboards provide visibility into the health and performance of distributed agents. The available dashboards include:
- Agent (General): Provides a high-level overview, including the total number of agents categorized by trust domain and version.
- Agent: Detailed metrics for individual agents, specifically tracking Request Metrics (number of requests made) and Request Status (success/failure status of requests).
- Agent Latency: Monitors the timing of critical operations, including Retrieval Operations and Sync Operations.
- Agent Runtime Info: Tracks resource utilization, specifically Alloc Bytes (memory allocation) and Heap Objects.
Use the Go Text Template Engine in SPIRE plugins
mainSPIRE uses the standard Go
text/templateengine within various plugins to allow for dynamic configuration and data manipulation. When writing templates for SPIRE, you have access to two sets of functions:- Standard Go Template Functions: All built-in functions provided by the Go
text/templatepackage. - Sprig Library Functions: A large set of additional helper functions provided by the Sprig library.
For detailed syntax and logic, refer to the Go text/template documentation.
- Standard Go Template Functions: All built-in functions provided by the Go
Security considerations for Windows WorkloadAttestor
mainDenial of Service via Large Binaries
Malicious workloads can attempt to cause a Denial of Service (DoS) by forcing the SPIRE agent to perform expensive SHA256 calculations on large binaries.
Mitigation Strategies:
- Set
workload_size_limitto a negative value to disable hash calculation entirely. - Use
workload_size_limitto enforce a maximum binary size for hashing.
Impact of
disable_group_name_selectorsEnabling
disable_group_name_selectorsprevents the resolution of group SIDs to human-readable names.Warning: If you enable this flag, any existing workload registration entries that rely on
group_nameselectors will stop matching. Operators should audit these entries and migrate them to usegroup_sidselectors before enabling this flag.- Set
Understand SPIRE audit log fields
mainAudit log entries contain metadata about the request and the outcome of the operation.
Core Audit Fields:
type: Always set toauditto identify the entry type.request_id: A UUID identifying the specific call (useful for tracking multiple logs from a single batch operation).status: Indicates if the call was asuccessor anerror.status_code: The gRPC status code (provided on error).status_message: The error message returned to the caller (provided on error).
Caller Identification (UDS Endpoints): When using Unix Domain Socket (UDS) endpoints, the following fields identify the caller:
caller_uid: Caller user ID.caller_gid: Caller group ID.caller_path: Path to the caller's binary file.
Note for Kubernetes users: To enable audit logging for UDS endpoint calls in Kubernetes, the SPIRE Server node must have
hostPID: trueconfigured.Enable Sigstore image signature validation in the k8s workload attestor
mainThek8sworkload attestor can be extended to validate container image signatures and attestations using the Sigstore ecosystem. This feature is optional and is only activated when asigstoreconfiguration block is present in the agent configuration. When enabled, SPIRE can verify the integrity of images running in Kubernetes by checking their signatures against transparency logs (Rekor) and verifying attestations.Manage SPIRE server identity in Azure Key Vault
mainThe plugin must identify which SPIRE server instance is managing which keys. It uses Azure Key Vault tags with the
spire-prefix to track these.To identify the server, choose one of the following:
- Key Identifier File (
key_identifier_file): The plugin automatically manages and persists the server ID in this file. This is the recommended approach for most situations. Warning: If this file is lost, the plugin cannot identify previously managed keys and will recreate new keys on demand. - Static Identifier (
key_identifier_value): Use this to specify a static identifier if a file cannot be persisted. This provides more manual control over the server identity.
Managed tags include:
spire-server-td: The trust domain name of the server.spire-server-id: The unique identifier for the server (derived from the file or static value).
- Key Identifier File (
How to identify SPIRE server instances in AWS KMS
mainThe plugin must identify the specific server instance to manage its keys. You have two options:
- Key Identifier File (
key_identifier_file): The plugin manages the identifier automatically by storing a server ID in the specified file. If the file is missing at startup, it is recreated with a new ID. Warning: If this file is lost, the plugin cannot identify previously managed keys and will create new ones. - Key Identifier Value (
key_identifier_value): A static string used as the server identifier. Use this if the server cannot persist a local file.
- Key Identifier File (
Manage database connection pooling and lifecycle
mainThe SQL plugin uses Go's
database/sqlpackage for connection management. You can tune the following settings to optimize performance:max_open_conns: Limits the total number of open connections to the database (default:100).max_idle_conns: Limits the number of connections kept in the idle pool (default:100).conn_max_lifetime: Sets the maximum duration a connection can be reused before being closed (default:unlimited).
Note: The plugin uses an internal, non-configurable default of 30 seconds for
ConnMaxIdleTime(the maximum amount of time a connection may be idle before being closed).