From: Vsevolod Stakhov Date: Fri, 11 May 2018 16:52:49 +0000 (+0100) Subject: [Feature] Add ability to add fuzzy hashes to headers X-Git-Tag: 1.7.5~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d71af0205e2004959dd506fbdd8dba6a9fc8a331;p=rspamd.git [Feature] Add ability to add fuzzy hashes to headers --- diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index d693e8f7f..73b268b2e 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -128,6 +128,9 @@ local settings = { header = 'X-Stat-Signature', remove = 1, }, + ['fuzzy-hashes'] = { + header = 'X-Rspamd-Fuzzy', + }, }, } @@ -342,7 +345,10 @@ local function milter_headers(task) end routines['spam-header'] = function() - spam_header('spam-header', settings.routines['spam-header'].header, settings.routines['spam-header'].value, settings.routines['spam-header'].remove) + spam_header('spam-header', + settings.routines['spam-header'].header, + settings.routines['spam-header'].value, + settings.routines['spam-header'].remove) end routines['remove-spam-flag'] = function() @@ -459,6 +465,16 @@ local function milter_headers(task) end end + routines['fuzzy-hashes'] = function() + local res = task:get_mempool():get_variable("fuzzy_hashes", "fstrings") + + if res and #res > 0 then + for _,h in ipairs(res) do + add_header(add[settings.routines['fuzzy-hashes'].header], h) + end + end + end + for _, n in ipairs(active_routines) do local ok, err if custom_routines[n] then