mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
SPF Optimizer: Enable the use of TXTMulti records to support longer SPF records (#794)
* Add multiple string support to SPF optimizer Notes: * This implements [RFC 4408][rfc] for the SPF optimizer. Allowing for more SPF records to fit within the 10 lookups by using multiple strings. * By default the max size of the TXT remains at 255. Meaning users will still only get a single 255 length string unless they modify `txtMaxSize` and opt into this feature. * The general recommendation when using multiple strings for TXT records is to keep the size within a single UDP packet. It seems like the maximum size for this depends on a bunch of factors that are sometimes outside of your control. A similar tool has a [formula for estimating the maximum allowed size][formula]. However I felt giving a user configurable size would fit with the current configuration style that dnscontrol has. Similar to how dnscontrol recommends only flattening a record if absolutely needed, I can see this length being increased by only enough to get you within 10 lookups. [rfc]: https://tools.ietf.org/html/rfc4408#section-3.1.3 [formula]: https://github.com/oasys/mkspf/blob/master/Overhead.md * Add a nice comment for the Chunks function
This commit is contained in:
@ -733,6 +733,7 @@ var FRAME = recordBuilder('FRAME');
|
||||
// split: The template for additional records to be created (default: '_spf%d')
|
||||
// flatten: A list of domains to be flattened.
|
||||
// overhead1: Amout of "buffer room" to reserve on the first item in the spf chain.
|
||||
// txtMaxSize: The maximum size for each TXT string. Values over 255 will result in multiple strings (default: '255')
|
||||
|
||||
function SPF_BUILDER(value) {
|
||||
if (!value.parts || value.parts.length < 2) {
|
||||
@ -771,6 +772,10 @@ function SPF_BUILDER(value) {
|
||||
p.overhead1 = value.overhead1;
|
||||
}
|
||||
|
||||
if (value.txtMaxSize) {
|
||||
p.txtMaxSize = value.txtMaxSize;
|
||||
}
|
||||
|
||||
// Generate a TXT record with the metaparameters.
|
||||
if (value.ttl) {
|
||||
r.push(TXT(value.label, rawspf, p, TTL(value.ttl)));
|
||||
|
Reference in New Issue
Block a user