diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-01 16:11:45 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-01 16:11:45 +0100 |
commit | 8b14fbab1e094fe8db43ce83afeea52bf83b7dc5 (patch) | |
tree | 2444ce7fce664259a1f0d6bac0edd4a8a78a3312 /src/plugins/lua/greylist.lua | |
parent | 66394a369f95e83bec1646f73bebccd106858bb2 (diff) | |
download | rspamd-8b14fbab1e094fe8db43ce83afeea52bf83b7dc5.tar.gz rspamd-8b14fbab1e094fe8db43ce83afeea52bf83b7dc5.zip |
[Feature] Skip updates for messages scanned via controller
Rationale: controller worker is not designed to perform scan jobs,
hence, we check for `Password` header or check `User-Agent` for `rspamc`
and skip some of rules parts:
- DMARC reports
- Greylisting
- Ratelimits
- Ip score update
- Clickhouse export
Diffstat (limited to 'src/plugins/lua/greylist.lua')
-rw-r--r-- | src/plugins/lua/greylist.lua | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index 424cf5509..586661d44 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -62,6 +62,7 @@ local rspamd_logger = require "rspamd_logger" local rspamd_util = require "rspamd_util" local fun = require "fun" local hash = require "rspamd_cryptobox_hash" +local rspamd_lua_utils = require "lua_util" local function data_key(task) local cached = task:get_mempool():get_variable("grey_bodyhash") @@ -206,9 +207,7 @@ local function greylist_check(task) end_time, type) task:insert_result(settings['symbol'], 0.0, 'greylisted', end_time) - local ua = task:get_request_header('User-Agent') or '' - if tostring(ua) == 'rspamc' then return end -- Likely rspamc scan - + if rspamd_lua_utils.is_rspamc_or_controller(task) then return end if settings.message_func then task:set_pre_result('soft reject', settings.message_func(task, end_time)) @@ -310,9 +309,7 @@ local function greylist_set(task) end end - local ua = task:get_request_header('User-Agent') or '' - local is_rspamc = false - if tostring(ua) == 'rspamc' then is_rspamc = true end + local is_rspamc = rspamd_lua_utils.is_rspamc_or_controller(task) if is_whitelisted then if action == 'greylist' then |