Comparison

core/certmanager.lua @ 12362:0fd58f54d653

Merge config-updates+check-turn from timber
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 Mar 2022 16:33:41 +0000
parent 12305:f8b8061461e3
parent 12331:49739369dcad
child 12480:7e9ebdc75ce4
child 12507:e242a6e74424
comparison
equal deleted inserted replaced
12320:f0be98bab9dd 12362:0fd58f54d653
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;