From 35796078c276e3b0671c1319be87352e292bb04f Mon Sep 17 00:00:00 2001 From: Sasha Romijn Date: Tue, 3 Dec 2024 19:50:24 +0000 Subject: [PATCH] fixes --- checks/http_client.py | 4 ++-- checks/resolver.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/checks/http_client.py b/checks/http_client.py index b9d08b689..3ce6da07e 100644 --- a/checks/http_client.py +++ b/checks/http_client.py @@ -119,9 +119,9 @@ def http_get_af( Other (kw)args are passed to requests.get. """ if af == socket.AF_INET6: - ips = resolve_aaaa(hostname) + ips, _ = resolve_aaaa(hostname) else: - ips = resolve_a(hostname) + ips, _ = resolve_a(hostname) exc = NoIpError(f"Unable to resolve {'AAAA' if af == socket.AF_INET6 else 'A'} record for host '{hostname}'") for ip in ips: try: diff --git a/checks/resolver.py b/checks/resolver.py index d9cfe2847..17a423886 100644 --- a/checks/resolver.py +++ b/checks/resolver.py @@ -27,29 +27,29 @@ def from_message(cls, message: Message): return cls(DNSSECStatus.UNSIGNED) -def resolve_a(label: str, allow_bogus=False) -> Tuple[List[str], DNSSECStatus]: +def resolve_a(label: str, allow_bogus=True) -> Tuple[List[str], DNSSECStatus]: rrset, dnssec_status = resolve(label, RdataType.A, allow_bogus) return [rr.address for rr in rrset], dnssec_status -def resolve_aaaa(label: str, allow_bogus=False) -> Tuple[List[str], DNSSECStatus]: +def resolve_aaaa(label: str, allow_bogus=True) -> Tuple[List[str], DNSSECStatus]: rrset, dnssec_status = resolve(label, RdataType.AAAA, allow_bogus) return [rr.address for rr in rrset], dnssec_status -def resolve_txt(label: str, allow_bogus=False) -> Tuple[List[str], DNSSECStatus]: +def resolve_txt(label: str, allow_bogus=True) -> Tuple[List[str], DNSSECStatus]: rrset, dnssec_status = resolve(label, RdataType.TXT, allow_bogus) return [rr.to_text()[1:-1] for rr in rrset], dnssec_status -def resolve_spf(label: str, allow_bogus=False) -> Tuple[Optional[str], DNSSECStatus]: +def resolve_spf(label: str, allow_bogus=True) -> Tuple[Optional[str], DNSSECStatus]: strings, dnssec_status = resolve_txt(label, allow_bogus) spf_records = [s for s in strings if s.lower().startswith("v=spf1")] result = spf_records[0] if len(spf_records) == 1 else None return result, dnssec_status -def resolve(label: str, rr_type: RdataType, allow_bogus=False): +def resolve(label: str, rr_type: RdataType, allow_bogus=True): answer = get_resolver().resolve(dns.name.from_text(label), rr_type) dnssec_status = DNSSECStatus.from_message(answer.response) if dnssec_status == DNSSECStatus.BOGUS and not allow_bogus: