Documentation
¶
Overview ¶
Package pki is the controller's internal certificate authority (§6.1, §14). It issues the agent gateway's server certificate and signs agents' client certificates from CSRs, so node private keys never leave the node.
Index ¶
- Constants
- func MarshalKeyPEM(key *ecdsa.PrivateKey) ([]byte, error)
- func NewNodeKey(hostname string) (keyPEM, csrPEM []byte, err error)
- func ParseCertPEM(b []byte) (*x509.Certificate, error)
- func PinnedTLS(pin string) *tls.Config
- func SPKIPin(certPEM []byte) (string, error)
- func VerifyByCA(caPEM, data, sig []byte) error
- type CA
Constants ¶
const ( // NodeCertValidity bounds how long a stolen node key is useful; agents renew before expiry. NodeCertValidity = 90 * 24 * time.Hour // GatewayName is in every gateway certificate. Agents that reach the // gateway through Traefik send another name (agent.<domain>, for // routing) and check the certificate for this one, so the domain can // change without new certificates. GatewayName = "syncloud-gateway" )
Variables ¶
This section is empty.
Functions ¶
func MarshalKeyPEM ¶
func MarshalKeyPEM(key *ecdsa.PrivateKey) ([]byte, error)
func NewNodeKey ¶
NewNodeKey generates a node key pair and a CSR for it (agent side).
func ParseCertPEM ¶
func ParseCertPEM(b []byte) (*x509.Certificate, error)
func PinnedTLS ¶
PinnedTLS accepts exactly the server whose leaf public key matches pin (from SPKIPin), whoever signed it: for joining a controller that only has a self-signed certificate.
func SPKIPin ¶
SPKIPin is the SHA-256 pin of a PEM certificate's public key, in curl's --pinnedpubkey form: "sha256//<base64>".
func VerifyByCA ¶ added in v1.1.0
VerifyByCA checks that sig is the signature of data by the key of the CA whose certificate is caPEM.
Types ¶
type CA ¶
type CA struct {
Cert *x509.Certificate
CertPEM []byte
// contains filtered or unexported fields
}
func LoadOrCreateCA ¶
LoadOrCreateCA loads <dir>/ca.crt and ca.key, creating them on first start.
func (*CA) ServerCert ¶
ServerCert issues a TLS server certificate for the given DNS names and IPs.