Comparison

prosodyctl @ 8253:3a6f5b0f56f0

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 21 Sep 2017 02:36:28 +0200
parent 8203:a7863f4aae65
parent 8249:cc664a3917e2
child 8268:e21d82551e05
comparison
equal deleted inserted replaced
8246:ea2667fc6781 8253:3a6f5b0f56f0
866 local hostnames = {}; 866 local hostnames = {};
867 -- Move hostname arguments out of arg, the rest should be a list of paths 867 -- Move hostname arguments out of arg, the rest should be a list of paths
868 while arg[1] and prosody.hosts[ arg[1] ] do 868 while arg[1] and prosody.hosts[ arg[1] ] do
869 table.insert(hostnames, table.remove(arg, 1)); 869 table.insert(hostnames, table.remove(arg, 1));
870 end 870 end
871 if hostnames[1] == nil then
872 local domains = os.getenv"RENEWED_DOMAINS"; -- Set if invoked via certbot
873 if domains then
874 for host in domains:gmatch("%S+") do
875 table.insert(hostnames, host);
876 end
877 else
878 for host in pairs(prosody.hosts) do
879 if host ~= "*" and config.get(host, "enabled") ~= false then
880 table.insert(hostnames, host);
881 end
882 end
883 end
884 end
871 if not arg[1] or arg[1] == "--help" then -- Probably forgot the path 885 if not arg[1] or arg[1] == "--help" then -- Probably forgot the path
872 show_usage("cert import HOSTNAME [HOSTNAME+] /path/to/certs [/other/paths/]+", 886 show_usage("cert import [HOSTNAME+] /path/to/certs [/other/paths/]+",
873 "Copies certificates to "..cert_basedir); 887 "Copies certificates to "..cert_basedir);
874 return 1; 888 return 1;
875 end 889 end
876 local owner, group; 890 local owner, group;
877 if pposix.getuid() == 0 then -- We need root to change ownership 891 if pposix.getuid() == 0 then -- We need root to change ownership
928 show_warning("The directory "..cert_basedir.." not only writable by its owner"); 942 show_warning("The directory "..cert_basedir.." not only writable by its owner");
929 return 1; 943 return 1;
930 end 944 end
931 local subcmd = table.remove(arg, 1); 945 local subcmd = table.remove(arg, 1);
932 if type(cert_commands[subcmd]) == "function" then 946 if type(cert_commands[subcmd]) == "function" then
933 if not arg[1] then 947 if subcmd ~= "import" then -- hostnames are optional for import
934 show_message"You need to supply at least one hostname" 948 if not arg[1] then
935 arg = { "--help" }; 949 show_message"You need to supply at least one hostname"
936 end 950 arg = { "--help" };
937 if arg[1] ~= "--help" and not hosts[arg[1]] then 951 end
938 show_message(error_messages["no-such-host"]); 952 if arg[1] ~= "--help" and not hosts[arg[1]] then
939 return 1; 953 show_message(error_messages["no-such-host"]);
954 return 1;
955 end
940 end 956 end
941 return cert_commands[subcmd](arg); 957 return cert_commands[subcmd](arg);
942 elseif subcmd == "check" then 958 elseif subcmd == "check" then
943 return commands.check({"certs"}); 959 return commands.check({"certs"});
944 end 960 end