Changeset

12107:8a5a9c1adb90

util.prosodyctl.cert: Copy SAN/wildcard certs only once
author Kim Alvefur <zash@zash.se>
date Wed, 22 Dec 2021 18:34:11 +0100
parents 12106:c0cb8e86ad21
children 12108:e9882c4c397f
files util/prosodyctl/cert.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/prosodyctl/cert.lua	Wed Dec 22 15:32:04 2021 +0100
+++ b/util/prosodyctl/cert.lua	Wed Dec 22 18:34:11 2021 +0100
@@ -223,10 +223,14 @@
 	local imported = {};
 	for _, host in ipairs(hostnames) do
 		local paths = cm.find_cert_in_index(files_by_name, host);
-		if paths then
+		if paths and not imported[paths.certificate] then
+			-- One certificate, many mames!
+			table.insert(imported, host);
+		elseif paths then
 			copy(paths.certificate, cert_basedir .. "/" .. host .. ".crt", nil, owner, group);
 			copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group);
 			table.insert(imported, host);
+			imported[paths.certificate] = true;
 		else
 			-- TODO Say where we looked
 			pctl.show_warning("No certificate for host "..host.." found :(");