Skip to content

Instantly share code, notes, and snippets.

@42wim
Created February 24, 2014 22:33
Show Gist options
  • Select an option

  • Save 42wim/9198691 to your computer and use it in GitHub Desktop.

Select an option

Save 42wim/9198691 to your computer and use it in GitHub Desktop.
PowerDNS LUA script which blocks AAAA responses to specific IP's
function postresolve ( remoteip, domain, qtype, records, origrcode )
print ("postresolve called for: ", remoteip, getlocaladdress(), domain, qtype, origrcode)
setvariable()
if not matchnetmask(remoteip, {"10.100.0.0/15", "10.0.0.1/32"}) then return -1, ret end -- passthrough for "normal" ips
for key,val in ipairs(records)
do
if val.qtype == pdns.AAAA
then
return 0, {} -- drop the answer if we get an AAAA
end
end
return origrcode, records
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment