dnscontrol icon indicating copy to clipboard operation
dnscontrol copied to clipboard

Improve SPF_BUILDER

Open SuperSandro2000 opened this issue 9 months ago • 9 comments

Is your feature request related to a problem? Please describe. I would like to propose that the SPF_BUILDER is changed to be a bit higher level as the DMARC_BUILDER already is and to contain some good defaults like to always start with v=spf1.

Describe the solution you'd like I would like to turn the parts atrribute of the SPF_BUILDER to be an "inner working" and that it is by default filled with v=spf1. Then there should be an include directive which contains only the domains which are later prefixed with include: and written in the now hidden parts attribute. For parts to be fully hidden we would also need to add ip4 and ip6 which would also just prefix their respective names. Then we probably need boolean options for mx, -all and ~all.

Describe alternatives you've considered Scripting it by hand in my config.

Additional context I like the DMARC_BUILDER. It is very easy to use.

SuperSandro2000 avatar Apr 17 '25 02:04 SuperSandro2000

These are some excellent points. SPF_BUILDER was our first builder and we've learned a lot since it was created.

(NOTE: I'm working on a way for builders to be written in Go, therefore enabling better testing. Sadly this won't be merged into the product for a few months (I've got a big work project due in July).)

tlimoncelli avatar Apr 21 '25 15:04 tlimoncelli

Feel free to give me a ping when that is ready. I maybe can find some time to do it on top of go.

SuperSandro2000 avatar Apr 22 '25 12:04 SuperSandro2000

FYI: I'm postponing the ability to write builders in Go.

tlimoncelli avatar Jul 25 '25 16:07 tlimoncelli

giving SPF_BUILDER a ttl object causes it to be converted to 300?

var TTL_DAY    =  TTL(86400);

function PROTECT_NAME(name, ttl) {
	return [
		SPF_BUILDER({
			label: name,
			parts: [
				"v=spf1",
				"redirect=mail.example.com",
			],
			ttl: ttl,
		}),
		CNAME("*._domainkey." + name, "mail._domainkey.example.com.", ttl),

		MX(name, 0, ".", ttl),
		MX("*." + name, 0, ".", ttl),
	];
}

D(...
	PROTECT_NAME("test", TTL_DAY),
);

Suggestion, accept int or a TTL object?

Gunni avatar Nov 30 '25 11:11 Gunni