Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #recursor.conf
- allow-from=0.0.0.0/0
- dont-query=
- local-address=0.0.0.0
- local-port=53
- quiet=yes
- setgid=pdns
- setuid=pdns
- lua-dns-script=/usr/local/bin/rec.lua
- # rec.lua
- function preresolve ( ip, domain, qtype )
- --- require "luasql.mysql"
- --- env = assert(luasql.mysql())
- --- conn = assert(env:connect("powerdns", "powerdns", "fL3Su54vtO", "localhost"))
- --- conn:setautocommit(true)
- require "luasql.postgres"
- env = assert (luasql.postgres())
- conn = assert(env:connect("pdns","pdns","dFIC7krpxK","localhost"))
- function rows (connection, sql_statement)
- local cursor = assert (connection:execute (sql_statement))
- return function ()
- return cursor:fetch()
- end
- end
- --- domain="google.com"
- --- ip="127.0.0.1"
- --- query="select count(domain) as count from domains where concat(domain,'.')='"..domain.."' and email=(select IFNULL((select email from clients where ip='"..ip.."'),'[email protected]'))"
- --- query="select count(domain) as count from domains where domain||'.'='"..domain.."' and email=(select email from clients where ip='"..ip.."')"
- --- query="select count(domain) as count from domains where domain||'.'='"..domain.."' and email=(select COALESCE((select email from clients where ip='"..ip.."'),'[email protected]'))"
- query="select count(domain) as count from domains where domain||'.'='"..domain.."' and (email=(select email from clients where ip='"..ip.."') or email='[email protected]')"
- print (string.format ("%s", query))
- for count in rows (conn, query) do
- if count == "0"
- then return 0, {{qtype=pdns.A, content="12.12.12.12"}}
- else return -1
- end
- end
- end
- function nxdomain ( ip, destination, domain, qtype )
- return 3, {}
- end
Advertisement
Add Comment
Please, Sign In to add comment