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

+7 -1
View File
@@ -4,6 +4,9 @@ import (
"context"
"crypto/x509"
"net/http"
"time"
"gitea.mynodes.xyz/ilker/llmgw/internal/tlsconf"
)
// peerKey carries the verified client identity through to the stream handler.
@@ -21,6 +24,9 @@ type PeerIdentity struct {
// Verified is false when the connection carried no client certificate,
// which only happens when TLS is switched off.
Verified bool
// IssuedAt is when the certificate was issued, for revocation: one issued
// for a node before it was removed is refused.
IssuedAt time.Time
}
// WithPeerIdentity records a verified identity on the context.
@@ -53,5 +59,5 @@ func AuthMiddleware(next http.Handler) http.Handler {
}
func identityOf(cert *x509.Certificate) PeerIdentity {
return PeerIdentity{CommonName: cert.Subject.CommonName, Verified: true}
return PeerIdentity{CommonName: cert.Subject.CommonName, Verified: true, IssuedAt: tlsconf.IssuedAt(cert)}
}