Comparison

core/hostmanager.lua @ 1980:8fceabd84d74

hostmanager: Create a server sslctx for incoming connections
author Matthew Wild <mwild1@gmail.com>
date Sat, 17 Oct 2009 16:23:03 +0100
parent 1975:a9998fac292c
child 2321:7e7484a4e821
child 2855:66a1aa0bedc0
comparison
equal deleted inserted replaced
1979:52ddaa2e6ab8 1980:8fceabd84d74
19 end 19 end
20 local incoming_s2s = _G.prosody.incoming_s2s; 20 local incoming_s2s = _G.prosody.incoming_s2s;
21 21
22 -- These are the defaults if not overridden in the config 22 -- These are the defaults if not overridden in the config
23 local default_ssl_ctx = { mode = "client", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; }; 23 local default_ssl_ctx = { mode = "client", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; };
24 local default_ssl_ctx_in = { mode = "server", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; };
24 25
25 local log = require "util.logger".init("hostmanager"); 26 local log = require "util.logger".init("hostmanager");
26 27
27 local pairs, setmetatable = pairs, setmetatable; 28 local pairs, setmetatable = pairs, setmetatable;
28 29
59 60
60 if ssl then 61 if ssl then
61 local ssl_config = host_config.core.ssl or configmanager.get("*", "core", "ssl"); 62 local ssl_config = host_config.core.ssl or configmanager.get("*", "core", "ssl");
62 if ssl_config then 63 if ssl_config then
63 hosts[host].ssl_ctx = ssl.newcontext(setmetatable(ssl_config, { __index = default_ssl_ctx })); 64 hosts[host].ssl_ctx = ssl.newcontext(setmetatable(ssl_config, { __index = default_ssl_ctx }));
65 hosts[host].ssl_ctx_in = ssl.newcontext(setmetatable(ssl_config, { __index = default_ssl_ctx_in }));
64 end 66 end
65 end 67 end
66 68
67 log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host); 69 log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host);
68 eventmanager.fire_event("host-activated", host, host_config); 70 eventmanager.fire_event("host-activated", host, host_config);