X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Fcertmanager.lua;h=eadddd788965ce59350d1cc2f18835360ee9596c;hb=53be063a01cfd442e5aab98ba79ddd8a87ea5ea9;hp=ff5506a3464983d268fe0f4783230011fb9efd9c;hpb=024389547f9eaccde947244239288b83fc81252e;p=prosody.git diff --git a/core/certmanager.lua b/core/certmanager.lua index ff5506a3..eadddd78 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -15,6 +15,7 @@ local setmetatable, tostring = setmetatable, tostring; local prosody = prosody; local resolve_path = prosody.resolve_relative_path; +local config_path = prosody.paths.config; module "certmanager" @@ -25,16 +26,17 @@ local default_capath = "/etc/ssl/certs"; function create_context(host, mode, config) local user_ssl_config = config and config.core.ssl or default_ssl_config; - if not(ssl and user_ssl_config) then return nil; end + if not ssl then return nil, "LuaSec (required for encryption) was not found"; end + if not user_ssl_config then return nil, "No SSL/TLS configuration present for "..host; end local ssl_config = { mode = mode; protocol = user_ssl_config.protocol or "sslv23"; - key = resolve_path(user_ssl_config.key); + key = resolve_path(config_path, user_ssl_config.key); password = user_ssl_config.password; - certificate = resolve_path(user_ssl_config.certificate); - capath = resolve_path(user_ssl_config.capath or default_capath); - cafile = resolve_path(user_ssl_config.cafile); + certificate = resolve_path(config_path, user_ssl_config.certificate); + 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 "none"; options = user_ssl_config.options or "no_sslv2"; ciphers = user_ssl_config.ciphers; @@ -67,7 +69,6 @@ function create_context(host, mode, config) else log("error", "SSL/TLS: Error initialising for host %s: %s", host, err ); end - ssl = false end return ctx, err; end