Software /
code /
prosody
Changeset
11534:1cef62ca3e03
core.certmanager: Skip directly to guessing of key from cert filename
Cuts down on a ton of debug logs
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 05 May 2021 15:56:39 +0200 |
parents | 11533:f97592336399 |
children | 11535:180c5951e7e4 |
files | core/certmanager.lua |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/core/certmanager.lua Wed May 05 15:54:05 2021 +0200 +++ b/core/certmanager.lua Wed May 05 15:56:39 2021 +0200 @@ -98,6 +98,15 @@ log("debug", "No certificate/key found for %s", name); end +local function find_matching_key(cert_path) + -- FIXME we shouldn't need to guess the key filename + if cert_path:sub(-4) == ".crt" then + return cert_path:sub(1, -4) .. "key"; + elseif cert_path:sub(-14) == "/fullchain.pem" then + return cert_path:sub(1, -14) .. "privkey.pem"; + end +end + local function index_certs(dir, files_by_name, depth_limit) files_by_name = files_by_name or {}; depth_limit = depth_limit or 3; @@ -156,7 +165,10 @@ local cert_filename, services = next(certs); if services["*"] then log("debug", "Using cert %q from index", cert_filename); - return find_cert(cert_filename, host); + return { + certificate = cert_filename, + key = find_matching_key(cert_filename), + } end end @@ -171,7 +183,10 @@ for cert_filename, services in pairs(certs) do if services[service] or services["*"] then log("debug", "Using cert %q from index", cert_filename); - return find_cert(cert_filename, service); + return { + certificate = cert_filename, + key = find_matching_key(cert_filename), + } end end end