aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-05-05 17:52:51 +0200
committerKim Alvefur <zash@zash.se>2021-05-05 17:52:51 +0200
commit10fc065796852f28bdb086abd019603cb8631bc0 (patch)
tree04391f522c6241c61ca5b0c9b23d23587254eadf
parentf2a8b90b304f2dea38326e779bb2377921a6a20b (diff)
downloadprosody-10fc065796852f28bdb086abd019603cb8631bc0.tar.gz
prosody-10fc065796852f28bdb086abd019603cb8631bc0.zip
core.portmanager: Allow overriding expected SNI name per service
E.g. VirtualHost"example.com" https_name = "xmpp.example.com"
-rw-r--r--core/portmanager.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/portmanager.lua b/core/portmanager.lua
index ff12d447..46976368 100644
--- a/core/portmanager.lua
+++ b/core/portmanager.lua
@@ -237,11 +237,12 @@ local function add_sni_host(host, service)
local config_prefix = (active_service.config_prefix or name).."_";
if config_prefix == "_" then config_prefix = ""; end
local prefix_ssl_config = config.get(host, config_prefix.."ssl");
- local autocert = certmanager.find_host_cert(host);
+ local alternate_host = service and config.get(host, service.."_host");
+ local autocert = certmanager.find_host_cert(alternate_host or host);
-- luacheck: ignore 211/cfg
local ssl, err, cfg = certmanager.create_context(host, "server", prefix_ssl_config, autocert, active_service.tls_cfg);
if ssl then
- active_service.server.hosts[host] = ssl;
+ active_service.server.hosts[alternate_host or host] = ssl;
else
log("error", "Error creating TLS context for SNI host %s: %s", host, err);
end