|
|
@@ -248,7 +248,7 @@ local dkim_selector = { |
|
|
|
dependencies = {"DKIM_TRACE"}, |
|
|
|
filter = dkim_reputation_filter, -- used to get scores |
|
|
|
postfilter = dkim_reputation_postfilter, -- used to adjust DKIM scores |
|
|
|
idempotent = dkim_reputation_idempotent -- used to set scores |
|
|
|
idempotent = dkim_reputation_idempotent, -- used to set scores |
|
|
|
} |
|
|
|
|
|
|
|
-- URL Selector functions |
|
|
@@ -523,7 +523,7 @@ local ip_selector = { |
|
|
|
--dependencies = {"ASN"}, -- ASN is a prefilter now... |
|
|
|
init = ip_reputation_init, |
|
|
|
filter = ip_reputation_filter, -- used to get scores |
|
|
|
idempotent = ip_reputation_idempotent -- used to set scores |
|
|
|
idempotent = ip_reputation_idempotent, -- used to set scores |
|
|
|
} |
|
|
|
|
|
|
|
-- SPF Selector functions |
|
|
@@ -584,7 +584,7 @@ local spf_selector = { |
|
|
|
}, |
|
|
|
dependencies = {"R_SPF_ALLOW"}, |
|
|
|
filter = spf_reputation_filter, -- used to get scores |
|
|
|
idempotent = spf_reputation_idempotent -- used to set scores |
|
|
|
idempotent = spf_reputation_idempotent, -- used to set scores |
|
|
|
} |
|
|
|
|
|
|
|
-- Generic selector based on lua_selectors framework |
|
|
@@ -680,7 +680,7 @@ local generic_selector = { |
|
|
|
inbound = ts.boolean, |
|
|
|
selector = ts.string, |
|
|
|
delimiter = ts.string, |
|
|
|
whitelist = ts.string:is_optional(), |
|
|
|
whitelist = ts.one_of(lua_maps.map_schema, lua_maps_exprs.schema):is_optional(), |
|
|
|
}, |
|
|
|
config = { |
|
|
|
lower_bound = 10, -- minimum number of messages to be scored |
|
|
@@ -1122,8 +1122,36 @@ local function parse_rule(name, tbl) |
|
|
|
rule.config = lua_util.override_defaults(rule.config, tbl) |
|
|
|
|
|
|
|
if rule.config.whitelist then |
|
|
|
rule.config.whitelist_map = lua_maps_exprs.create(rspamd_config, |
|
|
|
rule.config.whitelist, N) |
|
|
|
if lua_maps_exprs.schema(rule.config.whitelist) then |
|
|
|
rule.config.whitelist_map = lua_maps_exprs.create(rspamd_config, |
|
|
|
rule.config.whitelist, N) |
|
|
|
elseif lua_maps.map_schema(rule.config.whitelist) then |
|
|
|
local map = lua_maps.map_add_from_ucl(rule.config.whitelist, |
|
|
|
'radix', |
|
|
|
sel_type .. ' reputation whitelist') |
|
|
|
|
|
|
|
if not map then |
|
|
|
rspamd_logger.errx(rspamd_config, "cannot parse whitelist map config for %s: (%s)", |
|
|
|
sel_type, |
|
|
|
rule.config.whitelist) |
|
|
|
return |
|
|
|
end |
|
|
|
|
|
|
|
rule.config.whitelist_map = { |
|
|
|
process = function(_, task) |
|
|
|
-- Hack: we assume that it is an ip whitelist :( |
|
|
|
local ip = task:get_from_ip() |
|
|
|
|
|
|
|
if ip and map:get_key(ip) then return true end |
|
|
|
return false |
|
|
|
end |
|
|
|
} |
|
|
|
else |
|
|
|
rspamd_logger.errx(rspamd_config, "cannot parse whitelist map config for %s: (%s)", |
|
|
|
sel_type, |
|
|
|
rule.config.whitelist) |
|
|
|
return |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
local symbol = rule.selector.config.symbol or name |