diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-28 15:00:43 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-28 15:00:43 +0100 |
commit | 4f4bc7973a3f9f754b4576403b9da8d304472055 (patch) | |
tree | 0203d6bd6df69296fe7defc78a44293a3e08767d /core/certmanager.lua | |
parent | 3e2a8fbe1c48e2387ab544da454132cf7c8d5d2c (diff) | |
download | prosody-4f4bc7973a3f9f754b4576403b9da8d304472055.tar.gz prosody-4f4bc7973a3f9f754b4576403b9da8d304472055.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.lua | 14 |
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; }; |