diff options
author | Kim Alvefur <zash@zash.se> | 2017-09-21 02:36:28 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-09-21 02:36:28 +0200 |
commit | 672f22b6f9036895ba3301bbee91abbe99b180be (patch) | |
tree | af392dbae3065aa54b4a971eb3c368a74624958d /prosodyctl | |
parent | edeb5980c3da029e56068a5da524189b40514726 (diff) | |
parent | b6c066f717f02a43f9b506c145302c05294101cc (diff) | |
download | prosody-672f22b6f9036895ba3301bbee91abbe99b180be.tar.gz prosody-672f22b6f9036895ba3301bbee91abbe99b180be.zip |
Merge 0.10->trunk
Diffstat (limited to 'prosodyctl')
-rwxr-xr-x | prosodyctl | 32 |
1 files changed, 24 insertions, 8 deletions
@@ -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 |