diff options
author | Andrew Lewis <nerf@judo.za.org> | 2015-06-22 21:40:21 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2015-06-22 21:53:39 +0200 |
commit | 4bc4b010cfb465397c1ef995472be7fcd0cb5b09 (patch) | |
tree | 3839ed026886d8a6be13759e196230afc9148253 | |
parent | 6c62e78180c5dd39e7f3ef02eefc2751c3963926 (diff) | |
download | rspamd-4bc4b010cfb465397c1ef995472be7fcd0cb5b09.tar.gz rspamd-4bc4b010cfb465397c1ef995472be7fcd0cb5b09.zip |
Add whitelist_exception setting to RBL module
-rw-r--r-- | doc/markdown/modules/rbl.md | 5 | ||||
-rw-r--r-- | src/plugins/lua/rbl.lua | 17 |
2 files changed, 21 insertions, 1 deletions
diff --git a/doc/markdown/modules/rbl.md b/doc/markdown/modules/rbl.md index 33c3a4c18..b5f797fd3 100644 --- a/doc/markdown/modules/rbl.md +++ b/doc/markdown/modules/rbl.md @@ -105,3 +105,8 @@ an_rbl { } ~~~ +The following extra settings are valid in the RBL subsection: + +- whitelist_exception + +(For whitelists) - Symbols named as parameters for this setting will not be used for neutralising blacklists (set this multiple times to add multiple exceptions). diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index cceb00449..c524c5bf1 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -355,7 +355,22 @@ for key,rbl in pairs(opts['rbls']) do if type(rspamd_config.get_api_version) ~= 'nil' then rspamd_config:register_virtual_symbol(s, 1, id) if(rbl['is_whitelist']) then - table.insert(white_symbols, s) + if type(rbl['whitelist_exception']) == 'string' then + if (rbl['whitelist_exception'] ~= s) then + table.insert(white_symbols, s) + end + elseif type(rbl['whitelist_exception']) == 'table' then + local foundException = false + for _, e in pairs(rbl['whitelist_exception']) do + if e == s then + foundException = true + break + end + end + if not foundException then + table.insert(white_symbols, s) + end + end else table.insert(black_symbols, s) end |