aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl21
1 files changed, 20 insertions, 1 deletions
diff --git a/prosodyctl b/prosodyctl
index f5763f92..41f3b8dc 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -822,6 +822,7 @@ function commands.check(arg)
end
if not what or what == "dns" then
local dns = require "net.dns";
+ local ip = require "util.ip";
local c2s_ports = set.new(config.get("*", "c2s_ports") or {5222});
local s2s_ports = set.new(config.get("*", "s2s_ports") or {5269});
@@ -835,7 +836,7 @@ function commands.check(arg)
local problem_hosts = set.new();
- local external_addresses = set.new();
+ local external_addresses, internal_addresses = set.new(), set.new();
local fqdn = socket.dns.tohostname(socket.dns.gethostname());
if fqdn then
@@ -853,6 +854,16 @@ function commands.check(arg)
end
end
+ local local_addresses = socket.local_addresses and socket.local_addresses() or {};
+
+ for addr in it.values(local_addresses) do
+ if not ip.new_ip(addr).private then
+ external_addresses:add(addr);
+ else
+ internal_addresses:add(addr);
+ end
+ end
+
if external_addresses:empty() then
print("");
print(" Failed to determine the external addresses of this server. Checks may be inaccurate.");
@@ -918,6 +929,10 @@ function commands.check(arg)
if external_addresses:contains(record.a) then
some_targets_ok = true;
host_ok_v4 = true;
+ elseif internal_addresses:contains(record.a) then
+ host_ok_v4 = true;
+ some_targets_ok = true;
+ print(" "..host.." A record points to internal address, external connections might fail");
else
print(" "..host.." A record points to unknown address "..record.a);
all_targets_ok = false;
@@ -930,6 +945,10 @@ function commands.check(arg)
if external_addresses:contains(record.aaaa) then
some_targets_ok = true;
host_ok_v6 = true;
+ elseif internal_addresses:contains(record.aaaa) then
+ host_ok_v6 = true;
+ some_targets_ok = true;
+ print(" "..host.." AAAA record points to internal address, external connections might fail");
else
print(" "..host.." AAAA record points to unknown address "..record.aaaa);
all_targets_ok = false;