diff options
author | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2018-03-20 14:37:17 +0100 |
---|---|---|
committer | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2018-03-20 14:37:17 +0100 |
commit | 31053e9798b02c921699deea4acc112121c436dc (patch) | |
tree | d851060afa9fc64f6c5c2f99a3884527ce43e98b /src/plugins/lua/antivirus.lua | |
parent | 1ed9e301ea0eacbd8304e6738aba5d5b121997df (diff) | |
download | rspamd-31053e9798b02c921699deea4acc112121c436dc.tar.gz rspamd-31053e9798b02c921699deea4acc112121c436dc.zip |
Respect Sophos/SAVDI FAIL212 REJ4 REJ1 Return Codes in antivirus.lua
Diffstat (limited to 'src/plugins/lua/antivirus.lua')
-rw-r--r-- | src/plugins/lua/antivirus.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index 4b69b8850..46f556c1d 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -531,6 +531,9 @@ local function sophos_check(task, rule) local bye = 'BYE\n' local function sophos_callback(err, data, conn) + rspamd_logger.errx(task, 'err: %s', err) + rspamd_logger.errx(task, 'data: %s', tostring(data)) + if err then if err == 'IO timeout' then if retransmits > 0 then @@ -554,6 +557,7 @@ local function sophos_check(task, rule) else upstream:ok() data = tostring(data) + rspamd_logger.errx(task, 'data2: %s', data) local vname = string.match(data, 'VIRUS (%S+) ') if vname then yield_result(task, rule, vname) @@ -564,6 +568,20 @@ local function sophos_check(task, rule) rspamd_logger.infox(task, '%s [%s]: message is clean', rule['symbol'], rule['type']) end save_av_cache(task, rule, 'OK') + elseif string.find(data, 'FAIL 0212') then + if rule['savdi_report_encrypted'] then + rspamd_logger.infox(task, 'Message is ENCRYPTED (0212 SOPHOS_SAVI_ERROR_FILE_ENCRYPTED): %s', data) + yield_result(task, rule, "SAVDI_FILE_ENCRYPTED") + save_av_cache(task, rule, "SAVDI_FILE_ENCRYPTED") + end + elseif string.find(data, 'REJ 4') then + if rule['savdi_report_oversize'] then + rspamd_logger.infox(task, 'Message is OVERSIZED (SSSP reject code 4): %s', data) + yield_result(task, rule, "SAVDI_FILE_OVERSIZED") + save_av_cache(task, rule, "SAVDI_FILE_OVERSIZED") + end + elseif string.find(data, 'REJ 1') then + rspamd_logger.errx(task, 'SAVDI (Protocol error (REJ 1)): %s', data) elseif string.find(data, 'ACC') or string.find(data, 'OK SSSP') then conn:add_read(sophos_callback) else @@ -866,4 +884,3 @@ if opts and type(opts) == 'table' then lua_util.disable_module(N, 'config') end end - |