Documentation
¶
Overview ¶
Package pki defines management-only certificate identities and mutual TLS. Enrollment authorization and current identity resolution are caller-owned; desktop tickets and locally staged desktop tokens are not issuance authority.
Index ¶
- Constants
- Variables
- func APIClientFingerprint(cert tls.Certificate) (string, error)
- func ClientTLS(cert tls.Certificate, roots *x509.CertPool, expected Identity, ...) (*tls.Config, error)
- func ServerTLS(cert tls.Certificate, roots *x509.CertPool, enrolled Identity, ...) (*tls.Config, error)
- func TrustRoots(bundle []byte) (*x509.CertPool, error)
- func VerifiedAPIFingerprint(state tls.ConnectionState) (string, error)
- type Authority
- type AuthorizePeer
- type Identity
Constants ¶
const ( RoleGuest = "guest" RoleAPI = "api" ServerName = "management.workspace.internal" ALPN = "kw-management/1" )
const (
MaxLeafLifetime = time.Hour
)
Variables ¶
var ( ErrIdentity = errors.New("invalid management certificate identity") ErrCertificate = errors.New("invalid management certificate") ErrTrust = errors.New("management certificate trust unavailable") ErrAuthorization = errors.New("management peer authorization unavailable or denied") )
Functions ¶
func APIClientFingerprint ¶
func APIClientFingerprint(cert tls.Certificate) (string, error)
APIClientFingerprint supplies the local certificate digest bound into an issued management grant. The guest derives the same digest from its verified TLS peer, rather than trusting a fingerprint supplied in an operation request.
func ClientTLS ¶
func ClientTLS(cert tls.Certificate, roots *x509.CertPool, expected Identity, authorize AuthorizePeer) (*tls.Config, error)
ClientTLS verifies both the CA/DNS chain through Go's built-in TLS verifier and the exact enrolled guest URI identity, including provisioning and epoch. No InsecureSkipVerify/custom-chain bypass or session-resumption path exists.
func ServerTLS ¶
func ServerTLS(cert tls.Certificate, roots *x509.CertPool, enrolled Identity, authorize AuthorizePeer) (*tls.Config, error)
ServerTLS requires a trusted API client certificate and current replica authorization. It validates the local certificate against enrolled identity.
func TrustRoots ¶
TrustRoots accepts only an explicit, bounded management CA bundle. It never falls back to machine/web PKI roots. Both old and new roots may overlap during an operator-coordinated trust rotation.
func VerifiedAPIFingerprint ¶
func VerifiedAPIFingerprint(state tls.ConnectionState) (string, error)
VerifiedAPIFingerprint is valid only after a successful management handshake. It refuses unverified chains, foreign protocols and server-purpose identities.
Types ¶
type Authority ¶
type Authority struct {
// contains filtered or unexported fields
}
Authority uses a separately provisioned management CA; it never auto-generates production roots and never accepts desktop/session secrets as CA credentials.
func (*Authority) Issue ¶
func (a *Authority) Issue(csrDER []byte, identity Identity, now time.Time, lifetime time.Duration) ([]byte, error)
Issue signs an independently authorized identity after CSR proof of possession. The caller must validate/reserve a one-use enrollment credential and current workspace incarnation before calling, and persist the issued result for retry. No private guest key is received or generated here. CSR identity/extensions are rejected rather than copied into the certificate.
type AuthorizePeer ¶
AuthorizePeer must read current authoritative identity/revocation state. A CA signature alone does not authorize a reset/deleted workspace or retired API replica. The callback must fail on lookup outages and bound its own deadline.
type Identity ¶
type Identity struct {
Role string
Namespace string
WorkspaceName string
WorkspaceUID string
Generation string
RevocationEpoch uint64
ReplicaID string
}
Identity is selected from authoritative provisioning state, never from CSR subject/SAN requests. API and guest identities have disjoint fields/purposes.
func CertificateIdentity ¶
func CertificateIdentity(cert *x509.Certificate) (Identity, error)
CertificateIdentity checks the management leaf shape and extracts identity. It does not verify trust or time; peers must first pass normal TLS chain verification and the current-authorization callback.