From: Andrew Lewis Date: Wed, 17 Jan 2018 16:48:45 +0000 (+0200) Subject: [Minor] Replies: toggles for processing of local/authenticated mail X-Git-Tag: 1.7.0~267 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2943cff50867235483976ed004654a2bebe08a59;p=thirdparty%2Frspamd.git [Minor] Replies: toggles for processing of local/authenticated mail --- diff --git a/src/plugins/lua/replies.lua b/src/plugins/lua/replies.lua index 5c17efa59e..398c7b3f24 100644 --- a/src/plugins/lua/replies.lua +++ b/src/plugins/lua/replies.lua @@ -30,6 +30,8 @@ local settings = { message = 'Message is reply to one we originated', symbol = 'REPLY', score = -2, -- Default score + use_auth = true, + use_local = true, } local rspamd_logger = require 'rspamd_logger' @@ -56,7 +58,7 @@ local function replies_check(task) task:insert_result(settings['symbol'], 1.0) if settings['action'] ~= nil then local ip_addr = task:get_ip() - if task:get_user() or (ip_addr and ip_addr:is_local()) then + if (settings.use_auth and task:get_user()) or (settings.use_local and ip_addr and ip_addr:is_local()) then rspamd_logger.infox(task, "not forcing action for local network or authorized user"); else task:set_pre_result(settings['action'], settings['message']) @@ -94,7 +96,11 @@ local function replies_set(task) end -- If sender is unauthenticated return local ip = task:get_ip() - if task:get_user() == nil and not (ip and ip:is_local()) then + if settings.use_auth and task:get_user() then + rspamd_logger.debugm(N, task, 'sender is authenticated') + elseif settings.use_local and (ip and ip:is_local()) then + rspamd_logger.debugm(N, task, 'sender is from local network') + else return end -- If no message-id present return