diff options
author | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2019-01-28 11:30:33 +0100 |
---|---|---|
committer | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2019-04-29 20:10:12 +0200 |
commit | d0b4431f818c1034a62d2754bba972a735219e6a (patch) | |
tree | 3185ad96f117568c7e498d1b6837d121bdfabe8d /lualib/lua_scanners | |
parent | 4d95a0327becd78123212a2adf0138e08c4fac7d (diff) | |
download | rspamd-d0b4431f818c1034a62d2754bba972a735219e6a.tar.gz rspamd-d0b4431f818c1034a62d2754bba972a735219e6a.zip |
[Minor] lua_scanners - try dynamic scan
Diffstat (limited to 'lualib/lua_scanners')
-rw-r--r-- | lualib/lua_scanners/clamav.lua | 8 | ||||
-rw-r--r-- | lualib/lua_scanners/dcc.lua | 8 | ||||
-rw-r--r-- | lualib/lua_scanners/fprot.lua | 8 | ||||
-rw-r--r-- | lualib/lua_scanners/icap.lua | 8 | ||||
-rw-r--r-- | lualib/lua_scanners/kaspersky_av.lua | 8 | ||||
-rw-r--r-- | lualib/lua_scanners/oletools.lua | 10 | ||||
-rw-r--r-- | lualib/lua_scanners/savapi.lua | 8 | ||||
-rw-r--r-- | lualib/lua_scanners/sophos.lua | 10 | ||||
-rw-r--r-- | lualib/lua_scanners/spamassassin.lua | 10 | ||||
-rw-r--r-- | lualib/lua_scanners/vadesecure.lua | 9 |
10 files changed, 85 insertions, 2 deletions
diff --git a/lualib/lua_scanners/clamav.lua b/lualib/lua_scanners/clamav.lua index 1ff3cdc4f..01386cfe7 100644 --- a/lualib/lua_scanners/clamav.lua +++ b/lualib/lua_scanners/clamav.lua @@ -156,6 +156,14 @@ local function clamav_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/dcc.lua b/lualib/lua_scanners/dcc.lua index e775d698b..d1bec769b 100644 --- a/lualib/lua_scanners/dcc.lua +++ b/lualib/lua_scanners/dcc.lua @@ -226,6 +226,14 @@ local function dcc_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/fprot.lua b/lualib/lua_scanners/fprot.lua index e624bc6fd..907fab139 100644 --- a/lualib/lua_scanners/fprot.lua +++ b/lualib/lua_scanners/fprot.lua @@ -149,6 +149,14 @@ local function fprot_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua index 6ddd5fee6..d00954f41 100644 --- a/lualib/lua_scanners/icap.lua +++ b/lualib/lua_scanners/icap.lua @@ -242,6 +242,14 @@ local function icap_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/kaspersky_av.lua b/lualib/lua_scanners/kaspersky_av.lua index d87f78886..87411c3b9 100644 --- a/lualib/lua_scanners/kaspersky_av.lua +++ b/lualib/lua_scanners/kaspersky_av.lua @@ -167,6 +167,14 @@ local function kaspersky_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/oletools.lua b/lualib/lua_scanners/oletools.lua index d16c1877f..236e1903c 100644 --- a/lualib/lua_scanners/oletools.lua +++ b/lualib/lua_scanners/oletools.lua @@ -225,6 +225,14 @@ local function oletools_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), @@ -263,6 +271,8 @@ local function oletools_config(opts) default_score = 1, action = false, extended = false, + symbol_type = 'postfilter', + dynamic_scan = true, } oletools_conf = lua_util.override_defaults(oletools_conf, opts) diff --git a/lualib/lua_scanners/savapi.lua b/lualib/lua_scanners/savapi.lua index 13dbb7136..65a9c825c 100644 --- a/lualib/lua_scanners/savapi.lua +++ b/lualib/lua_scanners/savapi.lua @@ -237,6 +237,14 @@ local function savapi_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/sophos.lua b/lualib/lua_scanners/sophos.lua index 159e8abdc..59facc845 100644 --- a/lualib/lua_scanners/sophos.lua +++ b/lualib/lua_scanners/sophos.lua @@ -41,9 +41,7 @@ local function sophos_config(opts) retransmits = 2, cache_expire = 3600, -- expire redis in one hour message = default_message, - savdi_report_encrypted = false, detection_category = "virus", - savdi_report_oversize = false, } sophos_conf = lua_util.override_defaults(sophos_conf, opts) @@ -159,6 +157,14 @@ local function sophos_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), diff --git a/lualib/lua_scanners/spamassassin.lua b/lualib/lua_scanners/spamassassin.lua index eae934610..2227de235 100644 --- a/lualib/lua_scanners/spamassassin.lua +++ b/lualib/lua_scanners/spamassassin.lua @@ -136,6 +136,14 @@ local function spamassassin_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + tcp.request({ task = task, host = addr:to_string(), @@ -172,6 +180,8 @@ local function spamassassin_config(opts) default_score = 1, action = false, extended = false, + symbol_type = 'postfilter', + dynamic_scan = true, } spamassassin_conf = lua_util.override_defaults(spamassassin_conf, opts) diff --git a/lualib/lua_scanners/vadesecure.lua b/lualib/lua_scanners/vadesecure.lua index 64660ff41..5c986970e 100644 --- a/lualib/lua_scanners/vadesecure.lua +++ b/lualib/lua_scanners/vadesecure.lua @@ -24,6 +24,7 @@ local http = require "rspamd_http" local upstream_list = require "rspamd_upstream_list" local rspamd_logger = require "rspamd_logger" local ucl = require "ucl" +local common = require "lua_scanners/common" local N = 'vadesecure' @@ -181,6 +182,14 @@ local function vade_check(task, content, digest, rule) end end + if rule.dynamic_scan then + local pre_check, pre_check_msg = common.check_metric_results(task, rule) + if pre_check then + rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) + return true + end + end + request_data.callback = vade_callback http.request(request_data) end |