Browse Source

[Fix] Don't use whitelist/greylist maps as regexp, but as map

In whitelist & greylist module, the domain files (like spf_dkim_whitelist.inc, etc) were read as regexp map.
This caused the following false whitelists:
WHITELIST_SPF_DKIM(-3)[onmicrosoft.com]
this while only 'microsoft.com' was in the list!

Reading the maps as 'map'/'hash' instead of 'regexp' fixes the issue.
tags/1.7.0
Jean-Louis Dupond 7 years ago
parent
commit
9962233318
2 changed files with 3 additions and 3 deletions
  1. 1
    1
      src/plugins/lua/greylist.lua
  2. 2
    2
      src/plugins/lua/whitelist.lua

+ 1
- 1
src/plugins/lua/greylist.lua View File

whitelisted_ip = rspamd_map_add('greylist', 'whitelisted_ip', 'radix', whitelisted_ip = rspamd_map_add('greylist', 'whitelisted_ip', 'radix',
'Greylist whitelist ip map') 'Greylist whitelist ip map')
whitelist_domains_map = rspamd_map_add('greylist', 'whitelist_domains_url', whitelist_domains_map = rspamd_map_add('greylist', 'whitelist_domains_url',
'regexp', 'Greylist whitelist domains map')
'map', 'Greylist whitelist domains map')


redis_params = rspamd_parse_redis_server('greylist') redis_params = rspamd_parse_redis_server('greylist')
if not redis_params then if not redis_params then

+ 2
- 2
src/plugins/lua/whitelist.lua View File

rule['map'] = rspamd_config:add_map{ rule['map'] = rspamd_config:add_map{
url = rule['domains'], url = rule['domains'],
description = "Whitelist map for " .. symbol, description = "Whitelist map for " .. symbol,
type = 'regexp'
type = 'map'
} }
elseif type(rule['domains']) == 'table' then elseif type(rule['domains']) == 'table' then
-- Transform ['domain1', 'domain2' ...] to indexes: -- Transform ['domain1', 'domain2' ...] to indexes:
rule['map'] = rspamd_config:add_map{ rule['map'] = rspamd_config:add_map{
url = rule['domains'], url = rule['domains'],
description = "Whitelist map for " .. symbol, description = "Whitelist map for " .. symbol,
type = 'regexp'
type = 'map'
} }
end end
else else

Loading…
Cancel
Save