Scripting PowerDNS RecursorΒΆ
In the PowerDNS Recursor, it is possible to modify resolving behaviour using simple scripts written in the Lua programming language.
Lua scripts can be used for load balancing, legal reasons, commercial purposes, to quickly block dangerous domains or override problematic responses.
Because Lua is extremely fast and lightweight, it easily supports hundreds of thousands of queries per second. The Lua language is explained very well in the excellent book Programming in Lua. If you already have programming experience, Learn Lua in 15 Minutes is a great primer.
For extra performance, a Just In Time compiled version of Lua called LuaJIT is supported.
Note
PowerDNS Recursor is capable of handling many queries simultaneously using cooperative user space multi-threading. Blocking functions called from Lua are not cooperative and will monopolize a worker thread while blocked. Avoid blocking calls.
- Configuring Lua scripts
- The DNSQuestion (
dq) object - DNSHeader Object
- DNSRecord Object
- The EDNSOptionView Class
- The ProxyProtocolValue Class
- DNS names and comparing them
- DNS Record
- The
ComboAddressclass - Netmasks and NetMaskGroups
- Policy Events
- Lua Scripting and Statistics
- Logging from the Lua scripts
- Intercepting queries with Lua
- Lua FFI API
- Other functions
- Checking available features