[Pdns-users] Make LUA Script Conditional on Existence of A Records
Jeremy Jones
jeremy at myfacetwittertube.com
Fri Oct 11 16:54:50 UTC 2024
Trying to get a lua script together that will filter out AAAA records in
response to client requests, if and only if the result of the original
query returns at least one A record. If the result of the client's request
results in only AAAA records, those AAAA records should be returned to the
client. I have a "filter all AAAA" lua script that strips all AAAA records
implemented in pdns-recursor, but I need to make it meet the conditions
above:
-- This function strips AAAA (IPv6) records for all domains
function preventIPv6ForAllDomains(dq)
-- Only proceed if the query is for AAAA (IPv6) records
if dq.qtype ~= pdns.AAAA then
return false -- If it's not a AAAA query, allow it
end
-- Filter out the AAAA query by setting the rcode to 0 (NOERROR)
dq.rcode = pdns.NOERROR
return true -- Indicate that the query was handled
end
-- Apply the function to all queries in the preresolve phase
function preresolve(dq)
return preventIPv6ForAllDomains(dq)
end
Thanks!
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20241011/8d2910c4/attachment.htm>
More information about the Pdns-users
mailing list