From 3bfcf126c94f8f144714344bd6c3408f5d631ca8 Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Fri, 10 Apr 2026 14:31:48 +0300 Subject: [PATCH] [Fix] Propagate redis_timeout into nested greylist.redis{} block When Redis is configured via greylist { redis { ... } }, parse_redis_server reads opts.redis and ignores opts.timeout, so redis_timeout had no effect. Shallow-copy the nested redis subtable and set its timeout when not explicitly configured by the operator. --- src/plugins/lua/greylist.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index d9badcd502..cdfacd6891 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -574,6 +574,14 @@ if opts then -- enrich_defaults since settings.redis_timeout equals lua_redis's default_timeout (1.0). local redis_opts = lua_util.shallowcopy(opts) redis_opts.timeout = settings.redis_timeout + if redis_opts.redis then + -- When Redis is configured in a nested greylist.redis{} block, parse_redis_server + -- uses opts.redis and never reads opts.timeout, so propagate redis_timeout there too. + redis_opts.redis = lua_util.shallowcopy(redis_opts.redis) + if not redis_opts.redis.timeout then + redis_opts.redis.timeout = settings.redis_timeout + end + end redis_params = lua_redis.parse_redis_server(N, redis_opts) if not redis_params then rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module') -- 2.47.3