LUARecordValidator
class LUARecordValidator implements DnsRecordValidatorInterface (View source)
LUA record validator
LUA records allow PowerDNS to execute Lua scripts for dynamic DNS content generation. They are PowerDNS-specific and not standardized by IETF.
Format: Lua script that returns the appropriate DNS record value
The LUA record can be used in two ways:
- Implicit return mode: "functioncall(parameters)"
- Explicit return mode: ";if(condition) then return value else return othervalue end" (note the leading semicolon to indicate explicit return mode)
Common patterns:
- IP selection based on client location: "pickclosest({'192.0.2.1', '198.51.100.1'})"
- Conditional resolution: ";if(continent('EU')) then return '192.0.2.1' else return '198.51.100.1' end"
- Availability checks: "ifportup(443, {'192.0.2.1', '198.51.100.1'})"
SECURITY CONSIDERATIONS:
- LUA records must be explicitly enabled in PowerDNS configuration
- Never serve LUA records from untrusted sources
- LUA records can expose system information and potentially lead to system compromise
Methods
validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)
Validate a LUA record
Details
__construct(ConfigurationManager $config)
No description
ValidationResult
validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)
Validate a LUA record