Documentation
¶
Overview ¶
Package certgen generates the certificate material a farm needs to run sqi over TLS: a farm certificate authority, server certificates for the API listener and the embedded broker, and client certificates for the optional worker mTLS path.
It sets the SANs and extended key usage that hand-rolled openssl invocations commonly get wrong, a mistake that otherwise surfaces only at worker-connect time rather than at load.
The same generator backs `sqi-server tls init`, `sqi-server tls issue` and the test suites, so tests exercise the shipped code path and need no checked-in certificate fixtures, which expire.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCAExists = errors.New("certgen: CA already exists")
ErrCAExists is returned by WriteCA when dir already holds a CA key. Regenerating a farm CA in place invalidates every certificate issued from it, so the caller must move the old one aside first.
Functions ¶
Types ¶
type CA ¶
type CA struct {
Cert *x509.Certificate
Key *ecdsa.PrivateKey
CertPEM []byte
KeyPEM []byte
}
CA is a generated certificate authority held in memory.
func LoadCA ¶
LoadCA reconstructs a CA from PEM material previously written by WriteCA, so certificates can be issued from a farm CA that already exists. `tls issue` uses it to add a worker to an established mTLS farm or rotate a server certificate without replacing the CA (`tls init` refuses to overwrite one).
func (*CA) NewClientCert ¶
NewClientCert signs a client certificate for the worker mTLS path. The common name is informational: sqi does not bind a certificate to a worker identity — the nkey does that. See docs/tls.md.
func (*CA) NewServerCert ¶
NewServerCert signs a server certificate covering hosts. Entries that parse as an IP address become IP SANs; the rest become DNS SANs.
The validity window starts an hour in the past, so a certificate is usable immediately on a host whose clock runs slightly behind the issuer's.