Changeset

7146:c793f9d13a36

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 05 Feb 2016 16:31:34 +0100
parents 7143:fa6cd0e9105d (current diff) 7145:b1a109858502 (diff)
children 7148:a461946fe865
files
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core/certmanager.lua	Fri Feb 05 00:10:46 2016 +0000
+++ b/core/certmanager.lua	Fri Feb 05 16:31:34 2016 +0100
@@ -63,14 +63,13 @@
 		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
@@ -120,7 +119,6 @@
 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 +130,7 @@
 		-- 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, ...));