postfix: no reload for a map that did not change; DNS re-checks limited (audit W6/M9)
Security audit 2026-10-17, findings W6/M9 (low), stage 4. Every application, upstream, recipient or report-address save reloaded Postfix through supervisord, and POST .../dns-recheck bypassed the five-minute cache for up to ~14 resolver queries - both at whatever rate an authenticated user pressed. - writeChanged: each generated map is written only when its content differs from the file on disk, and Postfix is reloaded only when one was (sender map, inbound maps, DMARC maps). Health's Reload configuration ends with an explicit reload (app.Service.ReloadPostfix, SenderMaps gains Reload), so it still re-reads whatever is on disk. No debounce: with unchanged saves gone, a burst is real changes Postfix must see. - auth.AllowDNSRecheck: twenty forced re-checks in 15 minutes per user; past that the outbound, inbound and settings re-check show the cached result without the "re-checked" flash, and the log says why. Tests: TestARebuildThatChangesNothingDoesNotReload, TestDNSRechecksArePerUser; the fakes gain Reload. Docs: guide § Overview and Health; CHANGELOG; plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,15 @@ import (
|
||||
// *postfix.Postfix satisfies it; tests substitute a fake.
|
||||
type SenderMaps interface {
|
||||
RebuildSenderLoginMaps(bindings []postfix.Binding) error
|
||||
// Reload has Postfix re-read its configuration whatever changed.
|
||||
Reload() error
|
||||
}
|
||||
|
||||
// ReloadPostfix has Postfix re-read its configuration. A rebuild that
|
||||
// changes no file asks no reload; Health's Reload configuration ends with
|
||||
// this one, so that it re-reads whatever is on disk.
|
||||
func (s *Service) ReloadPostfix() error {
|
||||
return s.pf.Reload()
|
||||
}
|
||||
|
||||
// Service coordinates application state across SQLite, sasldb2 and the Postfix
|
||||
|
||||
@@ -20,6 +20,8 @@ type fakeMaps struct {
|
||||
failNext bool
|
||||
}
|
||||
|
||||
func (f *fakeMaps) Reload() error { return nil }
|
||||
|
||||
func (f *fakeMaps) RebuildSenderLoginMaps(b []postfix.Binding) error {
|
||||
f.calls++
|
||||
if f.failNext {
|
||||
@@ -514,6 +516,8 @@ type overlapMaps struct {
|
||||
inside, most atomic.Int32
|
||||
}
|
||||
|
||||
func (o *overlapMaps) Reload() error { return nil }
|
||||
|
||||
func (o *overlapMaps) RebuildSenderLoginMaps([]postfix.Binding) error {
|
||||
n := o.inside.Add(1)
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user