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
+9 -7
View File
@@ -21,15 +21,17 @@ use = ["x-spamd-result", "x-rspamd-action", "selfpost-signature"];
custom {
selfpost-signature = <<EOD
local key
return function(task, common_meta)
local remove = { ['X-SelfPost-Filter'] = 0 }
if not key then
local f = io.open('/etc/rspamd/selfpost/filter.key', 'r')
if f then
key = f:read('*l')
f:close()
end
-- 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')
if f then
key = f:read('*l')
f:close()
end
local qid = task:get_queue_id()
if not key or key == '' or not qid or qid == '' then