commit 46f70b9: [Feature] Dkim_signing: Allow to use new options as maps

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Apr 9 11:07:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-09 12:05:18 +0100
URL: https://github.com/rspamd/rspamd/commit/46f70b9b36d859a3df113d4286d2b40ff11b0632 (HEAD -> master)

[Feature] Dkim_signing: Allow to use new options as maps

---
 src/plugins/lua/arc.lua          | 15 +++++++++++----
 src/plugins/lua/dkim_signing.lua | 15 +++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua
index 88c3df085..d3fe818da 100644
--- a/src/plugins/lua/arc.lua
+++ b/src/plugins/lua/arc.lua
@@ -23,6 +23,7 @@ local rspamd_rsa = require "rspamd_rsa"
 local fun = require "fun"
 local auth_results = require "lua_auth_results"
 local hash = require "rspamd_cryptobox_hash"
+local lua_maps = require "lua_maps"
 
 if confighelp then
   return
@@ -622,21 +623,27 @@ end
 
 for k,v in pairs(opts) do
   if k == 'sign_networks' then
-    settings[k] = rspamd_map_add(N, k, 'radix', 'DKIM signing networks')
+    settings[k] = lua_maps.map_add(N, k, 'radix', 'DKIM signing networks')
   elseif k == 'path_map' then
-    settings[k] = rspamd_map_add(N, k, 'map', 'Paths to DKIM signing keys')
+    settings[k] = lua_maps.map_add(N, k, 'map', 'Paths to DKIM signing keys')
   elseif k == 'selector_map' then
-    settings[k] = rspamd_map_add(N, k, 'map', 'DKIM selectors')
+    settings[k] = lua_maps.map_add(N, k, 'map', 'DKIM selectors')
+  elseif k == 'signing_table' then
+    settings[k] = lua_maps.map_add(N, k, 'glob', 'DKIM signing table')
+  elseif k == 'key_table' then
+    settings[k] = lua_maps.map_add(N, k, 'glob', 'DKIM keys table')
   else
     settings[k] = v
   end
 end
+
 if not (settings.use_redis or
     settings.path or
     settings.domain or
     settings.path_map or
     settings.selector_map or
-    settings.use_http_headers) then
+    settings.use_http_headers or
+    (settings.signing_table and settings.key_table)) then
   rspamd_logger.infox(rspamd_config, 'mandatory parameters missing, disable arc signing')
   return
 end
diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua
index 9b1bfef32..68b19673b 100644
--- a/src/plugins/lua/dkim_signing.lua
+++ b/src/plugins/lua/dkim_signing.lua
@@ -19,6 +19,7 @@ local lua_util = require "lua_util"
 local rspamd_logger = require "rspamd_logger"
 local dkim_sign_tools = require "lua_dkim_tools"
 local lua_redis = require "lua_redis"
+local lua_maps = require "lua_maps"
 
 if confighelp then
   return
@@ -173,21 +174,27 @@ local opts =  rspamd_config:get_all_opt('dkim_signing')
 if not opts then return end
 for k,v in pairs(opts) do
   if k == 'sign_networks' then
-    settings[k] = rspamd_map_add(N, k, 'radix', 'DKIM signing networks')
+    settings[k] = lua_maps.map_add(N, k, 'radix', 'DKIM signing networks')
   elseif k == 'path_map' then
-    settings[k] = rspamd_map_add(N, k, 'map', 'Paths to DKIM signing keys')
+    settings[k] = lua_maps.map_add(N, k, 'map', 'Paths to DKIM signing keys')
   elseif k == 'selector_map' then
-    settings[k] = rspamd_map_add(N, k, 'map', 'DKIM selectors')
+    settings[k] = lua_maps.map_add(N, k, 'map', 'DKIM selectors')
+  elseif k == 'signing_table' then
+    settings[k] = lua_maps.map_add(N, k, 'glob', 'DKIM signing table')
+  elseif k == 'key_table' then
+    settings[k] = lua_maps.map_add(N, k, 'glob', 'DKIM keys table')
   else
     settings[k] = v
   end
 end
+
 if not (settings.use_redis or
     settings.path or
     settings.domain or
     settings.path_map or
     settings.selector_map or
-    settings.use_http_headers) then
+    settings.use_http_headers or
+    (settings.signing_table and settings.key_table)) then
   rspamd_logger.infox(rspamd_config, 'mandatory parameters missing, disable dkim signing')
   lua_util.disable_module(N, "config")
   return


More information about the Commits mailing list