DNS icon indicating copy to clipboard operation
DNS copied to clipboard

AlignedRdataFormatters::TXT() breaks Google site verification

Open laszlof opened this issue 1 year ago • 1 comments

Since moving over to using this library for some of our DNS handling, we've notice that google site verification is now broken for new domains.

This appears to be due to the fact that the above mentioned method is splitting the TXT records at 40 characters, presumably just for easier readability.

This results in split strings in the resulting record. From what I can gather, they should be concat'ing these strings together, but that does not appear to be happening.

After further reading, I found RFC4408, section 3.1.3. However, this specific RFC only related to SPF-type TXT records, and not general validation records such as the one used for Google Site Verification.

I've illustrated the issue below:

$ dig franklaszlo.com txt +short
"google-site-verification=FNI0xUTGqcdI8YX" "xaPf_3mj33BYnNtY23ddD2Zl1ECc"
$ grep -C2 site-verification zones/f/franklaszlo.com 
; TXT RECORDS
@                   300   IN TXT   ( 
                                     "google-site-verification=FNI0xUTGqcdI8YX"
                                     "xaPf_3mj33BYnNtY23ddD2Zl1ECc"
                                   )

Screenshot 2023-07-21 at 10 31 59 AM

I'm not sure what the best fix here is, other than changing the split to be the max, 255 characters, for TXT records.

Let me know if you need further information

laszlof avatar Jul 21 '23 14:07 laszlof

Hi @laszlof

The simplest path forward is to just use the ZoneBuilder class instead of the AlignedBuilder to render the zone.

Another option is to override the default TXT formatter with your own implementation AlignedBuilder->addRdataFormatter(). See Docs: AlignedZoneBuilder

samuelwilliams avatar Jul 24 '23 03:07 samuelwilliams