aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Rosenberg <c.rosenberg@heinlein-support.de>2018-09-26 14:31:47 +0200
committerCarsten Rosenberg <c.rosenberg@heinlein-support.de>2018-09-26 14:31:47 +0200
commitbb58fb5440a4bc4dc02abbf7f61faa9bf01f17b6 (patch)
tree6062ed81f9f542fa22c5f48b2e0f369338a2fba1
parent39a49396e3572f48ba566912888a163fc750fff6 (diff)
downloadrspamd-bb58fb5440a4bc4dc02abbf7f61faa9bf01f17b6.tar.gz
rspamd-bb58fb5440a4bc4dc02abbf7f61faa9bf01f17b6.zip
[Minor] Antivirus - configureable mime_part scanning
-rw-r--r--conf/modules.d/antivirus.conf8
-rw-r--r--src/plugins/lua/antivirus.lua10
2 files changed, 14 insertions, 4 deletions
diff --git a/conf/modules.d/antivirus.conf b/conf/modules.d/antivirus.conf
index 16f38fbda..803820dbb 100644
--- a/conf/modules.d/antivirus.conf
+++ b/conf/modules.d/antivirus.conf
@@ -18,8 +18,12 @@ antivirus {
clamav {
# If set force this action if any virus is found (default unset: no action is forced)
# action = "reject";
- # if `true` only messages with non-image attachments will be checked (default true)
- attachments_only = true;
+ # message = '${SCANNER}: virus found: "${VIRUS}"';
+ # Scan mime_parts seperately - otherwise the complete mail will be transfered to AV Scanner
+ #scan_mime_parts = true;
+ # Scanning Text is suitable for some av scanner databases (e.g. Sanesecurity)
+ #scan_text_mime = false;
+ #scan_image_mime = false;
# If `max_size` is set, messages > n bytes in size are not scanned
#max_size = 20000000;
# symbol to add (add it to metric if you want non-zero weight)
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua
index 976e521f4..047035fc1 100644
--- a/src/plugins/lua/antivirus.lua
+++ b/src/plugins/lua/antivirus.lua
@@ -871,11 +871,17 @@ local function add_antivirus_rule(sym, opts)
end
return function(task)
- if rule.attachments_only then
+ if rule.scan_mime_parts then
local parts = task:get_parts() or {}
for _,p in ipairs(parts) do
- if not p:is_image() and not p:is_text() and not p:is_multipart() then
+ if (
+ (p:is_image() and rule.scan_image_mime)
+ or (p:is_text() and rule.scan_text_mime)
+ or (p:is_multipart() and rule.scan_text_mime)
+ or (not p:is_image() and not p:is_text() and not p:is_multipart())
+ ) then
+
local content = p:get_content()
if content and #content > 0 then