diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-11-07 12:53:53 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-11-07 12:54:14 +0000 |
commit | 9fd0db56f8e755d2be7473891f5645a9994f7ebd (patch) | |
tree | b702b33d0c6365b2e3dc29e1f7e2d4f33e62bb53 /src/plugins/lua/bimi.lua | |
parent | 49768177cfb52e9bf9ea3c5376d26d1247c73b3a (diff) | |
download | rspamd-9fd0db56f8e755d2be7473891f5645a9994f7ebd.tar.gz rspamd-9fd0db56f8e755d2be7473891f5645a9994f7ebd.zip |
[Project] BIMI: Fix helper integration issues
Diffstat (limited to 'src/plugins/lua/bimi.lua')
-rw-r--r-- | src/plugins/lua/bimi.lua | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/lua/bimi.lua b/src/plugins/lua/bimi.lua index 9cd3d0ac8..a2846c56e 100644 --- a/src/plugins/lua/bimi.lua +++ b/src/plugins/lua/bimi.lua @@ -176,7 +176,7 @@ local function make_helper_request(task, domain, record, redis_server) sync = is_sync, redis_server = redis_server, redis_prefix = settings.redis_prefix, - redis_expiry = settings.redis_min_expiry, + redis_expiry = settings.redis_min_expiry * 1000.0, -- helper accepts milliseconds domain = domain } @@ -207,12 +207,24 @@ local function check_bimi_vmc(task, domain, record) else if type(data) == 'string' then -- We got a cached record, good stuff + lua_util.debugm(N, task, "got valid cached BIMI result for domain: %s", + domain) process_bimi_json(task, domain, data) else -- Get server addr + port - -- TODO: add db/password support maybe? - local redis_server = string.format('redis://%s', - upstream:get_addr():to_string(true)) + -- We need to fix IPv6 address as redis-rs has no support of + -- the braced IPv6 addresses + local db, password = '', '' + if redis_params.db then + db = string.format('/%s', redis_params.db) + end + if redis_params.password then + password = string.format(':%s@', redis_params.password) + end + local redis_server = string.format('redis://%s%s:%s%s', + password, + upstream:get_name(), upstream:get_port(), + db) make_helper_request(task, domain, record, redis_server) end end |