Software /
code /
prosody
Comparison
util/prosodyctl/check.lua @ 12843:e609e10966f5
Merge 0.12->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 14 Jan 2023 14:09:33 +0100 |
parent | 12741:7b3deafb9162 |
parent | 12842:3edd39c55a8a |
child | 12899:09b101a3b3e1 |
comparison
equal
deleted
inserted
replaced
12841:8b06d7c73090 | 12843:e609e10966f5 |
---|---|
807 local modules, component_module = modulemanager.get_modules_for_host(host); | 807 local modules, component_module = modulemanager.get_modules_for_host(host); |
808 if component_module then | 808 if component_module then |
809 modules:add(component_module); | 809 modules:add(component_module); |
810 end | 810 end |
811 | 811 |
812 -- TODO Refactor these DNS SRV checks since they are very similar | |
813 -- FIXME Suggest concrete actionable steps to correct issues so that | |
814 -- users don't have to copy-paste the message into the support chat and | |
815 -- ask what to do about it. | |
812 local is_component = not not host_options.component_module; | 816 local is_component = not not host_options.component_module; |
813 print("Checking DNS for "..(is_component and "component" or "host").." "..jid.."..."); | 817 print("Checking DNS for "..(is_component and "component" or "host").." "..jid.."..."); |
814 if node then | 818 if node then |
815 print("Only the domain part ("..host..") is used in DNS.") | 819 print("Only the domain part ("..host..") is used in DNS.") |
816 end | 820 end |
836 else | 840 else |
837 target_hosts:add(host); | 841 target_hosts:add(host); |
838 end | 842 end |
839 end | 843 end |
840 end | 844 end |
841 if modules:contains("c2s") and c2s_tls_srv_required then | 845 if modules:contains("c2s") then |
842 local res = dns.lookup("_xmpps-client._tcp."..idna.to_ascii(host)..".", "SRV"); | 846 local res = dns.lookup("_xmpps-client._tcp."..idna.to_ascii(host)..".", "SRV"); |
843 if res and #res > 0 then | 847 if res and #res > 0 then |
844 for _, record in ipairs(res) do | 848 for _, record in ipairs(res) do |
845 if record.srv.target == "." then -- TODO is this an error if mod_c2s is enabled? | 849 if record.srv.target == "." then -- TODO is this an error if mod_c2s is enabled? |
846 print(" 'xmpps-client' service disabled by pointing to '.'"); -- FIXME Explain better what this is | 850 print(" 'xmpps-client' service disabled by pointing to '.'"); -- FIXME Explain better what this is |
850 target_hosts:add(target); | 854 target_hosts:add(target); |
851 if not c2s_tls_ports:contains(record.srv.port) then | 855 if not c2s_tls_ports:contains(record.srv.port) then |
852 print(" SRV target "..target.." contains unknown Direct TLS client port: "..record.srv.port); | 856 print(" SRV target "..target.." contains unknown Direct TLS client port: "..record.srv.port); |
853 end | 857 end |
854 end | 858 end |
855 else | 859 elseif c2s_tls_srv_required then |
856 print(" No _xmpps-client SRV record found for "..host..", but it looks like you need one."); | 860 print(" No _xmpps-client SRV record found for "..host..", but it looks like you need one."); |
857 all_targets_ok = false; | 861 all_targets_ok = false; |
858 end | 862 end |
859 end | 863 end |
860 if modules:contains("s2s") then | 864 if modules:contains("s2s") then |
878 else | 882 else |
879 target_hosts:add(host); | 883 target_hosts:add(host); |
880 end | 884 end |
881 end | 885 end |
882 end | 886 end |
883 if modules:contains("s2s") and s2s_tls_srv_required then | 887 if modules:contains("s2s") then |
884 local res = dns.lookup("_xmpps-server._tcp."..idna.to_ascii(host)..".", "SRV"); | 888 local res = dns.lookup("_xmpps-server._tcp."..idna.to_ascii(host)..".", "SRV"); |
885 if res and #res > 0 then | 889 if res and #res > 0 then |
886 for _, record in ipairs(res) do | 890 for _, record in ipairs(res) do |
887 if record.srv.target == "." then -- TODO is this an error if mod_s2s is enabled? | 891 if record.srv.target == "." then -- TODO is this an error if mod_s2s is enabled? |
888 print(" 'xmpps-server' service disabled by pointing to '.'"); -- FIXME Explain better what this is | 892 print(" 'xmpps-server' service disabled by pointing to '.'"); -- FIXME Explain better what this is |
892 target_hosts:add(target); | 896 target_hosts:add(target); |
893 if not s2s_tls_ports:contains(record.srv.port) then | 897 if not s2s_tls_ports:contains(record.srv.port) then |
894 print(" SRV target "..target.." contains unknown Direct TLS server port: "..record.srv.port); | 898 print(" SRV target "..target.." contains unknown Direct TLS server port: "..record.srv.port); |
895 end | 899 end |
896 end | 900 end |
897 else | 901 elseif s2s_tls_srv_required then |
898 print(" No _xmpps-server SRV record found for "..host..", but it looks like you need one."); | 902 print(" No _xmpps-server SRV record found for "..host..", but it looks like you need one."); |
899 all_targets_ok = false; | 903 all_targets_ok = false; |
900 end | 904 end |
901 end | 905 end |
902 if target_hosts:empty() then | 906 if target_hosts:empty() then |