summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/antivirus.lua
diff options
context:
space:
mode:
authorjonmoesli <jonathan.moesli@yahoo.com>2022-11-07 18:20:35 +0100
committerjonmoesli <jonathan.moesli@yahoo.com>2022-11-07 18:20:35 +0100
commit89fb91b649428dd8177cd7f431265d8a88634f79 (patch)
tree109c3ec38aa0e408357cef337f75c7ffeddbb481 /src/plugins/lua/antivirus.lua
parent3c993db821ffa5ef5f251e15bda9da1307e618a2 (diff)
downloadrspamd-89fb91b649428dd8177cd7f431265d8a88634f79.tar.gz
rspamd-89fb91b649428dd8177cd7f431265d8a88634f79.zip
[Feature] Enable Mime part filters on antivirus module
Diffstat (limited to 'src/plugins/lua/antivirus.lua')
-rw-r--r--src/plugins/lua/antivirus.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua
index 968b24adc..39d11c8ec 100644
--- a/src/plugins/lua/antivirus.lua
+++ b/src/plugins/lua/antivirus.lua
@@ -134,6 +134,21 @@ local function add_antivirus_rule(sym, opts)
type = 'string',
})
+ -- if any mime_part filter defined, do not scan all attachments
+ if opts.mime_parts_filter_regex ~= nil
+ or opts.mime_parts_filter_ext ~= nil then
+ rule.scan_all_mime_parts = false
+ else
+ rule.scan_all_mime_parts = true
+ end
+
+ rule.patterns = common.create_regex_table(opts.patterns or {})
+ rule.patterns_fail = common.create_regex_table(opts.patterns_fail or {})
+
+ rule.mime_parts_filter_regex = common.create_regex_table(opts.mime_parts_filter_regex or {})
+
+ rule.mime_parts_filter_ext = common.create_regex_table(opts.mime_parts_filter_ext or {})
+
if opts.whitelist then
rule.whitelist = rspamd_config:add_hash_map(opts.whitelist)
end