aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-26 12:17:51 +0100
committerGitHub <noreply@github.com>2017-10-26 12:17:51 +0100
commitb08a65087f4ec74b6076038d26bf084bb485973c (patch)
tree7ddaad00a17384176172e743bb6ca7ecaae2a43d
parent6018c43edb574307e114f9e6e55c39821362fe5c (diff)
parent3ae6262209c01ead76e041245549fb3c47487a0a (diff)
downloadrspamd-b08a65087f4ec74b6076038d26bf084bb485973c.tar.gz
rspamd-b08a65087f4ec74b6076038d26bf084bb485973c.zip
Merge pull request #1882 from croessner/sptr
[Minor] Added check_authed and check_local for spamtrap
-rw-r--r--conf/modules.d/spamtrap.conf4
-rw-r--r--src/plugins/lua/spamtrap.lua12
2 files changed, 15 insertions, 1 deletions
diff --git a/conf/modules.d/spamtrap.conf b/conf/modules.d/spamtrap.conf
index e6b676a5d..07c28f9c5 100644
--- a/conf/modules.d/spamtrap.conf
+++ b/conf/modules.d/spamtrap.conf
@@ -40,6 +40,10 @@ spamtrap {
#fuzy_weight = 10;
# Redis key prefix
#key_prefix = 'sptr_';
+ # Skip spamtrap checks for authorized users
+ #check_authed = false;
+ # Skip spamtrap checks for local networks
+ #check_local = false;
# !!! Disabled by default !!!
enabled = false;
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,