hub (unreleased): the end-date check reads the certificate's issuer too (the wire gate: a field the box sends must be modelled)

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 18:27:30 +01:00
1 parent 86bb912a4b
commit 0ce752a370
3 files changed
+24 -3

No files matched your search

+8 -2
View File
@@ -150,7 +150,7 @@ func (c *EndDateChecker) Check() {
r.CustomerID, wc.Domain, wc.NotAfter.UTC().Format("2006-01-02"))
}
c.logger.Printf("[WARN] end-date check: web certificate of %s for %s %s — ends %s", r.CustomerID, wc.Domain, stage, wc.NotAfter.UTC().Format(time.RFC3339))
details, _ := json.Marshal(map[string]any{"domain": wc.Domain, "not_after": wc.NotAfter.UTC().Format(time.RFC3339), "stage": stage})
details, _ := json.Marshal(map[string]any{"domain": wc.Domain, "not_after": wc.NotAfter.UTC().Format(time.RFC3339), "stage": stage, "issuer": wc.Issuer})
c.onEvent(r.CustomerID, EventWebCertEndsSoon, sev, msg, string(details), "hub")
}
}
@@ -159,6 +159,7 @@ func (c *EndDateChecker) Check() {
type webCert struct {
Domain string
NotAfter time.Time
Issuer string // the issuer's name as the box read it from the certificate; "" when it is not a plain name
}
// parseWebCerts reads `web_certs` from a controller report: at most webCertsReadMax entries, each with a plain name
@@ -169,6 +170,7 @@ func parseWebCerts(reportJSON string) []webCert {
WebCerts []struct {
Domain string `json:"domain"`
NotAfter string `json:"not_after"`
Issuer string `json:"issuer"`
} `json:"web_certs"`
}
if json.Unmarshal([]byte(reportJSON), &w) != nil {
@@ -183,7 +185,11 @@ func parseWebCerts(reportJSON string) []webCert {
if err != nil || !endDateNameRe.MatchString(c.Domain) || strings.Contains(c.Domain, "..") {
continue
}
out = append(out, webCert{Domain: c.Domain, NotAfter: at})
issuer := c.Issuer
if !endDateTokenNameRe.MatchString(issuer) {
issuer = "" // the box's word: shown only when it is a plain name
}
out = append(out, webCert{Domain: c.Domain, NotAfter: at, Issuer: issuer})
}
sort.Slice(out, func(i, j int) bool { return out[i].NotAfter.Before(out[j].NotAfter) })
return out