local prosody = prosody;
local resolve_path = prosody.resolve_relative_path;
+local config_path = prosody.paths.config;
module "certmanager"
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;
else
log("error", "SSL/TLS: Error initialising for host %s: %s", host, err );
end
- ssl = false
end
return ctx, err;
end