Mercurial > prosody-hg
comparison plugins/mod_tls.lua @ 10783:950082c1669e 0.11
mod_tls: Log when certificates are (re)loaded
Meant to reduce user confusion over what's reloaded and not.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 26 Apr 2020 20:58:51 +0200 |
| parents | 5b048ccd106f |
| children | 0b0fe73199d2 |
comparison
equal
deleted
inserted
replaced
| 10777:3695904d2854 | 10783:950082c1669e |
|---|---|
| 34 local host = hosts[module.host]; | 34 local host = hosts[module.host]; |
| 35 | 35 |
| 36 local ssl_ctx_c2s, ssl_ctx_s2sout, ssl_ctx_s2sin; | 36 local ssl_ctx_c2s, ssl_ctx_s2sout, ssl_ctx_s2sin; |
| 37 local ssl_cfg_c2s, ssl_cfg_s2sout, ssl_cfg_s2sin; | 37 local ssl_cfg_c2s, ssl_cfg_s2sout, ssl_cfg_s2sin; |
| 38 | 38 |
| 39 function module.load() | 39 function module.load(reload) |
| 40 local NULL, err = {}; | 40 local NULL, err = {}; |
| 41 local modhost = module.host; | 41 local modhost = module.host; |
| 42 local parent = modhost:match("%.(.*)$"); | 42 local parent = modhost:match("%.(.*)$"); |
| 43 | 43 |
| 44 local parent_ssl = rawgetopt(parent, "ssl") or NULL; | 44 local parent_ssl = rawgetopt(parent, "ssl") or NULL; |
| 61 if not ssl_ctx_s2sout then module:log("error", "Error creating contexts for s2sout: %s", err); end | 61 if not ssl_ctx_s2sout then module:log("error", "Error creating contexts for s2sout: %s", err); end |
| 62 | 62 |
| 63 module:log("debug", "Creating context for s2sin"); | 63 module:log("debug", "Creating context for s2sin"); |
| 64 ssl_ctx_s2sin, err, ssl_cfg_s2sin = create_context(host.host, "server", host_s2s, host_ssl, global_s2s); -- for incoming server connections | 64 ssl_ctx_s2sin, err, ssl_cfg_s2sin = create_context(host.host, "server", host_s2s, host_ssl, global_s2s); -- for incoming server connections |
| 65 if not ssl_ctx_s2sin then module:log("error", "Error creating contexts for s2sin: %s", err); end | 65 if not ssl_ctx_s2sin then module:log("error", "Error creating contexts for s2sin: %s", err); end |
| 66 | |
| 67 if reload then | |
| 68 module:log("info", "Certificates reloaded"); | |
| 69 else | |
| 70 module:log("info", "Certificates loaded"); | |
| 71 end | |
| 66 end | 72 end |
| 67 | 73 |
| 68 module:hook_global("config-reloaded", module.load); | 74 module:hook_global("config-reloaded", module.load); |
| 69 | 75 |
| 70 local function can_do_tls(session) | 76 local function can_do_tls(session) |
