aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-10-04 16:50:22 +0100
committerMatthew Wild <mwild1@gmail.com>2009-10-04 16:50:22 +0100
commit24d115f8cd9dd5decf3335334dda416d28e8a4c4 (patch)
tree612a23ce8918835dfed0137d175c7537d0a1cd70
parentd4d1aeb52c93eee5b44c3fd062142dcf1ad0f283 (diff)
downloadprosody-24d115f8cd9dd5decf3335334dda416d28e8a4c4.tar.gz
prosody-24d115f8cd9dd5decf3335334dda416d28e8a4c4.zip
hostmanager: Create ssl context for each host (fixes #30 for outgoing s2s connections)
-rw-r--r--core/hostmanager.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/hostmanager.lua b/core/hostmanager.lua
index 4934e7b2..2fcfc0f4 100644
--- a/core/hostmanager.lua
+++ b/core/hostmanager.lua
@@ -6,15 +6,19 @@
-- COPYING file in the source package for more information.
--
+local ssl = ssl
local hosts = hosts;
local configmanager = require "core.configmanager";
local eventmanager = require "core.eventmanager";
local events_new = require "util.events".new;
+-- These are the defaults if not overridden in the config
+local default_ssl_ctx = { mode = "client", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; };
+
local log = require "util.logger".init("hostmanager");
-local pairs = pairs;
+local pairs, setmetatable = pairs, setmetatable;
module "hostmanager"
@@ -46,6 +50,12 @@ function activate(host, host_config)
log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in global Host \"*\" instead", host, option_name);
end
end
+
+ local ssl_config = host_config.core.ssl or configmanager.get("*", "core", "ssl");
+ if ssl_config then
+ hosts[host].ssl_ctx = ssl.newcontext(setmetatable(ssl_config, { __index = default_ssl_ctx }));
+ end
+
log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host);
eventmanager.fire_event("host-activated", host, host_config);
end