]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Disable IP Score for authenticated users & local networks 912/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 31 Aug 2016 06:34:14 +0000 (08:34 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 31 Aug 2016 06:34:14 +0000 (08:34 +0200)
src/plugins/lua/ip_score.lua

index a8687a1cd15c2041b29a61c4b2772386c547786f..6b6ac900a6141f57fd028bde9eb94284e85c22f9 100644 (file)
@@ -110,8 +110,11 @@ local ip_score_set = function(task)
     end
   end
 
-  local action = task:get_metric_action(options['metric'])
   local ip = task:get_from_ip()
+  if task:get_user() or (ip and ip:is_local()) then
+    return
+  end
+  local action = task:get_metric_action(options['metric'])
   if not ip or not ip:is_valid() then
     return
   end
@@ -274,6 +277,10 @@ local ip_score_check = function(task)
   end
 
   local ip = task:get_from_ip()
+  if task:get_user() or (ip and ip:is_local()) then
+    rspamd_logger.infox(task, "skip IP Score for local networks and authorized users")
+    return
+  end
   if ip:is_valid() then
     -- Check IP whitelist
     if whitelist then