]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Greylist: Support excluding low-scoring messages from greylisting 1528/head
authorAndrew Lewis <nerf@judo.za.org>
Thu, 16 Mar 2017 19:07:35 +0000 (21:07 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Thu, 16 Mar 2017 19:07:35 +0000 (21:07 +0200)
src/plugins/lua/greylist.lua

index 407652b6e707b6e99f82b52fe0e21cbd6bb6a38d..4a155e8a5e2e701b9cb105fea40875e0034c7a22 100644 (file)
@@ -230,6 +230,19 @@ local function greylist_set(task)
   local action = task:get_metric_action('default')
   local ip = task:get_ip()
 
+  if settings.greylist_min_score then
+    local score = task:get_metric_score('default')
+    if score < settings.greylist_min_score then
+      rspamd_logger.infox(task, 'Score too low - skip greylisting')
+      if action == 'greylist' then
+        -- We are going to accept message
+        rspamd_logger.infox(task, 'Downgrading metric action from "greylist" to "no action"')
+        task:set_metric_action('default', 'no action')
+      end
+      return
+    end
+  end
+
   if task:get_user() or (ip and ip:is_local()) then
     if action == 'greylist' then
       -- We are going to accept message