Software /
code /
prosody
Comparison
core/certmanager.lua @ 12331:49739369dcad
core.certmanager: Turn soft dependency on LuaSec into a hard
The default network backend server_epoll already requires LuaSec so
Prosody won't even start without it, so we can get rid of these lines
here too.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 10 Feb 2022 17:15:55 +0100 |
parent | 12287:5cd075ed4fd3 |
child | 12362:0fd58f54d653 |
comparison
equal
deleted
inserted
replaced
12330:38b5b05407be | 12331:49739369dcad |
---|---|
4 -- | 4 -- |
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | 8 |
9 local softreq = require"util.dependencies".softreq; | 9 local ssl = require "ssl"; |
10 local ssl = softreq"ssl"; | |
11 if not ssl then | |
12 return { | |
13 create_context = function () | |
14 return nil, "LuaSec (required for encryption) was not found"; | |
15 end; | |
16 reload_ssl_config = function () end; | |
17 } | |
18 end | |
19 | |
20 local configmanager = require "core.configmanager"; | 10 local configmanager = require "core.configmanager"; |
21 local log = require "util.logger".init("certmanager"); | 11 local log = require "util.logger".init("certmanager"); |
22 local ssl_context = ssl.context or softreq"ssl.context"; | 12 local ssl_context = ssl.context or require "ssl.context"; |
23 local ssl_newcontext = ssl.newcontext; | 13 local ssl_newcontext = ssl.newcontext; |
24 local new_config = require"util.sslconfig".new; | 14 local new_config = require"util.sslconfig".new; |
25 local stat = require "lfs".attributes; | 15 local stat = require "lfs".attributes; |
26 | 16 |
27 local x509 = require "util.x509"; | 17 local x509 = require "util.x509"; |
46 return not not ssl_newcontext({mode="server",protocol="sslv23",options={ option }}); | 36 return not not ssl_newcontext({mode="server",protocol="sslv23",options={ option }}); |
47 end | 37 end |
48 | 38 |
49 local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)"); | 39 local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)"); |
50 local luasec_version = tonumber(luasec_major) * 100 + tonumber(luasec_minor); | 40 local luasec_version = tonumber(luasec_major) * 100 + tonumber(luasec_minor); |
51 local luasec_has = ssl.config or softreq"ssl.config" or { | 41 local luasec_has = ssl.config or { |
52 algorithms = { | 42 algorithms = { |
53 ec = luasec_version >= 5; | 43 ec = luasec_version >= 5; |
54 }; | 44 }; |
55 capabilities = { | 45 capabilities = { |
56 curves_list = luasec_version >= 7; | 46 curves_list = luasec_version >= 7; |