certmanager: Support setting ciphers in SSL config. LuaSec apparently ignores the documented ciphers option.
authorWaqas Hussain <waqas20@gmail.com>
Thu, 25 Aug 2011 12:09:16 +0500
changeset 4359 c69cbac4178f
parent 4358 86be454168fb
child 4360 a993a4a2ea0a
certmanager: Support setting ciphers in SSL config. LuaSec apparently ignores the documented ciphers option.
core/certmanager.lua
--- a/core/certmanager.lua	Thu Aug 25 12:07:36 2011 +0500
+++ b/core/certmanager.lua	Thu Aug 25 12:09:16 2011 +0500
@@ -41,11 +41,19 @@
 		cafile = resolve_path(config_path, user_ssl_config.cafile);
 		verify = user_ssl_config.verify or default_verify;
 		options = user_ssl_config.options or default_options;
-		ciphers = user_ssl_config.ciphers;
 		depth = user_ssl_config.depth;
 	};
 
 	local ctx, err = ssl_newcontext(ssl_config);
+
+	-- LuaSec ignores the cipher list from the config, so we have to take care
+	-- of it ourselves (W/A for #x)
+	if ctx and user_ssl_config.ciphers then
+		local success;
+		success, err = ssl.context.setcipher(ctx, user_ssl_config.ciphers);
+		if not success then ctx = nil; end
+	end
+
 	if not ctx then
 		err = err or "invalid ssl config"
 		local file = err:match("^error loading (.-) %(");