Skip to content
gmanika edited this page Sep 13, 2010 · 8 revisions

This is an experimental fork of PowerDNS with improved Lua scripting. Please, do not use this repository without extreme care because:

  • It may be broken
  • It may perform poorly
  • It may be out of date with the official SVN

So far, what we have is an extension of the pdns_recursor's Lua hooks. PowerDNS already supports nxdomain() to intercept invalid (NX) requests and preresolve() to intercept any query before it's executed.

We now added postresolve(), which lets you intercept and change the results of a query AFTER it's been executed. Example:

``lua function postresolve ( remoteip, domain, qtype, results) print ("postresolve called for: ", remoteip, getlocaladdress(), domain, qtype) evil = "10.66.6.1" safe = "64.233.163.104" for i, r in ipairs(results) do if r['content'] == evil then ret = {} ret[1]={qtype=pdns.A, content=safe, ttl=3600} return 0, ret end return -1, {} end 69,1 Fim


As of 3.3-rc2, there is a new setvariable() function that is exported to Lua which controls whether the result should be cached. This should also work for postresolve queries.

- Guilherme Manika <[email protected]> 
Clone this wiki locally