PowerDNS recursor provides functionality to implement backends through Lua. When the Lua script returns a set of records with a CNAME entry in it, the CNAME gets resolved by the external DNS servers that have been set without the Lua script being called upon resolving the record.
This is the process as it happens right now:
- Client: PowerDNS, resolve example.com, please?
- PowerDNS calls Lua script, which returns a CNAME pointing to anotherexample.com.
- PowerDNS resolves anotherexample.com through the DNS servers in its config, without calling the Lua script again.
In the last step, PowerDNS should ideally call the Lua script again before resolving through the external DNS servers.
You can reproduce this using the following Lua script:
function postresolve(remoteip, domain, qtype, origrecords, origrcode)
print ("Resolving through Lua.")
return {content = "example.com", ttl = 60, qtype = 5 }
end
Notice how the script does not get called again for resolving example.com (even though that would end in an endless loop. The idea is to be able to reproduce the problem).
Is it possible to re-resolve through Lua, and if so, what am I missing?