aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-02-16 21:40:25 +0600
committerGitHub <noreply@github.com>2024-02-16 21:40:25 +0600
commit27de26f22fc358b641656c456f5e3756aa163103 (patch)
tree2bf6df16863565e1b91e8b76aa2f7726d7e9a980 /lualib
parent64c5a15ddd56ced2f87cebcfa66b2847d5ae860b (diff)
parente509f85e28176a8b8ba9a5c684c8ecc0731f9657 (diff)
downloadrspamd-27de26f22fc358b641656c456f5e3756aa163103.tar.gz
rspamd-27de26f22fc358b641656c456f5e3756aa163103.zip
Merge pull request #4806 from rspamd/vstakhov-kas-improvements
[Feature] Improve Kaspersky AS integration
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_scanners/kaspersky_se.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/lualib/lua_scanners/kaspersky_se.lua b/lualib/lua_scanners/kaspersky_se.lua
index 5e0f2eaad..10a3e0f47 100644
--- a/lualib/lua_scanners/kaspersky_se.lua
+++ b/lualib/lua_scanners/kaspersky_se.lua
@@ -48,6 +48,8 @@ local function kaspersky_se_config(opts)
scan_mime_parts = true,
scan_text_mime = false,
scan_image_mime = false,
+ keepalive = true,
+ auth_string = nil
}
default_conf = lua_util.override_defaults(default_conf, opts)
@@ -118,6 +120,15 @@ local function kaspersky_se_check(task, content, digest, rule, maybe_part)
['X-KAV-Timeout'] = tostring(rule.timeout * 1000),
}
+ local ip = task:get_from_ip()
+ if ip and ip:is_valid() then
+ hdrs['X-KAV-HostIP'] = tostring(ip)
+ end
+
+ if rule.auth_string then
+ hdrs['Authorization'] = rule.auth_string
+ end
+
if task:has_from() then
hdrs['X-KAV-ObjectURL'] = string.format('[from:%s]', task:get_from()[1].addr)
end
@@ -158,6 +169,7 @@ local function kaspersky_se_check(task, content, digest, rule, maybe_part)
body = req_body,
headers = hdrs,
timeout = rule.timeout,
+ keepalive = rule.keepalive,
}
local function kas_callback(http_err, code, body, headers)