aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-09-21 02:36:28 +0200
committerKim Alvefur <zash@zash.se>2017-09-21 02:36:28 +0200
commit43e5d4df2985e069c52fb21e4636e3e44053d1bf (patch)
treeaf392dbae3065aa54b4a971eb3c368a74624958d /prosodyctl
parent8cb654ff632fd09ca39941952bd09e2f5d45cecc (diff)
parent1574b7a818dfd40ba2fd5cb3ebf8687ba5a37a4d (diff)
downloadprosody-43e5d4df2985e069c52fb21e4636e3e44053d1bf.tar.gz
prosody-43e5d4df2985e069c52fb21e4636e3e44053d1bf.zip
Merge 0.10->trunk
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl32
1 files changed, 24 insertions, 8 deletions
diff --git a/prosodyctl b/prosodyctl
index 79f0a46d..bb35c641 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -868,8 +868,22 @@ function cert_commands.import(arg)
while arg[1] and prosody.hosts[ arg[1] ] do
table.insert(hostnames, table.remove(arg, 1));
end
+ if hostnames[1] == nil then
+ local domains = os.getenv"RENEWED_DOMAINS"; -- Set if invoked via certbot
+ if domains then
+ for host in domains:gmatch("%S+") do
+ table.insert(hostnames, host);
+ end
+ else
+ for host in pairs(prosody.hosts) do
+ if host ~= "*" and config.get(host, "enabled") ~= false then
+ table.insert(hostnames, host);
+ end
+ end
+ end
+ end
if not arg[1] or arg[1] == "--help" then -- Probably forgot the path
- show_usage("cert import HOSTNAME [HOSTNAME+] /path/to/certs [/other/paths/]+",
+ show_usage("cert import [HOSTNAME+] /path/to/certs [/other/paths/]+",
"Copies certificates to "..cert_basedir);
return 1;
end
@@ -930,13 +944,15 @@ function commands.cert(arg)
end
local subcmd = table.remove(arg, 1);
if type(cert_commands[subcmd]) == "function" then
- if not arg[1] then
- show_message"You need to supply at least one hostname"
- arg = { "--help" };
- end
- if arg[1] ~= "--help" and not hosts[arg[1]] then
- show_message(error_messages["no-such-host"]);
- return 1;
+ if subcmd ~= "import" then -- hostnames are optional for import
+ if not arg[1] then
+ show_message"You need to supply at least one hostname"
+ arg = { "--help" };
+ end
+ if arg[1] ~= "--help" and not hosts[arg[1]] then
+ show_message(error_messages["no-such-host"]);
+ return 1;
+ end
end
return cert_commands[subcmd](arg);
elseif subcmd == "check" then