From e8280c60d8dfabf8ffa146e84713db60854a46c5 Mon Sep 17 00:00:00 2001 From: Eugene Bujak Date: Wed, 13 Feb 2019 11:46:11 +0300 Subject: [PATCH] =?UTF-8?q?/tls/status=20=E2=80=94=20Add=20`not=5Fafter`?= =?UTF-8?q?=20field=20with=20a=20valid=20certificate=20expiration=20date.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.go | 1 + control.go | 1 + 2 files changed, 2 insertions(+) diff --git a/config.go b/config.go index bd026649..799fbc12 100644 --- a/config.go +++ b/config.go @@ -72,6 +72,7 @@ type tlsConfigSettings struct { // field ordering is not important -- these are for API and are recalculated on each run type tlsConfigStatus struct { + NotAfter string `yaml:"-" json:"not_after,omitempty"` StatusCertificate string `yaml:"-" json:"status_cert,omitempty"` StatusKey string `yaml:"-" json:"status_key,omitempty"` Warning string `yaml:"-" json:"warning,omitempty"` diff --git a/control.go b/control.go index 65a7077e..bd7b673c 100644 --- a/control.go +++ b/control.go @@ -1171,6 +1171,7 @@ func validateCertificates(data tlsConfig) (tlsConfig, error) { // update status if mainCert != nil { notAfter := mainCert.NotAfter + data.NotAfter = notAfter.Format(time.RFC3339) data.StatusCertificate = fmt.Sprintf("Certificate expires on %s", notAfter) //, valid for hostname %s", mainCert.NotAfter, mainCert.Subject.CommonName) if len(mainCert.DNSNames) == 1 { data.StatusCertificate += fmt.Sprintf(", valid for hostname %s", mainCert.DNSNames[0])