How kubelet-csr-approver validates CSRs
mainThe controller implements several security verifications to prevent forged certificates. A CSR is approved only if it meets the following criteria:
- Signer Name:
CSR.Spec.SignerNamemust bekubernetes.io/kubelet-serving. - Expiration:
CSR.Spec.ExpirationSecondsmust be less thanMAX_EXPIRATION_SEC. - Identity:
CSR.Spec.Usernamemust be prefixed withsystem:node:. - Common Name: The x509 CR
CommonNamemust match theCSR.Spec.Username. - SAN Count: Subject Alternative Names (SAN) must contain at most one entry (controlled by
--allowed-dns-names). - SAN Content: At least one SAN IP address or SAN DNS Name must be specified.
- Hostname Match: If a SAN DNS Name is provided, it must comply with the
--provider-regexand be prefixed by the node hostname (derived fromCSR.Spec.Username). - IP Resolution: SAN IP addresses must be part of the set of IPs resolved from the SAN DNS Name.
- Network Bounds: All SAN DNS Names and IP addresses must fall within the ranges specified by
--provider-ip-prefixes.