aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/milter_headers.lua
diff options
context:
space:
mode:
authorAndré Peters <andryyy@users.noreply.github.com>2017-06-06 08:42:10 +0200
committerGitHub <noreply@github.com>2017-06-06 08:42:10 +0200
commit8345b82e191b77b3f664cd77948e05ee530715bc (patch)
tree9f6cac6e345c6bb67b8fe102b3a196fb84d1a60f /src/plugins/lua/milter_headers.lua
parente35294ca5f7c8a9c81e4e4288ff2b31460f91d2b (diff)
downloadrspamd-8345b82e191b77b3f664cd77948e05ee530715bc.tar.gz
rspamd-8345b82e191b77b3f664cd77948e05ee530715bc.zip
Add ability to skip local and/or authenticated
Default behavior remains.
Diffstat (limited to 'src/plugins/lua/milter_headers.lua')
-rw-r--r--src/plugins/lua/milter_headers.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index 7447cd208..6ad7957a4 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -29,6 +29,8 @@ local E = {}
local HOSTNAME = util.get_hostname()
local settings = {
+ skip_local = false,
+ skip_authenticated = false,
routines = {
['x-spamd-result'] = {
header = 'X-Spamd-Result',
@@ -105,6 +107,15 @@ local custom_routines = {}
local function milter_headers(task)
+ if settings.skip_local then
+ local ip = task:get_ip()
+ if (ip and ip:is_local()) then return end
+ end
+
+ if settings.skip_authenticated then
+ if task:get_user() ~= nil then return end
+ end
+
local routines, common, add, remove = {}, {}, {}, {}
routines['x-spamd-result'] = function()
@@ -352,6 +363,12 @@ if opts['extended_spam_headers'] then
activate_routine('x-rspamd-server')
activate_routine('x-rspamd-queue-id')
end
+if opts['skip_local'] then
+ settings.skip_local = true
+end
+if opts['skip_authenticated'] then
+ settings.skip_authenticated = true
+end
for _, s in ipairs(opts['use']) do
if not have_routine[s] then
activate_routine(s)