From 460e39a2f0c278a60ef051cc03920e7656e56fa0 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Tue, 20 Jun 2023 15:20:51 +0200 Subject: [PATCH] Support multiple TXT entries for TLD The dig of TXT for @ can returns multiple entries. In that case, the DNS diagnosis fails. The modification preserves the handling of DMARC and the likes which use a single entry and a specfic domain name. For single entry list, the behavior is preserved. If mutliple TXT entries are defined for @, only the v=spf1 one is returned. Signed-off-by: Nicolas Palix --- src/diagnosers/12-dnsrecords.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/diagnosers/12-dnsrecords.py b/src/diagnosers/12-dnsrecords.py index 2d46f979c..be9bf5418 100644 --- a/src/diagnosers/12-dnsrecords.py +++ b/src/diagnosers/12-dnsrecords.py @@ -182,6 +182,10 @@ class MyDiagnoser(Diagnoser): if success != "ok": return None else: + if type_ == "TXT" and isinstance(answers,list): + for part in answers: + if part.startswith('"v=spf1'): + return part return answers[0] if len(answers) == 1 else answers def current_record_match_expected(self, r):