inbound-antispam-panel: the filter reads its signing key for every message
test / test (push) Canceled after 0s

The routine kept the key after its first read. SelfPost makes a new key
when the file is lost or damaged, or a backup brings back another, and
rspamd would then have gone on signing with the old one - every verdict
unrecorded - until someone restarted the sidecar. The file is one short
line; reading it per message costs nothing worth keeping a copy for.

The guide says what never needs doing: nothing of rspamd's is cleared
after a change of the lists or the key; a restart is for a change of
its own configuration only.

Prompted by the owner's question whether rspamd's cache needs clearing
(2026-10-12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mix
2026-10-12 08:42:16 +03:00
co-authored by Claude Opus 5.5
parent d398f488e2
commit 1f44e40382
3 changed files with 16 additions and 11 deletions
+2 -2
View File
@@ -96,8 +96,8 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); version
key SelfPost creates in `data/antispam/filter.key` - and the inbound log key SelfPost creates in `data/antispam/filter.key` - and the inbound log
shows a verdict only next to a signature that fits. Nothing to configure, shows a verdict only next to a signature that fits. Nothing to configure,
but the sidecar needs the new `antispam/rspamd/milter_headers.conf` and a but the sidecar needs the new `antispam/rspamd/milter_headers.conf` and a
restart after SelfPost's first start; until then accepted mail is logged restart to read it; until then accepted mail is logged as *selfpost*, with
as *selfpost*, with no verdict. no verdict.
- A full backup carries the inbound log, the filter lists and their files - A full backup carries the inbound log, the filter lists and their files
under `data/antispam/`. It does not carry the `antispam/` directory with the under `data/antispam/`. It does not carry the `antispam/` directory with the
compose fragment and the rspamd configuration - copy that from compose fragment and the rspamd configuration - copy that from
+5 -3
View File
@@ -21,16 +21,18 @@ use = ["x-spamd-result", "x-rspamd-action", "selfpost-signature"];
custom { custom {
selfpost-signature = <<EOD selfpost-signature = <<EOD
local key
return function(task, common_meta) return function(task, common_meta)
local remove = { ['X-SelfPost-Filter'] = 0 } local remove = { ['X-SelfPost-Filter'] = 0 }
if not key then -- The key is read for every message and kept nowhere: SelfPost may make a
-- new one (the file was lost, a backup was restored), and a key remembered
-- here would go on signing what SelfPost no longer accepts until someone
-- restarted this container. The file is one short line.
local key
local f = io.open('/etc/rspamd/selfpost/filter.key', 'r') local f = io.open('/etc/rspamd/selfpost/filter.key', 'r')
if f then if f then
key = f:read('*l') key = f:read('*l')
f:close() f:close()
end end
end
local qid = task:get_queue_id() local qid = task:get_queue_id()
if not key or key == '' or not qid or qid == '' then if not key or key == '' or not qid or qid == '' then
return nil, {}, remove, {} return nil, {}, remove, {}
+5 -2
View File
@@ -868,8 +868,11 @@ recompute. The key is `data/antispam/filter.key`: SelfPost creates it on its
first start with the inbound relay on, and the sidecar reads it from the first start with the inbound relay on, and the sidecar reads it from the
directory it already mounts - there is nothing to configure. If Inbound › Log directory it already mounts - there is nothing to configure. If Inbound › Log
shows *selfpost* for mail the filter did judge, the sidecar is running without shows *selfpost* for mail the filter did judge, the sidecar is running without
this file or started before the key existed: copy `antispam/rspamd/` again and this file: copy `antispam/rspamd/` again and restart the sidecar. Nothing of
restart the sidecar. rspamd's needs clearing, then or after a change of the lists or of the key: it
rereads the list files by itself and reads the key anew for every message. A
restart is needed only for a change of its own configuration - the files of
`antispam/rspamd/`.
The same directory holds The same directory holds
[multimap.conf](../deploy/antispam/rspamd/multimap.conf), the rules for the [multimap.conf](../deploy/antispam/rspamd/multimap.conf), the rules for the