[Pdns-users] Dynamic name resolution using lua backend
Guilherme
guilherme.e at gmail.com
Sat Aug 23 14:37:31 UTC 2014
Hello!
I'm developing a dynamic name resolution service using lua backend to
provide cdn capabilities to some websites.
Consider this simple *example.com <http://example.com>* zone:
*name | type | content | flag cdn*
example.com | *A* | 1.1.1.1 | true
www.example.com | *CNAME* | example.com | false
Another considerations:
- when flag is enabled any query should return cdn server ip
- CDN server IP: 2.2.2.2
Queries and expected responses:
1) query to *example.com <http://example.com>* should return 2.2.2.2
2) query to *www.example.com <http://www.example.com>* should return *CNAME
example.com <http://example.com>* and *A 1.1.1.1*
In this case, the record *example.com <http://example.com>* has a flag
enabled that makes all name resolutions to it dynamic, so when
querying *example.com
<http://example.com> *luabackend returns a record pointing to *2.2.2.2 *and
not *1.1.1.1.* This is ok and works fine.
The problem occurs when querying *www.example.com
<http://www.example.com> *that
does not use this cdn flag . Here the step by step in the lua backend:
1) getsoa *www.example.com <http://www.example.com>*
2) getsoa *example.com <http://example.com>*
3) lookup *www.example.com <http://www.example.com>*
4) get *www.example.com <http://www.example.com>*
5) lookup *example.com <http://example.com>*
6) get *example.com <http://example.com>*
The returning record is *2.2.2.2*, because the flag is enabled in *example.com
<http://example.com>*, but I want to dynamic disable this flag when it's a
recursive query.
The first possibility that I see to resolve this problem is to determine if
a specific query is after recursion or not. Is it possible to identify in
lua backend when it's a recursive query?
Another approach would be return in the *step 3 *both records, to avoid
powerdns make recursive query in *example.com <http://example.com>* with
the flag enabled.
www.example.com *CNAME* example.com
example.com *A* 1.1.1.1 ***
*** the problem is how to make pdns stop querying for example.com again. I
tried to change *qname* to *example.com <http://example.com>* instead
*www.example.com
<http://www.example.com>* but it didn't work.
I know that it seems a little bit confused, but I appreciate any help.
Tks,
Guilherme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20140823/5ca2db85/attachment.html>
More information about the Pdns-users
mailing list