From 9ce38db01264f7f3385e39912306838fbcb9f58e Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Wed, 21 Sep 2022 14:05:59 +0900 Subject: [PATCH] Use constant instead of value for cert duration Signed-off-by: Masashi Honma --- pki/cert/cert.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pki/cert/cert.go b/pki/cert/cert.go index 7af1a5f3..fbb8895a 100644 --- a/pki/cert/cert.go +++ b/pki/cert/cert.go @@ -149,7 +149,7 @@ func GenerateSelfSignedCertKey(host string, alternateIPs []net.IP, alternateDNS CommonName: fmt.Sprintf("%s-ca@%d", host, time.Now().Unix()), }, NotBefore: time.Now(), - NotAfter: time.Now().Add(time.Hour * 24 * 365), + NotAfter: time.Now().Add(duration365d), KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, BasicConstraintsValid: true, @@ -177,7 +177,7 @@ func GenerateSelfSignedCertKey(host string, alternateIPs []net.IP, alternateDNS CommonName: fmt.Sprintf("%s@%d", host, time.Now().Unix()), }, NotBefore: time.Now(), - NotAfter: time.Now().Add(time.Hour * 24 * 365), + NotAfter: time.Now().Add(duration365d), KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},