Mail reverse DNS check, what Jarl adds to named.conf, lists one per line

jarld checks the reverse DNS of the public zones' MX and SPF addresses as the internet sees it, every 6 hours (Exposure page, jarl exposure mail, jarl_mail_reverse_dns_ok). The Server options page, jarl option generated and GET /options/generated list what Jarl writes into named.conf by itself; stats.rate_limit_log turns off the query-errors logging. Option lists of three or more elements are shown one per line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-12 21:02:11 +01:00
1 parent d33f573782
commit c27a6c10bd
30 files changed
+1095 -16

No files matched your search

+42
View File
@@ -82,3 +82,45 @@ func TestStatsHooksMerged(t *testing.T) {
func TestStatsHooksWithNamed(t *testing.T) {
checkWithNamed(t, sampleState(t), Extras{Stats: statsHooks()})
}
// Rate limiting's log lines go to the response log unless
// stats.rate_limit_log is off; the list of what Jarl adds says so.
func TestRateLimitLogAndGenerated(t *testing.T) {
s := sampleState(t)
for id, o := range s.Options {
if o.Name == "logging" {
delete(s.Options, id)
}
}
s.Options[20000] = &model.Option{ID: 20000, Scope: model.ScopeOptions, Name: "rate-limit", Value: "{ responses-per-second 10; log-only yes; }", Position: 20000}
p := Paths{ConfigDir: "/etc/bind/jarl", ZoneDir: "/var/lib/bind/jarl", CacheDir: "/var/cache/bind/jarl"}
conf := string(Render(s, p, Extras{Stats: statsHooks()}).File(p.MainConfig()).Content)
if !strings.Contains(conf, "category query-errors { jarl_responses; default_syslog; };") {
t.Errorf("query-errors not logged:\n%s", conf)
}
gen := GeneratedStatements(s, p, Extras{Stats: statsHooks()})
var logging *Generated
for i := range gen {
if strings.HasPrefix(gen[i].Text, "logging") {
logging = &gen[i]
}
}
if logging == nil || !strings.Contains(logging.Text, "query-errors") || !strings.Contains(logging.Setting, "stats.rate_limit_log") {
t.Errorf("generated logging = %+v (all %+v)", logging, gen)
}
if !strings.HasPrefix(gen[0].Text, "include ") || gen[0].Where != "top level" {
t.Errorf("first generated = %+v", gen[0])
}
h := statsHooks()
h.NoRateLimitLog = true
conf = string(Render(s, p, Extras{Stats: h}).File(p.MainConfig()).Content)
if strings.Contains(conf, "query-errors") || !strings.Contains(conf, "category responses") {
t.Errorf("rate_limit_log off but query-errors logged:\n%s", conf)
}
for _, g := range GeneratedStatements(s, p, Extras{Stats: h}) {
if strings.Contains(g.Text, "query-errors") {
t.Errorf("listed while off: %+v", g)
}
}
}