Comparison

prosodyctl @ 8247:2c386ee5cd5c

prosodyctl: Use all enabled hosts if no hostnames passed to cert import
author Kim Alvefur <zash@zash.se>
date Mon, 18 Sep 2017 17:06:35 +0200
parent 8202:85a60e863509
child 8248:259e0010a6d4
comparison
equal deleted inserted replaced
8242:177873dc9cf3 8247:2c386ee5cd5c
868 local hostnames = {}; 868 local hostnames = {};
869 -- Move hostname arguments out of arg, the rest should be a list of paths 869 -- Move hostname arguments out of arg, the rest should be a list of paths
870 while arg[1] and prosody.hosts[ arg[1] ] do 870 while arg[1] and prosody.hosts[ arg[1] ] do
871 table.insert(hostnames, table.remove(arg, 1)); 871 table.insert(hostnames, table.remove(arg, 1));
872 end 872 end
873 if hostnames[1] == nil then
874 for host in pairs(prosody.hosts) do
875 if host ~= "*" and config.get(host, "enabled") ~= false then
876 table.insert(hostnames, host);
877 end
878 end
879 end
873 if not arg[1] or arg[1] == "--help" then -- Probably forgot the path 880 if not arg[1] or arg[1] == "--help" then -- Probably forgot the path
874 show_usage("cert import HOSTNAME [HOSTNAME+] /path/to/certs [/other/paths/]+", 881 show_usage("cert import [HOSTNAME+] /path/to/certs [/other/paths/]+",
875 "Copies certificates to "..cert_basedir); 882 "Copies certificates to "..cert_basedir);
876 return 1; 883 return 1;
877 end 884 end
878 local owner, group; 885 local owner, group;
879 if pposix.getuid() == 0 then -- We need root to change ownership 886 if pposix.getuid() == 0 then -- We need root to change ownership