controller (unreleased): only certificates of the household's current domain are reported (review)
gates / gates (push) Successful in 38s

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 19:09:21 +01:00
1 parent 7daf3d24a7
commit ee3b05edd0
3 files changed
+38 -7

No files matched your search

+20 -3
View File
@@ -7,6 +7,7 @@ import (
"log"
"os"
"path/filepath"
"strings"
"time"
"gitea.dooplex.hu/admin/felhom-controller/internal/backup"
@@ -202,7 +203,7 @@ func BuildReport(
r.Offsite = backupMgr.OffboxReportStatus()
}
r.WebCerts = webCertsForReport(cfg.Paths.StacksDir, logger) // R-1379: the web certificate's end date
r.WebCerts = webCertsForReport(cfg.Paths.StacksDir, cfg.Customer.Domain, logger) // R-1379: the web certificate's end date
if debug && logger != nil {
logger.Printf("[DEBUG] [report] BuildReport: complete — containers=%d, health=%s, deployed=%d, available=%d, app_telemetry=%d",
@@ -346,7 +347,12 @@ func rootStorageEntry(sysInfo system.SystemInfo) StorageReport {
// webCertsForReport reads the end dates of the box's web certificates for the report (felhom.eu R-1379). A store that
// cannot be read is a WARN line and an absent field — never a failed report, and never the store's content in a log.
func webCertsForReport(stacksDir string, logger *log.Logger) []infra.WebCert {
//
// Only certificates for the household's CURRENT domain are reported (the name itself, `*.<domain>`, or a name under
// it). Traefik's store keeps a certificate for a name the box no longer serves — after a domain change, say — and
// that one can no longer renew: reporting it would warn the operator about a name nobody uses (review, 2026-11-14).
// With no domain configured nothing can be told apart, so everything is reported.
func webCertsForReport(stacksDir, domain string, logger *log.Logger) []infra.WebCert {
if stacksDir == "" {
return nil
}
@@ -357,5 +363,16 @@ func webCertsForReport(stacksDir string, logger *log.Logger) []infra.WebCert {
}
return nil
}
return certs
domain = strings.ToLower(strings.TrimSpace(domain))
if domain == "" {
return certs
}
var mine []infra.WebCert
for _, c := range certs {
name := strings.ToLower(c.Domain)
if name == domain || name == "*."+domain || strings.HasSuffix(name, "."+domain) {
mine = append(mine, c)
}
}
return mine
}