diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-12-18 20:11:54 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-12-18 20:12:18 +0000 |
commit | 67df38390fca215c7b7f3e9789227a1305636f22 (patch) | |
tree | c9ab104169101e08c1acece5afc98a54af787b79 /src | |
parent | 8b8bbde1fe15d4d4fe220e63f4dd0b48aafbfba7 (diff) | |
download | rspamd-67df38390fca215c7b7f3e9789227a1305636f22.tar.gz rspamd-67df38390fca215c7b7f3e9789227a1305636f22.zip |
[Fix] Do not expose spamtrap messages to SMTP reply
Issue: #1964
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/spamtrap.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/lua/spamtrap.lua b/src/plugins/lua/spamtrap.lua index af2523187..2e8c26238 100644 --- a/src/plugins/lua/spamtrap.lua +++ b/src/plugins/lua/spamtrap.lua @@ -21,6 +21,7 @@ local rspamd_logger = require "rspamd_logger" local redis_params local use_redis = false; local M = 'spamtrap' +local lutil = require "lua_util" local settings = { symbol = 'SPAMTRAP', @@ -31,7 +32,7 @@ local settings = { fuzzy_weight = 10.0, key_prefix = 'sptr_', check_authed = true, - check_local = true + check_local = true, } local function spamtrap_cb(task) @@ -61,8 +62,19 @@ local function spamtrap_cb(task) rcpt) if settings['action'] then - task:set_pre_result(settings['action'], - string.format('spamtrap found: <%s>', rcpt)) + rspamd_logger.infox(task, 'spamtrap found: <%s>', rcpt) + if settings.smtp_message then + task:set_pre_result(settings['action'], + lutil.template(settings.smtp_message, {rcpt = rcpt})) + else + local smtp_message = 'unknown error' + if settings.action == 'no action' then + smtp_message = 'message accepted' + elseif settings.action == 'reject' then + smtp_message = 'message rejected' + end + task:set_pre_result(settings['action'], smtp_message) + end end end |