[Pdns-users] LUA script to change TTL based on answer?

jahlives jahlives at gmx.ch
Thu Sep 12 07:57:41 UTC 2019


okay found that I can use postresolve to manipulate the responses

function postresolve(dq)
	local records = dq:getRecords()
	for k,v in pairs(records) do
		if v.type == pdns.DS and v.place ~= 1
		then
			v.ttl=86400
		end
	end
	dq:setRecords(records)
	return true
end

but now the problem is how to define the case where TTL has to be
changed. The only thing I found so far in the response is the fact that
no answer section is returned. So I thought place should be right, so I
wanted to check if there is no answer section (~= 1) and change TTL
then. Seems not have any effect on the DS queries which have not answer
section in responses.

Am I missing something or is it simply not possible the way I thought?

Thanks

tobi

Am 12.09.19 um 08:39 schrieb jahlives:
> Hello
>
> I'm quite new to pdns, used bind before for ages :-)
>
> I wonder if the following would be possible with a LUA script in pdns
> recursor:
> I enforce quite low TTL on pnds-rescuror and dnssec validation is on.
> The low TTL makes me headache for queries to check if a domain is dnssec
> enabled at all. As most of them are not those negative answers are
> cached with the low TTL, therefore my pdns-resursor makes unnessecary
> queries.
> So I wondered if I could use a LUA script to manipulate the TTL for just
> those negative answers to higher TTL in cache. That way the amount of
> unnessecary queries would be reduced. I'm aware that enforce low TTL in
> first place might be against RFC but in my use case I need the low TTL
> (mostly) :-)
>
> Thanks for any help/idea
>
> tobi
>
>
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-users
>


More information about the Pdns-users mailing list