commit 0ec316f: [Minor] Allow headers addition if configured
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Nov 12 21:21:09 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-11-12 21:18:49 +0000
URL: https://github.com/rspamd/rspamd/commit/0ec316f2fe69aebdd13789c457a8db92299acad2
[Minor] Allow headers addition if configured
---
lualib/lua_scanners/cloudmark.lua | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lualib/lua_scanners/cloudmark.lua b/lualib/lua_scanners/cloudmark.lua
index bfea884cb..5993c4fe2 100644
--- a/lualib/lua_scanners/cloudmark.lua
+++ b/lualib/lua_scanners/cloudmark.lua
@@ -27,6 +27,7 @@ local ucl = require "ucl"
local rspamd_util = require "rspamd_util"
local common = require "lua_scanners/common"
local fun = require "fun"
+local lua_mime = require "lua_mime"
local N = 'cloudmark'
-- Boundary for multipart transfers, generated on module init
@@ -108,6 +109,7 @@ local function cloudmark_config(opts)
symbol_fail = 'CLOUDMARK_FAIL',
symbol = 'CLOUDMARK_CHECK',
symbol_spam = 'CLOUDMARK_SPAM',
+ add_headers = false, -- allow addition of the headers from Cloudmark
}
cloudmark_conf = lua_util.override_defaults(cloudmark_conf, opts)
@@ -225,6 +227,17 @@ local function parse_cloudmark_reply(task, rule, body)
task:insert_result(rule.symbol_spam, 1.0, tostring(score))
end
+ if rule.add_headers and type(obj.appendHeaders) == 'table' then
+ local headers_add = fun.tomap(fun.map(function(h)
+ return h.headerField,{
+ order = 1, value = h.body
+ }
+ end, obj.appendHeaders))
+ lua_mime.modify_headers(task, {
+ add = headers_add
+ })
+ end
+
end
local function cloudmark_check(task, content, digest, rule, maybe_part)
More information about the Commits
mailing list