Blame SOURCES/0002-Correct-certificate-lifetime-calculation.patch

731278
From 87604820a935f87a8f533e3f294419d27c0514eb Mon Sep 17 00:00:00 2001
731278
From: Allison Karlitskaya <allison.karlitskaya@redhat.com>
731278
Date: Tue, 26 Oct 2021 12:32:13 +0200
731278
Subject: [PATCH 2/2] Correct certificate lifetime calculation
731278
731278
sscg allows passing the certificate lifetime, as a number of days, as a
731278
commandline argument.  It converts this value to seconds using the
731278
formula
731278
731278
  days * 24 * 3650
731278
731278
which is incorrect.  The correct value is 3600.
731278
731278
This effectively adds an extra 20 minutes to the lifetime of the
731278
certificate for each day as given on the commandline, and was enough to
731278
cause some new integration tests in cockpit to fail.
731278
731278
Interestingly, 3650 is the old default value for the number of days of
731278
certificate validity (~10 years) so this probably slipped in as a sort
731278
of muscle-memory-assisted typo.
731278
731278
Let's just write `24 * 60 * 60` to make things clear.
731278
---
731278
 src/x509.c | 2 +-
731278
 1 file changed, 1 insertion(+), 1 deletion(-)
731278
731278
diff --git a/src/x509.c b/src/x509.c
731278
index dc1594a4bdcb9d81607f0fe5ad2d4562e5edb533..7c7e4dfe56d5756862f3e0f851941e846ce96f31 100644
731278
--- a/src/x509.c
731278
+++ b/src/x509.c
731278
@@ -416,11 +416,11 @@ sscg_sign_x509_csr (TALLOC_CTX *mem_ctx,
731278
       X509_set_issuer_name (cert, X509_REQ_get_subject_name (csr));
731278
     }
731278
 
731278
   /* set time */
731278
   X509_gmtime_adj (X509_get_notBefore (cert), 0);
731278
-  X509_gmtime_adj (X509_get_notAfter (cert), days * 24 * 3650);
731278
+  X509_gmtime_adj (X509_get_notAfter (cert), days * 24 * 60 * 60);
731278
 
731278
   /* set subject */
731278
   subject = X509_NAME_dup (X509_REQ_get_subject_name (csr));
731278
   sslret = X509_set_subject_name (cert, subject);
731278
   CHECK_SSL (sslret, X509_set_subject_name);
731278
-- 
731278
2.33.0
731278