Browse Source

[Minor] Filter artificial Received header in multimap by default

 - Also filter headers in CHECK_RECEIVED rule
tags/1.5.0
Andrew Lewis 7 years ago
parent
commit
28d3143551
2 changed files with 9 additions and 1 deletions
  1. 4
    1
      rules/misc.lua
  2. 5
    0
      src/plugins/lua/multimap.lua

+ 4
- 1
rules/misc.lua View File

-- This is main lua config file for rspamd -- This is main lua config file for rspamd


local E = {} local E = {}
local fun = require "fun"
local util = require "rspamd_util" local util = require "rspamd_util"
local rspamd_regexp = require "rspamd_regexp" local rspamd_regexp = require "rspamd_regexp"


rspamd_config.CHECK_RECEIVED = { rspamd_config.CHECK_RECEIVED = {
callback = function (task) callback = function (task)
local received = task:get_received_headers() local received = task:get_received_headers()
received = fun.filter(function(h)
return not h['artificial']
end, received):totable()
task:insert_result('RCVD_COUNT_' .. #received, 1.0) task:insert_result('RCVD_COUNT_' .. #received, 1.0)
end end
} }


rspamd_config.OMOGRAPH_URL = { rspamd_config.OMOGRAPH_URL = {
callback = function(task) callback = function(task)
local fun = require "fun"
local urls = task:get_urls() local urls = task:get_urls()


if urls then if urls then

+ 5
- 0
src/plugins/lua/multimap.lua View File

received = function() received = function()
local hdrs = task:get_received_headers() local hdrs = task:get_received_headers()
if hdrs and hdrs[1] then if hdrs and hdrs[1] then
if not rule['artificial'] then
hdrs = fun.filter(function(h)
return not h['artificial']
end, hdrs):totable()
end
for pos, h in ipairs(hdrs) do for pos, h in ipairs(hdrs) do
match_received_header(rule, pos, #hdrs, h) match_received_header(rule, pos, #hdrs, h)
end end

Loading…
Cancel
Save