Documentation
¶
Overview ¶
Package ca is the Controller's certificate authority. It signs Node client certificates from the CSRs Agents send at enrollment and rotation, and the Controller's own certificate for the Agent listeners. Its private key lives only in the Controller's data directory.
Index ¶
- Constants
- Variables
- func NodeIDFromCert(cert *x509.Certificate) (uuid.UUID, error)
- func NodeURI(nodeID uuid.UUID) *url.URL
- func SerialHex(cert *x509.Certificate) string
- type CA
- func (c *CA) Certificate() *x509.Certificate
- func (c *CA) Pin() []byte
- func (c *CA) PinHex() string
- func (c *CA) Pool() *x509.CertPool
- func (c *CA) ServerCertificate(names []string) (der []byte, key crypto.Signer, notAfter time.Time, err error)
- func (c *CA) SignNode(nodeID uuid.UUID, csrDER []byte) (NodeCert, error)
- type NodeCert
Constants ¶
const ( // NodeCertValidity is how long a Node certificate is valid. Agents renew // at two thirds of it. NodeCertValidity = 90 * 24 * time.Hour )
Variables ¶
var ErrBadCSR = errors.New("invalid certificate signing request")
ErrBadCSR is returned for a CSR that is malformed, carries a bad signature or uses a key type the CA does not accept.
Functions ¶
func NodeIDFromCert ¶
func NodeIDFromCert(cert *x509.Certificate) (uuid.UUID, error)
NodeIDFromCert returns the Node ID a certificate this CA issued names.
func SerialHex ¶
func SerialHex(cert *x509.Certificate) string
SerialHex returns a certificate's serial as stored in the database.
Types ¶
type CA ¶
type CA struct {
// contains filtered or unexported fields
}
CA signs certificates with the Controller's CA key.
func LoadOrCreate ¶
LoadOrCreate loads the CA from dir, creating it on first start. now may be nil for time.Now.
func (*CA) Certificate ¶
func (c *CA) Certificate() *x509.Certificate
Certificate returns the CA certificate.
func (*CA) Pin ¶
Pin returns the SHA-256 of the CA's SubjectPublicKeyInfo, the value enrollment tokens carry.
func (*CA) ServerCertificate ¶
func (c *CA) ServerCertificate(names []string) (der []byte, key crypto.Signer, notAfter time.Time, err error)
ServerCertificate issues the Controller's certificate for the Agent listeners, for a fresh key it returns as well.