Encrypted DNS health, comparing a zone's views, --local everywhere

jarld checks the DoT and DoH listeners every 10 minutes as a client would (page, dashboard, jarl encrypted-dns health, jarl_encrypted_dns_up). The Compare views tab and jarl zone diff show what differs between a zone's views, with Use this version. --local works on unlinked zones. A changed certificates.dir is followed by encrypted DNS's tls statements. Sharing an already shared version replaces other views' overrides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-12 20:46:56 +01:00
1 parent 67ae0091b3
commit 13ffd8cad4
31 files changed
+1153 -18

No files matched your search

+35
View File
@@ -22,6 +22,7 @@ import (
legolog "github.com/go-acme/lego/v4/log"
"jarl/internal/auth"
"jarl/internal/encdns"
"jarl/internal/engine"
"jarl/internal/model"
"jarl/internal/porkbun"
@@ -766,6 +767,40 @@ func (m *Manager) Start(ctx context.Context) {
}
}
}
m.followDir(ctx, all)
}
// followDir points the tls statements encrypted DNS wrote (jarl-NAME) at
// certificates.dir when it has changed: Start has just written the
// certificates there, and named would otherwise keep serving the old
// copies, which renewals no longer update.
func (m *Manager) followDir(ctx context.Context, all []*model.Certificate) {
st, err := m.store.LoadState(ctx)
if err != nil {
return
}
var reqs []engine.Request
for _, b := range encdns.TLSBlocks(st) {
name, ok := strings.CutPrefix(b.Name, encdns.Prefix)
if !ok || filepath.Dir(b.CertFile) == m.FilesDir(name) {
continue
}
i := slices.IndexFunc(all, func(c *model.Certificate) bool { return c.Name == name })
if i < 0 || !all[i].HasUse(model.CertUseDNS) {
continue
}
if _, err := os.Stat(filepath.Join(m.FilesDir(name), ChainFile)); err != nil {
continue // not written there (yet)
}
reqs = append(reqs, engine.NewRequest(engine.OpOptionUpdate, b.OptionID, engine.OptionInput{Value: model.Ptr(encdns.TLSValue(name, m.cfg.Dir))}))
m.log.Info("certificates.dir changed: pointing named at the new files", "tls", b.Name, "was", filepath.Dir(b.CertFile), "now", m.FilesDir(name))
}
if len(reqs) == 0 {
return
}
if _, err := m.eng.Submit(ctx, reqs, auth.System, "jarld", "certificates.dir changed: tls statements follow it", engine.ApplyOptions{}); err != nil {
m.log.Error("pointing named at the moved certificate files failed; run 'jarl encrypted-dns setup' again", "err", err)
}
}
// Run renews certificates when they are due and rereads file-source ones