aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/spamtrap.lua
diff options
context:
space:
mode:
authorChristian Roessner <c@roessner-network-solutions.com>2017-10-26 12:56:41 +0200
committerChristian Roessner <c@roessner-network-solutions.com>2017-10-26 12:56:41 +0200
commit3ae6262209c01ead76e041245549fb3c47487a0a (patch)
treec5a20e67824e182e3ebe45a17b783a68ded083e7 /src/plugins/lua/spamtrap.lua
parentd2626012b388d389188bbbafb84654294e127fb2 (diff)
downloadrspamd-3ae6262209c01ead76e041245549fb3c47487a0a.tar.gz
rspamd-3ae6262209c01ead76e041245549fb3c47487a0a.zip
[Minor] Added check_authed and check_local for spamtrap
Diffstat (limited to 'src/plugins/lua/spamtrap.lua')
-rw-r--r--src/plugins/lua/spamtrap.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/lua/spamtrap.lua b/src/plugins/lua/spamtrap.lua
index 33805b592..af2523187 100644
--- a/src/plugins/lua/spamtrap.lua
+++ b/src/plugins/lua/spamtrap.lua
@@ -29,14 +29,24 @@ local settings = {
learn_spam = false,
fuzzy_flag = 1,
fuzzy_weight = 10.0,
- key_prefix = 'sptr_'
+ key_prefix = 'sptr_',
+ check_authed = true,
+ check_local = true
}
local function spamtrap_cb(task)
local rcpts = task:get_recipients('smtp')
+ local authed_user = task:get_user()
+ local ip_addr = task:get_ip()
local called_for_domain = false
local target
+ if ((not settings['check_authed'] and authed_user) or
+ (not settings['check_local'] and ip_addr and ip_addr:is_local())) then
+ rspamd_logger.infox(task, "skip spamtrap checks for local networks or authenticated user");
+ return
+ end
+
local function do_action(rcpt)
if settings['learn_fuzzy'] then
rspamd_plugins.fuzzy_check.learn(task,