diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-04-05 17:44:59 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-04-05 17:44:59 +0100 |
commit | 2edcc63aea5fe4e5a1ffdb44d5b041284d41591e (patch) | |
tree | ad2c713e241c16a9e75020ee969d44108911d139 /src/plugins | |
parent | 0f9972509407770891054be33a70c4ff8af96fa3 (diff) | |
download | rspamd-2edcc63aea5fe4e5a1ffdb44d5b041284d41591e.tar.gz rspamd-2edcc63aea5fe4e5a1ffdb44d5b041284d41591e.zip |
[Fix] Update greylisting threshold as it can be easily dynamic
Issue: #4908
Closes: #4908
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/greylist.lua | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index 6e221b39d..b69e909f6 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -329,9 +329,11 @@ local function greylist_set(task) end end - if settings.greylist_min_score then + -- We need to update this on each scan, as it can vary per settings or be redefined dynamically + local greylist_min_score = settings.greylist_min_score or rspamd_config:get_metric_action('greylist') + if greylist_min_score then local score = task:get_metric_score('default')[1] - if score < settings.greylist_min_score then + if score < greylist_min_score then rspamd_logger.infox(task, 'Score too low - skip greylisting') if action == 'greylist' then -- We are going to accept message @@ -493,11 +495,6 @@ if opts then if settings['greylist_min_score'] then settings['greylist_min_score'] = tonumber(settings['greylist_min_score']) - else - local greylist_threshold = rspamd_config:get_metric_action('greylist') - if greylist_threshold then - settings['greylist_min_score'] = greylist_threshold - end end whitelisted_ip = lua_map.rspamd_map_add(N, 'whitelisted_ip', 'radix', |