mdns/diagnosis: following suggestion IRL: extend the no-check mecanism for .local to .onion and other special-use TLDs

This commit is contained in:
Alexandre Aubin 2021-08-12 19:40:36 +02:00
parent 849ccb043a
commit 7f3eeafbed
2 changed files with 12 additions and 21 deletions

View file

@ -13,7 +13,7 @@ from yunohost.diagnosis import Diagnoser
from yunohost.domain import domain_list, _build_dns_conf, _get_maindomain
YNH_DYNDNS_DOMAINS = ["nohost.me", "noho.st", "ynh.fr"]
SPECIAL_USE_TLDS = ["local", "localhost", "onion", "dev", "test"]
class DNSRecordsDiagnoser(Diagnoser):
@ -29,9 +29,9 @@ class DNSRecordsDiagnoser(Diagnoser):
for domain in all_domains:
self.logger_debug("Diagnosing DNS conf for %s" % domain)
is_subdomain = domain.split(".", 1)[1] in all_domains
is_localdomain = domain.endswith(".local")
is_specialusedomain = any(domain.endswith("." + tld) for tld in SPECIAL_USE_TLDS)
for report in self.check_domain(
domain, domain == main_domain, is_subdomain=is_subdomain, is_localdomain=is_localdomain
domain, domain == main_domain, is_subdomain=is_subdomain, is_specialusedomain=is_specialusedomain
):
yield report
@ -49,7 +49,7 @@ class DNSRecordsDiagnoser(Diagnoser):
for report in self.check_expiration_date(domains_from_registrar):
yield report
def check_domain(self, domain, is_main_domain, is_subdomain, is_localdomain):
def check_domain(self, domain, is_main_domain, is_subdomain, is_specialusedomain):
expected_configuration = _build_dns_conf(
domain, include_empty_AAAA_if_no_ipv6=True
@ -60,22 +60,14 @@ class DNSRecordsDiagnoser(Diagnoser):
if is_subdomain:
categories = ["basic"]
if is_localdomain:
if is_specialusedomain:
categories = []
if is_subdomain:
yield dict(
meta={"domain": domain, "category": "basic"},
data={},
status="WARNING",
summary="diagnosis_domain_subdomain_localdomain",
)
else:
yield dict(
meta={"domain": domain, "category": "basic"},
data={},
status="INFO",
summary="diagnosis_domain_localdomain",
)
yield dict(
meta={"domain": domain},
data={},
status="INFO",
summary="diagnosis_dns_specialusedomain",
)
for category in categories:

View file

@ -183,6 +183,7 @@
"diagnosis_dns_discrepancy": "The following DNS record does not seem to follow the recommended configuration:<br>Type: <code>{type}</code><br>Name: <code>{name}</code><br>Current value: <code>{current}</code><br>Expected value: <code>{value}</code>",
"diagnosis_dns_point_to_doc": "Please check the documentation at <a href='https://yunohost.org/dns_config'>https://yunohost.org/dns_config</a> if you need help about configuring DNS records.",
"diagnosis_dns_try_dyndns_update_force": "This domain's DNS configuration should automatically be managed by YunoHost. If that's not the case, you can try to force an update using <cmd>yunohost dyndns update --force</cmd>.",
"diagnosis_dns_specialusedomain": "Domain {domain} is based on a special-use top-level domain (TLD) and is therefore not expected to have actual DNS records.",
"diagnosis_domain_expiration_not_found": "Unable to check the expiration date for some domains",
"diagnosis_domain_not_found_details": "The domain {domain} doesn't exist in WHOIS database or is expired!",
"diagnosis_domain_expiration_not_found_details": "The WHOIS information for domain {domain} doesn't seem to contain the information about the expiration date?",
@ -190,8 +191,6 @@
"diagnosis_domain_expiration_warning": "Some domains will expire soon!",
"diagnosis_domain_expiration_error": "Some domains will expire VERY SOON!",
"diagnosis_domain_expires_in": "{domain} expires in {days} days.",
"diagnosis_domain_localdomain": "Domain {domain}, with a .local TLD, is not expected to have DNS records as it can be discovered through mDNS.",
"diagnosis_domain_subdomain_localdomain": "Domain {domain} is a subdomain of a .local domain. Zeroconf/mDNS discovery only works with first-level domains.",
"diagnosis_services_running": "Service {service} is running!",
"diagnosis_services_conf_broken": "Configuration is broken for service {service}!",
"diagnosis_services_bad_status": "Service {service} is {status} :(",