Hi,
> I use worker-proxy as milter. Rspamd adds other headers such as
> x-spam-status, so it should be able to add a new x-spam-score too.
So milter headers module seems to miss support for exactly this.
However it's easily done with a bit of Lua, either by adding a "custom
routine" in milter headers module or by just calling
task:set_milter_reply() directly in a rule (things passed to this
function are merged these days so there's no particular need to use
the custom routine stuff anymore).
Milter headers "custom routine" way:
~~~
# /etc/rspamd/local.d/milter_headers.conf
use = ["my-x-spam-score"];
custom {
my-x-spam-score = <<EOD
return function(task, common_meta)
local sc = common_meta['metric_score'] or task:get_metric_score()
-- return no error
return nil,
-- header(s) to add
{['X-Spam-Score'] = string.format('%.2f', sc[1])},
-- header(s) to remove
{['X-Spam-Score'] = 1},
-- metadata to store
{}
end
EOD;
}
~~~
Lua way:
~~~
-- /etc/rspamd/rspamd.local.lua
rspamd_config.ADD_X_SPAM_SCORE = {
priority = 10,
type = 'postfilter',
callback = function(task)
local sc = string.format('%.2f', task:get_metric_score()[1])
task:set_milter_reply({
add_headers = {['X-Spam-Score'] = sc},
remove_headers = {['X-Spam-Score'] = 1},
})
end
}
~~~
Best,
-AL.