plugins/mod_tls.lua

changeset 3571
675d65036f31
parent 3397
f376f0bd1d1f
child 3574
1e088ec07d33
--- a/plugins/mod_tls.lua	Sat Nov 06 03:46:19 2010 +0500
+++ b/plugins/mod_tls.lua	Sat Nov 06 18:28:15 2010 +0000
@@ -6,6 +6,7 @@
 -- COPYING file in the source package for more information.
 --
 
+local create_context = require "core.certmanager".create_context;
 local st = require "util.stanza";
 
 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption");
@@ -87,3 +88,14 @@
 	session.secure = false;
 	return true;
 end);
+
+function module.load()
+	local ssl_config = module:get_option("ssl");
+	host.ssl_ctx = create_context(host, "client", ssl_config); -- for outgoing connections
+	host.ssl_ctx_in = create_context(host, "server", ssl_config); -- for incoming connections
+end
+
+function module.unload()
+	host.ssl_ctx = nil;
+	host.ssl_ctx_in = nil;
+end

mercurial