Software /
code /
prosody
Comparison
core/certmanager.lua @ 6779:6236668da30a
core.*: Remove use of module() function
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Feb 2015 10:42:19 +0100 |
parent | 6570:70e65ac65219 |
child | 6903:5ff42d85d4d5 |
comparison
equal
deleted
inserted
replaced
6778:4009ae66e0f0 | 6779:6236668da30a |
---|---|
43 no_compression = luasec_version >= 5; | 43 no_compression = luasec_version >= 5; |
44 single_dh_use = luasec_version >= 2; | 44 single_dh_use = luasec_version >= 2; |
45 single_ecdh_use = luasec_version >= 2; | 45 single_ecdh_use = luasec_version >= 2; |
46 }; | 46 }; |
47 | 47 |
48 module "certmanager" | 48 local _ENV = nil; |
49 | 49 |
50 -- Global SSL options if not overridden per-host | 50 -- Global SSL options if not overridden per-host |
51 local global_ssl_config = configmanager.get("*", "ssl"); | 51 local global_ssl_config = configmanager.get("*", "ssl"); |
52 | 52 |
53 -- Built-in defaults | 53 -- Built-in defaults |
76 for i=1,#core_defaults.verifyext do -- Remove lsec_ prefix | 76 for i=1,#core_defaults.verifyext do -- Remove lsec_ prefix |
77 core_defaults.verify[#core_defaults.verify+1] = core_defaults.verifyext[i]:sub(6); | 77 core_defaults.verify[#core_defaults.verify+1] = core_defaults.verifyext[i]:sub(6); |
78 end | 78 end |
79 end | 79 end |
80 | 80 |
81 function create_context(host, mode, ...) | 81 local function create_context(host, mode, ...) |
82 local cfg = new_config(); | 82 local cfg = new_config(); |
83 cfg:apply(core_defaults); | 83 cfg:apply(core_defaults); |
84 cfg:apply(global_ssl_config); | 84 cfg:apply(global_ssl_config); |
85 cfg:apply({ | 85 cfg:apply({ |
86 mode = mode, | 86 mode = mode, |
152 end | 152 end |
153 end | 153 end |
154 return ctx, err, user_ssl_config; | 154 return ctx, err, user_ssl_config; |
155 end | 155 end |
156 | 156 |
157 function reload_ssl_config() | 157 local function reload_ssl_config() |
158 global_ssl_config = configmanager.get("*", "ssl"); | 158 global_ssl_config = configmanager.get("*", "ssl"); |
159 if luasec_has.no_compression then | 159 if luasec_has.no_compression then |
160 core_defaults.options.no_compression = configmanager.get("*", "ssl_compression") ~= true; | 160 core_defaults.options.no_compression = configmanager.get("*", "ssl_compression") ~= true; |
161 end | 161 end |
162 end | 162 end |
163 | 163 |
164 prosody.events.add_handler("config-reloaded", reload_ssl_config); | 164 prosody.events.add_handler("config-reloaded", reload_ssl_config); |
165 | 165 |
166 return _M; | 166 return { |
167 create_context = create_context; | |
168 reload_ssl_config = reload_ssl_config; | |
169 }; |