From 439a62a8538bca21d08d3135c5a833e601bfec8b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 5 Feb 2016 15:03:39 +0100 Subject: certmanager: Apply global ssl config later so certificate/key is not overwritten by magic --- core/certmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/certmanager.lua') diff --git a/core/certmanager.lua b/core/certmanager.lua index b1ff648d..f6715998 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -120,7 +120,6 @@ end local function create_context(host, mode, ...) local cfg = new_config(); cfg:apply(core_defaults); - cfg:apply(global_ssl_config); local service_name, port = host:match("^(%w+) port (%d+)$"); if service_name then cfg:apply(find_service_cert(service_name, tonumber(port))); @@ -132,6 +131,7 @@ local function create_context(host, mode, ...) -- We can't read the password interactively when daemonized password = function() log("error", "Encrypted certificate for %s requires 'ssl' 'password' to be set in config", host); end; }); + cfg:apply(global_ssl_config); for i = select('#', ...), 1, -1 do cfg:apply(select(i, ...)); -- cgit v1.2.3 From ef1ad262f7fcf3d53c16b79cfbb4e067a19adea3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 5 Feb 2016 16:12:01 +0100 Subject: certmanager: Try filename.key if certificate is set to a full filename ending with .crt --- core/certmanager.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'core/certmanager.lua') diff --git a/core/certmanager.lua b/core/certmanager.lua index f6715998..978a9efc 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -63,14 +63,13 @@ local function find_cert(user_certs, name) local key_path = certs .. key_try[i]:format(name); if stat(crt_path, "mode") == "file" then - if stat(key_path, "mode") == "file" then - return { certificate = crt_path, key = key_path }; - end if key_path:sub(-4) == ".crt" then key_path = key_path:sub(1, -4) .. "key"; if stat(key_path, "mode") == "file" then return { certificate = crt_path, key = key_path }; end + elseif stat(key_path, "mode") == "file" then + return { certificate = crt_path, key = key_path }; end end end -- cgit v1.2.3