aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2024-03-27 15:39:03 +0000
committerMatthew Wild <mwild1@gmail.com>2024-03-27 15:39:03 +0000
commita8556c18757df09419d82f8fc5f5bbf27769e1a3 (patch)
tree13183ddbf500070425735480d6e0d34f359b3c83
parentb41253bb4951c02b77f525d1a7cfc1e03a17b337 (diff)
parent655c972a7d8410f3bf6dfea72f833de95a576ba6 (diff)
downloadprosody-a8556c18757df09419d82f8fc5f5bbf27769e1a3.tar.gz
prosody-a8556c18757df09419d82f8fc5f5bbf27769e1a3.zip
Merge 0.12->trunk
-rw-r--r--util/prosodyctl/check.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua
index 5e7087c5..8d085c85 100644
--- a/util/prosodyctl/check.lua
+++ b/util/prosodyctl/check.lua
@@ -735,6 +735,57 @@ local function check(arg)
end
end
+ -- Check hostname validity
+ do
+ local idna = require "prosody.util.encodings".idna;
+ local invalid_hosts = {};
+ local alabel_hosts = {};
+ for host in it.filter("*", pairs(configmanager.getconfig())) do
+ local _, h, _ = jid_split(host);
+ if not h or not idna.to_ascii(h) then
+ table.insert(invalid_hosts, host);
+ else
+ for label in h:gmatch("[^%.]+") do
+ if label:match("^xn%-%-") then
+ table.insert(alabel_hosts, host);
+ break;
+ end
+ end
+ end
+ end
+
+ if #invalid_hosts > 0 then
+ table.sort(invalid_hosts);
+ print("");
+ print(" Your configuration contains invalid host names:");
+ print(" "..table.concat(invalid_hosts, "\n "));
+ print("");
+ print(" Clients may not be able to log in to these hosts, or you may not be able to");
+ print(" communicate with remote servers.");
+ print(" Use a valid domain name to correct this issue.");
+ end
+
+ if #alabel_hosts > 0 then
+ table.sort(alabel_hosts);
+ print("");
+ print(" Your configuration contains incorrectly-encoded hostnames:");
+ for _, ahost in ipairs(alabel_hosts) do
+ print((" '%s' (should be '%s')"):format(ahost, idna.to_unicode(ahost)));
+ end
+ print("");
+ print(" Clients may not be able to log in to these hosts, or you may not be able to");
+ print(" communicate with remote servers.");
+ print(" To correct this issue, use the Unicode version of the domain in Prosody's config file.");
+ end
+
+ if #invalid_hosts > 0 or #alabel_hosts > 0 then
+ print("");
+ print("WARNING: Changing the name of a VirtualHost in Prosody's config file");
+ print(" WILL NOT migrate any existing data (user accounts, etc.) to the new name.");
+ ok = false;
+ end
+ end
+
print("Done.\n");
end
function checks.dns()