aboutsummaryrefslogtreecommitdiffstats
path: root/core/certmanager.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-28 15:00:43 +0100
committerKim Alvefur <zash@zash.se>2012-12-28 15:00:43 +0100
commit71f54b16f9bf4a2561f80058affb049850c90327 (patch)
tree0203d6bd6df69296fe7defc78a44293a3e08767d /core/certmanager.lua
parent4cb252484ceeac4c8ae6ae2896e58816f83266e9 (diff)
downloadprosody-71f54b16f9bf4a2561f80058affb049850c90327.tar.gz
prosody-71f54b16f9bf4a2561f80058affb049850c90327.zip
core.certmanager: Add support for LuaSec 0.5. Also compat with MattJs luasec-hg
Diffstat (limited to 'core/certmanager.lua')
-rw-r--r--core/certmanager.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/certmanager.lua b/core/certmanager.lua
index 20a6d609..a9f8b644 100644
--- a/core/certmanager.lua
+++ b/core/certmanager.lua
@@ -17,10 +17,11 @@ local prosody = prosody;
local resolve_path = configmanager.resolve_relative_path;
local config_path = prosody.paths.config;
-local luasec_has_noticket;
+local luasec_has_noticket, luasec_has_verifyext;
if ssl then
local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)");
luasec_has_noticket = tonumber(luasec_major)>0 or tonumber(luasec_minor)>=4;
+ luasec_has_verifyext = tonumber(luasec_major)>0 or tonumber(luasec_minor)>=5;
end
module "certmanager"
@@ -28,8 +29,16 @@ module "certmanager"
-- Global SSL options if not overridden per-host
local default_ssl_config = configmanager.get("*", "core", "ssl");
local default_capath = "/etc/ssl/certs";
-local default_verify = (ssl and ssl.x509 and { "peer", "client_once", "continue", "ignore_purpose" }) or "none";
+local default_verify = (ssl and ssl.x509 and { "peer", "client_once", }) or "none";
local default_options = { "no_sslv2", luasec_has_noticket and "no_ticket" or nil };
+local default_verifyext = { "lsec_continue", "lsec_ignore_purpose" };
+
+if not luasec_has_verifyext and ssl.x509 then
+ -- COMPAT mw/luasec-hg
+ for i=1,#default_verifyext do -- Remove lsec_ prefix
+ default_verify[#default_verify+1] = default_verifyext[i]:sub(6);
+ end
+end
function create_context(host, mode, user_ssl_config)
user_ssl_config = user_ssl_config or default_ssl_config;
@@ -46,6 +55,7 @@ function create_context(host, mode, user_ssl_config)
capath = resolve_path(config_path, user_ssl_config.capath or default_capath);
cafile = resolve_path(config_path, user_ssl_config.cafile);
verify = user_ssl_config.verify or default_verify;
+ verifyext = user_ssl_config.verifyext or default_verifyext;
options = user_ssl_config.options or default_options;
depth = user_ssl_config.depth;
};