Documentation
¶
Overview ¶
Package spiffe adapts the SPIFFE Workload API to credentiallease identities.
Index ¶
- Variables
- func ValidateSocket(socket string) bool
- type HTTPClient
- type Source
- type X509Identity
- func (i *X509Identity) BundleSource() x509bundle.Source
- func (i *X509Identity) ClientTLSConfig(allowedServerIDs []string) (*tls.Config, error)
- func (i *X509Identity) Close() error
- func (i *X509Identity) SVIDSource() x509svid.Source
- func (i *X509Identity) ServerTLSConfig(allowedClientIDs []string) (*tls.Config, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ValidateSocket ¶ added in v0.113.0
ValidateSocket reports whether socket is a Workload API address this package accepts (a unix:// URL with an absolute path and nothing else).
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient contains a redirect-disabled HTTP client and the X.509 source it uses. The transport does not honor HTTP proxy environment variables because proxying would cross the configured SPIFFE peer-authentication boundary.
func NewHTTPClient ¶
func NewHTTPClientWithTimeout ¶
func NewHTTPClientWithTimeout(ctx context.Context, socket string, allowedServerIDs []string, timeout time.Duration) (*HTTPClient, error)
NewHTTPClientWithTimeout creates the same redirect-disabled, proxy-free SPIFFE mTLS client as NewHTTPClient with an explicit total and response header timeout. The upper bound prevents callers from creating unbounded requests while allowing control-plane calls with bounded evidence checks.
func (*HTTPClient) Close ¶
func (c *HTTPClient) Close() error
func (*HTTPClient) CloseIdleConnections ¶
func (c *HTTPClient) CloseIdleConnections()
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source obtains short-lived JWT-SVIDs for one requested audience. It must be closed when the owning service shuts down.
func New ¶
New creates a Workload API JWT source. socket must be a validated SPIFFE Workload API address, normally unix:///run/spire/agent.sock.
func (*Source) GetJWTBundleForTrustDomain ¶ added in v0.113.0
GetJWTBundleForTrustDomain makes Source a jwtbundle.Source: the trust bundle's JWT authorities the Workload API delivers, kept current by the source, for verifying a peer's JWT-SVID (package spiffeauth).
type X509Identity ¶
type X509Identity struct {
// contains filtered or unexported fields
}
X509Identity owns a rotating X.509-SVID source used to build mutually authenticated TLS configurations. Close it when the process shuts down.
func NewX509Identity ¶
func NewX509Identity(ctx context.Context, socket string) (*X509Identity, error)
NewX509Identity connects to the local Unix Workload API and waits for the first SVID and trust bundle. It never accepts a remote TCP endpoint.
func (*X509Identity) BundleSource ¶ added in v0.113.0
func (i *X509Identity) BundleSource() x509bundle.Source
BundleSource is the rotating X.509 trust bundle set (nil on a nil identity), for verifying a peer's X.509-SVID.
func (*X509Identity) ClientTLSConfig ¶
func (i *X509Identity) ClientTLSConfig(allowedServerIDs []string) (*tls.Config, error)
ClientTLSConfig presents this workload's SVID and authorizes only the configured server identities.
func (*X509Identity) Close ¶
func (i *X509Identity) Close() error
func (*X509Identity) SVIDSource ¶ added in v0.113.0
func (i *X509Identity) SVIDSource() x509svid.Source
SVIDSource is the rotating X.509-SVID of this workload (nil on a nil identity).
func (*X509Identity) ServerTLSConfig ¶
func (i *X509Identity) ServerTLSConfig(allowedClientIDs []string) (*tls.Config, error)
ServerTLSConfig presents this workload's SVID and requires clients to prove one of the exact configured SPIFFE identities.