Software /
code /
prosody
Comparison
plugins/mod_tls.lua @ 12211:5c2ae28f536e
mod_tls: Set ALPN on outgoing connections
Relevant and sometimes needed for Direct TLS which mod_s2s uses this
context for. Primarily when e.g. mod_net_multiplex or equivalent ALPN
based dispatch is used.
All these contexts should likely move away from mod_tls and into either
mod_s2s or portmanager. The later already duplicates some of this work.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 25 Jan 2022 13:20:26 +0100 |
parent | 12207:65e252940337 |
child | 12330:38b5b05407be |
comparison
equal
deleted
inserted
replaced
12209:3fe2e5da05c3 | 12211:5c2ae28f536e |
---|---|
53 local parent_s2s = rawgetopt(parent, "s2s_ssl") or NULL; | 53 local parent_s2s = rawgetopt(parent, "s2s_ssl") or NULL; |
54 local host_s2s = rawgetopt(modhost, "s2s_ssl") or parent_s2s; | 54 local host_s2s = rawgetopt(modhost, "s2s_ssl") or parent_s2s; |
55 | 55 |
56 module:log("debug", "Creating context for c2s"); | 56 module:log("debug", "Creating context for c2s"); |
57 local request_client_certs = { verify = { "peer", "client_once", }; }; | 57 local request_client_certs = { verify = { "peer", "client_once", }; }; |
58 local xmpp_alpn = { alpn = "xmpp-server" }; | |
58 | 59 |
59 ssl_ctx_c2s, err_c2s, ssl_cfg_c2s = create_context(host.host, "server", host_c2s, host_ssl, global_c2s); -- for incoming client connections | 60 ssl_ctx_c2s, err_c2s, ssl_cfg_c2s = create_context(host.host, "server", host_c2s, host_ssl, global_c2s); -- for incoming client connections |
60 if not ssl_ctx_c2s then module:log("error", "Error creating context for c2s: %s", err_c2s); end | 61 if not ssl_ctx_c2s then module:log("error", "Error creating context for c2s: %s", err_c2s); end |
61 | 62 |
62 module:log("debug", "Creating context for s2sout"); | 63 module:log("debug", "Creating context for s2sout"); |
63 -- for outgoing server connections | 64 -- for outgoing server connections |
64 ssl_ctx_s2sout, err_s2sout, ssl_cfg_s2sout = create_context(host.host, "client", host_s2s, host_ssl, global_s2s, request_client_certs); | 65 ssl_ctx_s2sout, err_s2sout, ssl_cfg_s2sout = create_context(host.host, "client", host_s2s, host_ssl, global_s2s, request_client_certs, xmpp_alpn); |
65 if not ssl_ctx_s2sout then module:log("error", "Error creating contexts for s2sout: %s", err_s2sout); end | 66 if not ssl_ctx_s2sout then module:log("error", "Error creating contexts for s2sout: %s", err_s2sout); end |
66 | 67 |
67 module:log("debug", "Creating context for s2sin"); | 68 module:log("debug", "Creating context for s2sin"); |
68 -- for incoming server connections | 69 -- for incoming server connections |
69 ssl_ctx_s2sin, err_s2sin, ssl_cfg_s2sin = create_context(host.host, "server", host_s2s, host_ssl, global_s2s, request_client_certs); | 70 ssl_ctx_s2sin, err_s2sin, ssl_cfg_s2sin = create_context(host.host, "server", host_s2s, host_ssl, global_s2s, request_client_certs); |