Created
September 5, 2013 19:05
-
-
Save cmouse/6454629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
whitelist = { "google.com.", "cnn.com." } | |
function preresolve(remoteip, domain, qtype) | |
if (domain == ".") then | |
return -1, {} | |
end | |
-- skip top level domains | |
if (string.match(domain,"^[^.]+.?$")) then | |
return -1, {} | |
end | |
-- expensive | |
for _,dom in pairs(whitelist) do | |
local sub = string.sub(domain, -1 * string.len(dom)) | |
if (sub == dom) then | |
return -1, {} | |
end | |
end | |
return 0, {{qtype=pdns.CNAME, content="www.forbidden.com"}} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment