Comparison

util/prosodyctl/check.lua @ 11924:53e68227c2c0

util.prosodyctl.check: Respect use_ipv4/v6 in proxy65 check Previously it would complain about lack of an AAAA record for proxy65_target even in an IPv6-less environment. Thanks to libertas for unintentionally calling attention to this.
author Kim Alvefur <zash@zash.se>
date Sat, 20 Nov 2021 17:05:32 +0100
parent 11923:bd0440c12842
child 11925:3e0d03a74285
comparison
equal deleted inserted replaced
11923:bd0440c12842 11924:53e68227c2c0
454 print(" Failed to determine the external addresses of this server. Checks may be inaccurate."); 454 print(" Failed to determine the external addresses of this server. Checks may be inaccurate.");
455 c2s_srv_required, s2s_srv_required = true, true; 455 c2s_srv_required, s2s_srv_required = true, true;
456 end 456 end
457 457
458 local v6_supported = not not socket.tcp6; 458 local v6_supported = not not socket.tcp6;
459 local use_ipv4 = configmanager.get("*", "use_ipv4") ~= false;
460 local use_ipv6 = v6_supported and configmanager.get("*", "use_ipv6") ~= false;
459 461
460 local function trim_dns_name(n) 462 local function trim_dns_name(n)
461 return (n:gsub("%.$", "")); 463 return (n:gsub("%.$", ""));
462 end 464 end
463 465
572 if modules:contains("proxy65") then 574 if modules:contains("proxy65") then
573 local proxy65_target = configmanager.get(host, "proxy65_address") or host; 575 local proxy65_target = configmanager.get(host, "proxy65_address") or host;
574 if type(proxy65_target) == "string" then 576 if type(proxy65_target) == "string" then
575 local A, AAAA = dns.lookup(idna.to_ascii(proxy65_target), "A"), dns.lookup(idna.to_ascii(proxy65_target), "AAAA"); 577 local A, AAAA = dns.lookup(idna.to_ascii(proxy65_target), "A"), dns.lookup(idna.to_ascii(proxy65_target), "AAAA");
576 local prob = {}; 578 local prob = {};
577 if not A then 579 if use_ipv4 and not A then
578 table.insert(prob, "A"); 580 table.insert(prob, "A");
579 end 581 end
580 if v6_supported and not AAAA then 582 if use_ipv6 and not AAAA then
581 table.insert(prob, "AAAA"); 583 table.insert(prob, "AAAA");
582 end 584 end
583 if #prob > 0 then 585 if #prob > 0 then
584 print(" File transfer proxy "..proxy65_target.." has no "..table.concat(prob, "/") 586 print(" File transfer proxy "..proxy65_target.." has no "..table.concat(prob, "/")
585 .." record. Create one or set 'proxy65_address' to the correct host/IP."); 587 .." record. Create one or set 'proxy65_address' to the correct host/IP.");
587 else 589 else
588 print(" proxy65_address for "..host.." should be set to a string, unable to perform DNS check"); 590 print(" proxy65_address for "..host.." should be set to a string, unable to perform DNS check");
589 end 591 end
590 end 592 end
591 593
592 local use_ipv4 = configmanager.get("*", "use_ipv4") ~= false;
593 local use_ipv6 = v6_supported and configmanager.get("*", "use_ipv6") ~= false;
594 if not use_ipv4 and not use_ipv6 then 594 if not use_ipv4 and not use_ipv6 then
595 print(" Both IPv6 and IPv4 are disabled, Prosody will not listen on any ports"); 595 print(" Both IPv6 and IPv4 are disabled, Prosody will not listen on any ports");
596 print(" nor be able to connect to any remote servers."); 596 print(" nor be able to connect to any remote servers.");
597 all_targets_ok = false; 597 all_targets_ok = false;
598 end 598 end