From 65086493687c8c09f08a6cda35a10925ff793a30 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 18 Nov 2017 20:15:19 +0100 Subject: mod_debug_sql: Declare itself as global module --- plugins/mod_debug_sql.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/mod_debug_sql.lua b/plugins/mod_debug_sql.lua index 7bbbbd88..74cc2f68 100644 --- a/plugins/mod_debug_sql.lua +++ b/plugins/mod_debug_sql.lua @@ -2,6 +2,8 @@ -- -- luacheck: ignore 213/uri +module:set_global(); + local engines = module:shared("/*/sql/connections"); for uri, engine in pairs(engines) do -- cgit v1.2.3 From 0315d775b2626b5cb62a73cf84a018f3abda0d7f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 20 Nov 2017 00:25:18 +0100 Subject: certmanager: Change table representing LuaSec capabilities to match capabilities table exposed in LuaSec 0.7 --- core/certmanager.lua | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/core/certmanager.lua b/core/certmanager.lua index 2be66a21..dd6cabae 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -37,13 +37,20 @@ local config_path = prosody.paths.config or "."; local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)"); local luasec_version = tonumber(luasec_major) * 100 + tonumber(luasec_minor); -local luasec_has = { - -- TODO If LuaSec ever starts exposing these things itself, use that instead - cipher_server_preference = luasec_version >= 2; - no_ticket = luasec_version >= 4; - no_compression = luasec_version >= 5; - single_dh_use = luasec_version >= 2; - single_ecdh_use = luasec_version >= 2; +local luasec_has = softreq"ssl.config" or { + algorithms = { + ec = luasec_version >= 5; + }; + capabilities = { + curves_list = luasec_version >= 7; + }; + options = { + cipher_server_preference = luasec_version >= 2; + no_ticket = luasec_version >= 4; + no_compression = luasec_version >= 5; + single_dh_use = luasec_version >= 2; + single_ecdh_use = luasec_version >= 2; + }; }; local _ENV = nil; @@ -99,11 +106,11 @@ local core_defaults = { protocol = "tlsv1+"; verify = (ssl_x509 and { "peer", "client_once", }) or "none"; options = { - cipher_server_preference = luasec_has.cipher_server_preference; - no_ticket = luasec_has.no_ticket; - no_compression = luasec_has.no_compression and configmanager.get("*", "ssl_compression") ~= true; - single_dh_use = luasec_has.single_dh_use; - single_ecdh_use = luasec_has.single_ecdh_use; + cipher_server_preference = luasec_has.options.cipher_server_preference; + no_ticket = luasec_has.options.no_ticket; + no_compression = luasec_has.options.no_compression and configmanager.get("*", "ssl_compression") ~= true; + single_dh_use = luasec_has.options.single_dh_use; + single_ecdh_use = luasec_has.options.single_ecdh_use; }; verifyext = { "lsec_continue", "lsec_ignore_purpose" }; curve = "secp384r1"; @@ -227,7 +234,7 @@ end local function reload_ssl_config() global_ssl_config = configmanager.get("*", "ssl"); global_certificates = configmanager.get("*", "certificates") or "certs"; - if luasec_has.no_compression then + if luasec_has.options.no_compression then core_defaults.options.no_compression = configmanager.get("*", "ssl_compression") ~= true; end end -- cgit v1.2.3 From b9005e7b8af2f0c707d9497d334fdc5318db55cc Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 20 Nov 2017 00:26:41 +0100 Subject: certmanager: Filter out curves not supported by LuaSec --- core/certmanager.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/certmanager.lua b/core/certmanager.lua index dd6cabae..e13a5d8e 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -27,6 +27,7 @@ local stat = require "lfs".attributes; local tonumber, tostring = tonumber, tostring; local pairs = pairs; +local t_remove = table.remove; local type = type; local io_open = io.open; local select = select; @@ -131,6 +132,17 @@ local core_defaults = { "!aNULL", -- Ciphers that does not authenticate the connection }; } + +if luasec_has.curves then + for i = #core_defaults.curveslist, 1, -1 do + if not luasec_has.curves[ core_defaults.curveslist[i] ] then + t_remove(core_defaults.curveslist, i); + end + end +else + core_defaults.curveslist = nil; +end + local path_options = { -- These we pass through resolve_path() key = true, certificate = true, cafile = true, capath = true, dhparam = true } -- cgit v1.2.3 From 0158bad7ad35279d64096ee86defdf4c04532ece Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 20 Nov 2017 00:27:26 +0100 Subject: certmanager: Set single curve conditioned on LuaSec advertising EC crypto support --- core/certmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/certmanager.lua b/core/certmanager.lua index e13a5d8e..f343b6d7 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -114,7 +114,7 @@ local core_defaults = { single_ecdh_use = luasec_has.options.single_ecdh_use; }; verifyext = { "lsec_continue", "lsec_ignore_purpose" }; - curve = "secp384r1"; + curve = luasec_has.algorithms.ec and not luasec_has.capabilities.curves_list and "secp384r1"; curveslist = { "X25519", "P-384", -- cgit v1.2.3