aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-22 19:11:26 +0200
committerKim Alvefur <zash@zash.se>2017-04-22 19:11:26 +0200
commiteae8bd26c27278ea7a7b8bc015b93a3761750e89 (patch)
treed99bb95c4aa57db5793669d51dfdbcc5d0dffa42 /prosodyctl
parentb9401b9307b94c8b115257835392624df74e4012 (diff)
downloadprosody-eae8bd26c27278ea7a7b8bc015b93a3761750e89.tar.gz
prosody-eae8bd26c27278ea7a7b8bc015b93a3761750e89.zip
prosodyctl: Delay reporting of successful certificate imports until all done
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl8
1 files changed, 6 insertions, 2 deletions
diff --git a/prosodyctl b/prosodyctl
index cc410f5a..e2f71223 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -873,18 +873,19 @@ function cert_commands.import(arg)
owner = config.get("*", "prosody_user") or "prosody";
group = config.get("*", "prosody_group") or owner;
end
+ local imported = {};
for _, host in ipairs(hostnames) do
for _, dir in ipairs(arg) do
if lfs.attributes(dir .. "/" .. host .. "/fullchain.pem")
and lfs.attributes(dir .. "/" .. host .. "/privkey.pem") then
copy(dir .. "/" .. host .. "/fullchain.pem", cert_basedir .. "/" .. host .. ".crt", nil, owner, group);
copy(dir .. "/" .. host .. "/privkey.pem", cert_basedir .. "/" .. host .. ".key", "0377", owner, group);
- show_message("Imported certificate and key for "..host);
+ table.insert(imported, host);
elseif lfs.attributes(dir .. "/" .. host .. ".crt")
and lfs.attributes(dir .. "/" .. host .. ".key") then
copy(dir .. "/" .. host .. ".crt", cert_basedir .. "/" .. host .. ".crt", nil, owner, group);
copy(dir .. "/" .. host .. ".key", cert_basedir .. "/" .. host .. ".key", "0377", owner, group);
- show_message("Imported certificate and key for "..host);
+ table.insert(imported, host);
else
show_warning("No certificate for host "..host.." found :(");
end
@@ -893,6 +894,9 @@ function cert_commands.import(arg)
-- Private key matches public key in certificate
end
end
+ if imported[1] then
+ show_message("Imported certificate and key for hosts "..table.concat(imported, ", "));
+ end
end
function commands.cert(arg)