Comparison

util/prosodyctl/check.lua @ 12319:8fc3c06f922d

prosodyctl: check dns: List discovered addresses for diagnostic purposes It is very common to get the "unknown address" warning with this command, but people do not always understand it, or know how to debug it. Now we clearly show the addresses that prosodyctl discovered.
author Matthew Wild <mwild1@gmail.com>
date Wed, 02 Mar 2022 16:02:42 +0000
parent 12318:239ce74aa6a4
child 12320:f0be98bab9dd
comparison
equal deleted inserted replaced
12318:239ce74aa6a4 12319:8fc3c06f922d
558 558
559 local function trim_dns_name(n) 559 local function trim_dns_name(n)
560 return (n:gsub("%.$", "")); 560 return (n:gsub("%.$", ""));
561 end 561 end
562 562
563 local unknown_addresses = set.new();
564
563 for jid, host_options in enabled_hosts() do 565 for jid, host_options in enabled_hosts() do
564 local all_targets_ok, some_targets_ok = true, false; 566 local all_targets_ok, some_targets_ok = true, false;
565 local node, host = jid_split(jid); 567 local node, host = jid_split(jid);
566 568
567 local modules, component_module = modulemanager.get_modules_for_host(host); 569 local modules, component_module = modulemanager.get_modules_for_host(host);
740 host_ok_v4 = true; 742 host_ok_v4 = true;
741 some_targets_ok = true; 743 some_targets_ok = true;
742 print(" "..target_host.." A record points to internal address, external connections might fail"); 744 print(" "..target_host.." A record points to internal address, external connections might fail");
743 else 745 else
744 print(" "..target_host.." A record points to unknown address "..record.a); 746 print(" "..target_host.." A record points to unknown address "..record.a);
747 unknown_addresses:add(record.a);
745 all_targets_ok = false; 748 all_targets_ok = false;
746 end 749 end
747 end 750 end
748 end 751 end
749 end 752 end
758 host_ok_v6 = true; 761 host_ok_v6 = true;
759 some_targets_ok = true; 762 some_targets_ok = true;
760 print(" "..target_host.." AAAA record points to internal address, external connections might fail"); 763 print(" "..target_host.." AAAA record points to internal address, external connections might fail");
761 else 764 else
762 print(" "..target_host.." AAAA record points to unknown address "..record.aaaa); 765 print(" "..target_host.." AAAA record points to unknown address "..record.aaaa);
766 unknown_addresses:add(record.aaaa);
763 all_targets_ok = false; 767 all_targets_ok = false;
764 end 768 end
765 end 769 end
766 end 770 end
767 end 771 end
803 problem_hosts:add(host); 807 problem_hosts:add(host);
804 end 808 end
805 print(""); 809 print("");
806 end 810 end
807 if not problem_hosts:empty() then 811 if not problem_hosts:empty() then
812 if not unknown_addresses:empty() then
813 print("");
814 print("Some of your DNS records point to unknown IP addresses. This may be expected if your server");
815 print("is behind a NAT or proxy. The unrecognized addresses were:");
816 print("");
817 print(" Unrecognized: "..tostring(unknown_addresses));
818 print("");
819 print("The addresses we found on this system are:");
820 print("");
821 print(" Internal: "..tostring(internal_addresses));
822 print(" External: "..tostring(external_addresses));
823 end
808 print(""); 824 print("");
809 print("For more information about DNS configuration please see https://prosody.im/doc/dns"); 825 print("For more information about DNS configuration please see https://prosody.im/doc/dns");
810 print(""); 826 print("");
811 ok = false; 827 ok = false;
812 end 828 end