summaryrefslogtreecommitdiff
path: root/diff.go
diff options
context:
space:
mode:
Diffstat (limited to 'diff.go')
-rw-r--r--diff.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/diff.go b/diff.go
index 24fa228..25c9028 100644
--- a/diff.go
+++ b/diff.go
@@ -80,6 +80,13 @@ func keys(m map[string]*x509.Certificate) []string {
return ret
}
+func fmtCert(cert *x509.Certificate) string {
+ return fmt.Sprintf("%s %s %s",
+ cert.Subject.CommonName,
+ cert.NotBefore.Format("2006-01-02 15:04:05 MST(-07)"),
+ cert.NotAfter.Format("2006-01-02 15:04:05 MST(-07)"))
+}
+
func main() {
if len(os.Args) != 3 {
fmt.Fprintf(os.Stderr, "Usage: %s TLS-file crt.sh-file\n", os.Args[0])
@@ -97,12 +104,12 @@ func main() {
certTLS := certsTLS[host]
certCrtSh, okCrtSh := certsCrtSh[host]
if !okCrtSh {
- fmt.Printf("-%s %s\n", host, certTLS.NotBefore.Format("2006-01-02 15:04:05 MST(-07)"))
+ fmt.Printf("-%s %s\n", host, fmtCert(certTLS))
} else if !certTLS.Equal(certCrtSh) {
- fmt.Printf("-%s %s\n", host, certTLS.NotBefore.Format("2006-01-02 15:04:05 MST(-07)"))
- fmt.Printf("+%s %s\n", host, certCrtSh.NotBefore.Format("2006-01-02 15:04:05 MST(-07)"))
+ fmt.Printf("-%s %s\n", host, fmtCert(certTLS))
+ fmt.Printf("+%s %s\n", host, fmtCert(certCrtSh))
} else {
- fmt.Printf(" %s %s\n", host, certTLS.NotBefore.Format("2006-01-02 15:04:05 MST(-07)"))
+ fmt.Printf(" %s %s\n", host, fmtCert(certTLS))
}
}
}