0

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?

Robbietjuh
  • 848
  • 1
  • 8
  • 22
  • Not sure if I understood your question, what do you mean by "notice how the script does not get called again" – macroland May 22 '16 at 04:21
  • If you create a Lua script with the example code and set it to be run within Powerdns' configuration, you'll notice that the script does not get called again upon resolving the cname that it returns to the client (`qtype 5` is a cname record, so PowerDNS will resolve `example.com` but does not do a 'second' call to `postresolve`) – Robbietjuh May 23 '16 at 00:04

0 Answers0