From: Vsevolod Stakhov Date: Mon, 13 Aug 2018 14:10:58 +0000 (+0100) Subject: [Minor] Improve dkim signing debugging X-Git-Tag: 1.8.0~266 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2383b6755d011de3fa4834840f3ed4855e67255a;p=rspamd.git [Minor] Improve dkim signing debugging --- diff --git a/lualib/lua_dkim_tools.lua b/lualib/lua_dkim_tools.lua index e6ba2ea0c..832e8a3ea 100644 --- a/lualib/lua_dkim_tools.lua +++ b/lualib/lua_dkim_tools.lua @@ -178,12 +178,15 @@ local function prepare_dkim_signing(N, task, settings) lua_util.debugm(N, task, 'dkim unconfigured and fallback disabled') return false,{} end + + lua_util.debugm(N, task, 'override selector and key to %s:%s', p.key, p.selector) end if not p.selector and settings.selector_map then local data = settings.selector_map:get_key(dkim_domain) if data then p.selector = data + lua_util.debugm(N, task, 'override selector to "%s" using selector_map', p.selector) elseif not settings.try_fallback then lua_util.debugm(N, task, 'no selector for %s', dkim_domain) return false,{} @@ -194,6 +197,7 @@ local function prepare_dkim_signing(N, task, settings) local data = settings.path_map:get_key(dkim_domain) if data then p.key = data + lua_util.debugm(N, task, 'override key to "%s" using path_map', p.key) elseif not settings.try_fallback then lua_util.debugm(N, task, 'no key for %s', dkim_domain) return false,{} @@ -203,12 +207,15 @@ local function prepare_dkim_signing(N, task, settings) if not p.key then if not settings.use_redis then p.key = settings.path + lua_util.debugm(N, task, 'use default key "%s" from path', p.key) end end if not p.selector then p.selector = settings.selector + lua_util.debugm(N, task, 'use default selector "%s"', p.selector) end + p.domain = dkim_domain return true,p diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua index 38fb56363..343fb8a84 100644 --- a/src/plugins/lua/dkim_signing.lua +++ b/src/plugins/lua/dkim_signing.lua @@ -106,6 +106,8 @@ local function dkim_signing_cb(task) lua_util.debugm(N, task, "missing DKIM key for %s", rk) else p.rawkey = data + lua_util.debugm(N, task, 'found and parsed key for %s:%s in Redis', + p.domain, p.selector) do_sign() end end @@ -122,7 +124,8 @@ local function dkim_signing_cb(task) end end if settings.selector_prefix then - rspamd_logger.infox(task, "Using selector prefix %s for domain %s", settings.selector_prefix, p.domain); + rspamd_logger.infox(task, "Using selector prefix '%s' for domain '%s'", + settings.selector_prefix, p.domain); local function redis_selector_cb(err, data) if err or type(data) ~= 'string' then rspamd_logger.infox(task, "cannot make request to load DKIM selector for domain %s: %s", p.domain, err) @@ -139,7 +142,7 @@ local function dkim_signing_cb(task) {settings.selector_prefix, p.domain} -- arguments ) if not rret then - rspamd_logger.infox(task, "cannot make request to load DKIM selector for %s", p.domain) + rspamd_logger.infox(task, "cannot make request to load DKIM selector for '%s'", p.domain) end else if not p.selector then @@ -154,13 +157,16 @@ local function dkim_signing_cb(task) local exists,err = rspamd_util.file_exists(p.key) if not exists then if err and err == 'No such file or directory' then - lua_util.debugm(N, task, 'cannot read key from %s: %s', p.key, err) + lua_util.debugm(N, task, 'cannot read key from "%s": %s', p.key, err) else - rspamd_logger.warnx(N, task, 'cannot read key from %s: %s', p.key, err) + rspamd_logger.warnx(N, task, 'cannot read key from "%s": %s', p.key, err) end return false end + lua_util.debugm(N, task, 'key found at "%s", use selector "%s" for domain "%s"', + p.key, p.selector, p.domain) + do_sign() else rspamd_logger.infox(task, 'key path or dkim selector unconfigured; no signing')