Documentation
¶
Overview ¶
Package credentials mints the throwaway certificates the local examples run on.
It stands in for the thing a real deployment already has: an internal CA under the PKI profile, a SPIFFE issuer under the SPIFFE one. Neither is something purser provides — cert-manager and SPIRE do that, and the Kubernetes manifests under examples/k8s use them. This exists so the local cells need no infrastructure at all.
Three identities are minted, not two. The third is the one that must be turned away: under the PKI profile it carries a different organizational unit, under the SPIFFE profile a different SPIFFE ID. A demonstration where every credential works shows only that TLS is on.
Everything it writes is disposable and expires in an hour. Nothing here belongs anywhere near a real deployment, and nothing it writes should be committed.
Index ¶
Constants ¶
const ( ServerDir = "server" ClientDir = "client" )
Names of the per-identity directories written under Dir.
const ( PKICertFile = "cert.pem" PKIKeyFile = "key.pem" PKICAFile = "ca.pem" )
File names under the PKI profile. The SPIFFE profile instead uses mtls.GKECertFile, mtls.GKEKeyFile and mtls.GKEBundleFile, so a -spiffe-dir pointed at one of these directories is laid out exactly like GKE's managed workload identity mount.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Identity ¶
type Identity struct {
// Name is the directory under Dir: ServerDir, ClientDir or
// UnauthorizedDir.
Name string
// Dir is the absolute directory holding the three PEM files.
Dir string
// Subject is the identity a purser server will report for a peer
// presenting this credential — the DNS SAN under the PKI profile,
// the SPIFFE ID under the SPIFFE one.
Subject string
}
Identity is one minted credential and where it landed.
type PKIOptions ¶
type PKIOptions struct {
// Dir is the directory to write into. Required.
Dir string
// ServerHost is the host the server certificate is valid for. An
// IP lands in an IP SAN, a name in a DNS SAN. Default "127.0.0.1".
ServerHost string
// ClientName is the DNS SAN on the client certificate, which the
// san_dns subject source reads as the identity. Default
// "hello-client.local".
ClientName string
// ClientOU is the organizational unit on the client certificate,
// for -pki-admit-ou. Default "platform".
ClientOU string
// certificate, the one -pki-admit-ou must reject. Default
// "interns".
UnauthorizedOU string
}
PKIOptions configures MintPKI. Zero fields take the defaults named in each comment.
type SPIFFEOptions ¶
type SPIFFEOptions struct {
// Dir is the directory to write into. Required.
Dir string
// TrustDomain is the domain to mint SVIDs in. Default
// "example.org".
TrustDomain string
// ServerPath, ClientPath and UnauthorizedPath are the SVID paths.
// Defaults "/ns/default/sa/hello-server", ".../hello-client" and
// ".../intruder".
ServerPath string
ClientPath string
}
SPIFFEOptions configures MintSPIFFE. Zero fields take the defaults named in each comment.
type Set ¶
Set is the result of a mint: the three identities, in a fixed order.
func MintPKI ¶
func MintPKI(opts PKIOptions) (Set, error)
MintPKI writes a CA and three standard-CA certificates under opts.Dir.
func MintSPIFFE ¶
func MintSPIFFE(opts SPIFFEOptions) (Set, error)
MintSPIFFE writes a CA and three X509-SVIDs under opts.Dir, each directory laid out like GKE's managed workload identity mount.