aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_util.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-01 16:11:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-01 16:11:45 +0100
commit8b14fbab1e094fe8db43ce83afeea52bf83b7dc5 (patch)
tree2444ce7fce664259a1f0d6bac0edd4a8a78a3312 /lualib/lua_util.lua
parent66394a369f95e83bec1646f73bebccd106858bb2 (diff)
downloadrspamd-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 'lualib/lua_util.lua')
-rw-r--r--lualib/lua_util.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 387952fef..c401610d5 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -135,4 +135,13 @@ exports.remove_email_aliases = function(email_addr)
end
end
+exports.is_rspamc_or_controller = function(task)
+ local ua = task:get_request_header('User-Agent') or ''
+ local pwd = task:get_request_header('Password')
+ local is_rspamc = false
+ if tostring(ua) == 'rspamc' or pwd then is_rspamc = true end
+
+ return is_rspamc
+end
+
return exports