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:

  1. Implicit return mode: "functioncall(parameters)"
  2. 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

__construct(ConfigurationManager $config)

No description

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

Parameters

ConfigurationManager $config

ValidationResult validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validate a LUA record

Parameters

string $content

The content part of the record

string $name

The name part of the record

mixed $prio

The priority value (if applicable)

int|string|null $ttl

The TTL value

int $defaultTTL

The default TTL to use if not specified

mixed ...$args

Additional validator-specific parameters

Return Value

ValidationResult

ValidationResult containing validated data or error messages