Revoke a removed node's certificate, and require --api-client with a mirror's mutual TLS

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 10:34:35 +02:00
1 parent fe5b7f88f0
commit 9b61bbc983
16 files changed
+268 -32

No files matched your search

+9 -1
View File
@@ -48,6 +48,14 @@ const CAValidity = 10 * 365 * 24 * time.Hour
// enough to be calm, short enough that a leaked key is not permanent.
const LeafValidity = 365 * 24 * time.Hour
// Backdate is how far before its issue a certificate is valid from, to
// tolerate clock skew across the fleet.
const Backdate = time.Hour
// IssuedAt is when this authority issued a certificate: its NotBefore, less
// the backdating. What a node's revocation is compared against.
func IssuedAt(cert *x509.Certificate) time.Time { return cert.NotBefore.Add(Backdate) }
// NewCA creates an authority.
func NewCA(commonName string) (*CA, error) {
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
@@ -156,7 +164,7 @@ func (ca *CA) issue(commonName string, hosts []string, usage x509.ExtKeyUsage) (
tmpl := &x509.Certificate{
SerialNumber: serial,
Subject: pkix.Name{CommonName: commonName},
NotBefore: time.Now().Add(-time.Hour),
NotBefore: time.Now().Add(-Backdate),
NotAfter: time.Now().Add(LeafValidity),
KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment,
ExtKeyUsage: []x509.ExtKeyUsage{usage},