diff options
-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') |