octodns / octodns-bind

RFC compliant (Bind9) provider for octoDNS
MIT License
7 stars 12 forks source link

Chunk long TXT records when using ZoneFileProvider #65

Open dagmartin opened 4 months ago

dagmartin commented 4 months ago

When generating a zone with long TXT records (for example DKIM records with 2048 bit keys), the TXT record becomes to long and named-checkzone fails to validate the zone. It seems that adding the following line to the ZoneFileProvider class splits up the record nicely:

if record._type in ('SPF', 'TXT'):
    # TXT values need to be quoted
    value = value.replace('"', '\\"')
    value = record.chunked_value(value)   <--- This line
    value = f'"{value}"'

I could make this into a pull request if needed.

ross commented 4 months ago

I think I ran into this when working on https://github.com/octodns/octodns/pull/1172 and addressed it there, but since that didn't ship, for now, it probably makes sense to get this sorted standalone. Will queue it up to look into.