aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorJohn McKay <adenosine3p@gmail.com>2019-01-26 11:27:15 +0000
committerJohn McKay <adenosine3p@gmail.com>2019-02-02 05:41:41 +0000
commitd4b0d4617b022a2f6e037c027e35d04c9d8544d7 (patch)
treec02702f3486d4ef5945aa717062fd289a4263fc8 /src/plugins/lua
parenta92c5d43ef34b657bba4a2e201c3b11ded14e9e9 (diff)
downloadrspamd-d4b0d4617b022a2f6e037c027e35d04c9d8544d7.tar.gz
rspamd-d4b0d4617b022a2f6e037c027e35d04c9d8544d7.zip
keys from config and http arrayized
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/arc.lua10
-rw-r--r--src/plugins/lua/dkim_signing.lua36
2 files changed, 20 insertions, 26 deletions
diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua
index cec738df7..d22114b59 100644
--- a/src/plugins/lua/arc.lua
+++ b/src/plugins/lua/arc.lua
@@ -514,6 +514,16 @@ local function arc_signing_cb(task)
return
end
+ -- TODO: support multiple signatures here and not this hack
+ if #p.keys > 0 then
+ p.selector = p.keys[1].selector
+ if p.keys[1].type == "raw" then
+ p.rawkey = p.keys[1].key
+ else
+ p.key = p.keys[1].key
+ end
+ end
+
p.arc_cv = 'none'
p.arc_idx = 1
p.no_cache = true
diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua
index b510a437e..a65356448 100644
--- a/src/plugins/lua/dkim_signing.lua
+++ b/src/plugins/lua/dkim_signing.lua
@@ -151,35 +151,19 @@ local function dkim_signing_cb(task)
try_redis_key(p.selector)
end
else
- if ((p.key or p.rawkey) and p.selector) then
- if p.key then
+ if #p.keys > 0 then
+ for _, k in ipairs(p.keys) do
-- templates
- p.key = lua_util.template(p.key, {
+ k.key = lua_util.template(k.key, {
domain = p.domain,
- selector = p.selector
+ selector = k.selector
})
- 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)
- else
- rspamd_logger.warnx(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"',
+ -- TODO: pass this to the function instead of setting some variable
+ p.selector = k.selector
+ p.key = k.key
+ -- TODO: push handling of multiples keys into sign code
+ lua_util.debugm(N, task, 'using key "%s", use selector "%s" for domain "%s"',
p.key, p.selector, p.domain)
- end
- -- TODO: push handling of multiples keys into sign code
- if #p.keys > 0 then
- lua_util.debugm(N, task, 'signing for multiple selectors, %1', #p.keys);
- for _, k in ipairs(p.keys) do
- p.selector = k.selector
- p.key = k.key
- do_sign()
- end
- else
do_sign()
end
else
@@ -232,4 +216,4 @@ rspamd_config:register_symbol({
})
-- Add dependency on DKIM checks
-rspamd_config:register_dependency(settings['symbol'], 'DKIM_CHECK') \ No newline at end of file
+rspamd_config:register_dependency(settings['symbol'], 'DKIM_CHECK')