aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-24 14:19:49 +0200
committerKim Alvefur <zash@zash.se>2017-04-24 14:19:49 +0200
commit706849aa1ef9f5f2f6494d14d7de0ac9e1647190 (patch)
tree13ca49cac213b410c52092725470206f070d7450 /prosodyctl
parent708f82e198006129be93ea2d60504c30d200ee06 (diff)
parent04abad10a7f83c64a2bafdcb2888e9cad815f47d (diff)
downloadprosody-706849aa1ef9f5f2f6494d14d7de0ac9e1647190.tar.gz
prosody-706849aa1ef9f5f2f6494d14d7de0ac9e1647190.zip
Merge 0.10->trunk
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl16
1 files changed, 14 insertions, 2 deletions
diff --git a/prosodyctl b/prosodyctl
index 27743b55..17acbed1 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -873,19 +873,21 @@ 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
+ -- TODO Say where we looked
show_warning("No certificate for host "..host.." found :(");
end
-- TODO Additional checks
@@ -893,6 +895,16 @@ 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, ", "));
+ local ok, err = prosodyctl.reload();
+ if not ok and err ~= "not-running" then
+ show_message(error_messages[err]);
+ end
+ else
+ show_warning("No certificates imported :(");
+ return 1;
+ end
end
function commands.cert(arg)