Re: dlz ignores connection to postgres database

Todd Lyons <[email protected]> Wed, 21 Mar 2012 13:28:16 -0700
Newsgroups gmane.network.dns.bind9.dlz
Message-ID <CAFG21ohc0cs46MZaD2e_qBUQvwNck1v8SWoHKC7ccsm6ZJRjSw@mail.gmail.com>
2012/3/21 data tanger <[email protected]>:
> Hi everyone,
>
> I tried to use the Bind Dlz driver but I can't get it to connect to the
> database.When I start Bind, I don't see any error but I think it
> ignores the connection to
> the database.
> I tried both Postgresql and Mysql with no success.

First debugging step, enable query logging, or use tcpdump and dump
the raw packets to see the query and the response.

> Here's what I added to the named.conf file:
>
> dlz "PostgresZone" {
> database "postgres
> {host=localhost port=5432 dbname=dnsdb user=dnsuser}
> {SELECT id FROM zones WHERE zone = lower('%zone%') LIMIT 1}

You're returning the id from the query, when all of the examples (and
my working config on mysql) return the zone field.  Change that, see
if it works.

> {SELECT ttl, ttype, mx_priority, ddata FROM zones z, rrset r WHERE
> z.id=r.zid
> AND zone = lower('%zone%') AND host = lower('%record%') AND type NOT
> IN('SOA','NS')}
> {SELECT ttl, ttype, mx_priority, ddata, resp_person, serial, refresh,
> retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid AND zone =
> lower('%zone%') AND type IN('SOA','NS')}
> {SELECT ttl, ttype, host, mx_priority, ddata, resp_person, serial,
> refresh, retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid	
> AND zone = lower('%zone%'}
> {SELECT id FROM axfr WHERE zone = lower('%zone%' AND ip = '%client%'}";

And in your xfer query, you're again returning the id instead of the zone field.

> };
>
> Any help please?

Try those and see what happens.

...Todd

-- 
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. -- Martin Golding

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure