diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-20 10:54:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-20 10:54:46 +0000 |
commit | 515f3058be8517691a7bf171a2b0e5949e18f2ee (patch) | |
tree | c9f747126eecda607f1f39f84afca75ec732bf07 | |
parent | 27801290025f0af9f1223f89be7f1f6bc2a42cb4 (diff) | |
parent | 23e542a8674b867fc2789239f74d8d63e139de44 (diff) | |
download | rspamd-515f3058be8517691a7bf171a2b0e5949e18f2ee.tar.gz rspamd-515f3058be8517691a7bf171a2b0e5949e18f2ee.zip |
Merge pull request #2094 from moisseev/spam_flag
[Feature] Remove upstream `X-Spam: Yes` header by default
-rw-r--r-- | conf/modules.d/milter_headers.conf | 1 | ||||
-rw-r--r-- | rules/regexp/upstream_spam_filters.lua | 2 | ||||
-rw-r--r-- | src/plugins/lua/milter_headers.lua | 8 |
3 files changed, 10 insertions, 1 deletions
diff --git a/conf/modules.d/milter_headers.conf b/conf/modules.d/milter_headers.conf index e01d6e0f4..99892f8af 100644 --- a/conf/modules.d/milter_headers.conf +++ b/conf/modules.d/milter_headers.conf @@ -18,6 +18,7 @@ milter_headers { # Refer to https://rspamd.com/doc/modules/milter_headers.html for information on configuration use = []; + remove_upstream_spam_flag = true; # Compatibility .include(try=true,priority=5) "${DBDIR}/dynamic/rmilter_headers.conf" diff --git a/rules/regexp/upstream_spam_filters.lua b/rules/regexp/upstream_spam_filters.lua index fbb41db5d..dc0f14bcd 100644 --- a/rules/regexp/upstream_spam_filters.lua +++ b/rules/regexp/upstream_spam_filters.lua @@ -41,7 +41,7 @@ reconf['AOL_SPAM'] = { } reconf['SPAM_FLAG'] = { - re = 'X-Spam-Flag=/^(?:yes|true)/Hi', + re = string.format('%s || %s', 'X-Spam-Flag=/^(?:yes|true)/Hi', 'X-Spam=/^yes$/Hi'), score = 5, description = "Message was already marked as spam", group = 'upstream_spam_filters' diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index f5f8fe604..6f8638f58 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -57,6 +57,9 @@ local settings = { header = 'X-Rspamd-Queue-Id', remove = 1, }, + ['remove-spam-flag'] = { + header = 'X-Spam', + }, ['spam-header'] = { header = 'Deliver-To', value = 'Junk', @@ -295,6 +298,10 @@ local function milter_headers(task) spam_header('spam-header', settings.routines['spam-header'].header, settings.routines['spam-header'].value, settings.routines['spam-header'].remove) end + routines['remove-spam-flag'] = function() + remove[settings.routines['remove-spam-flag'].header] = 1 + end + routines['x-virus'] = function() if skip_wanted('x-virus') then return end if not common.symbols_hash then @@ -442,6 +449,7 @@ local function activate_routine(s) logger.errx(rspamd_config, 'routine "%s" does not exist', s) end end +if opts['remove_upstream_spam_flag'] then activate_routine('remove-spam-flag') end if opts['extended_spam_headers'] then activate_routine('x-spamd-result') activate_routine('x-rspamd-server') |