mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
csr: correctly handle backdating of short lived certs
This change updates the backdating logic to only be applied to the NotBefore date and not the NotAfter date when the certificate is short lived. Thus when such a certificate is issued, it will not be immediately expired. Long lived certificates continue to have the same lifetime as before. Consolidated all certificate lifetime logic into the PermissiveSigningPolicy.policy method. Signed-off-by: Monis Khan <mok@vmware.com>
This commit is contained in:
@@ -298,14 +298,14 @@ func (s *csrSimulator) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
ca := &authority.CertificateAuthority{
|
||||
Certificate: s.serverCA,
|
||||
PrivateKey: s.serverPrivateKey,
|
||||
Backdate: s.backdate,
|
||||
}
|
||||
cr, err := capihelper.ParseCSR(csr.Spec.Request)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
der, err := ca.Sign(cr.Raw, authority.PermissiveSigningPolicy{
|
||||
TTL: time.Hour,
|
||||
TTL: time.Hour,
|
||||
Backdate: s.backdate,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Reference in New Issue
Block a user