From 4b876ff07f773e1999c84ab73b0b2bc66fde6e38 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 21 Jan 2021 16:25:58 +0100 Subject: [PATCH] Handle case where DKIM record is split into several pieces --- data/hooks/diagnosis/12-dnsrecords.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/hooks/diagnosis/12-dnsrecords.py b/data/hooks/diagnosis/12-dnsrecords.py index 941911147..cb8193dd5 100644 --- a/data/hooks/diagnosis/12-dnsrecords.py +++ b/data/hooks/diagnosis/12-dnsrecords.py @@ -130,8 +130,11 @@ class DNSRecordsDiagnoser(Diagnoser): # Split expected/current # from "v=DKIM1; k=rsa; p=hugekey;" # to a set like {'v=DKIM1', 'k=rsa', 'p=...'} + # Additionally, for DKIM, because the key is pretty long, + # some DNS registrar sometime split it into several pieces like this: + # "p=foo" "bar" (with a space and quotes in the middle)... expected = set(r["value"].strip(';" ').replace(";", " ").split()) - current = set(r["current"].strip(';" ').replace(";", " ").split()) + current = set(r["current"].replace('" "', '').strip(';" ').replace(";", " ").split()) # For SPF, ignore parts starting by ip4: or ip6: if r["name"] == "@":