bind + pgsql ANSI/PostgreSQL

bind-sdb.i386 24:9.2.5-3
Matched from:
BIND (Berkeley Internet Name Domain) is an implementation of the DNS
(Domain Name System) protocols. BIND includes a DNS server (named),
which resolves host names to IP addresses; a resolver library
(routines for applications to use when interfacing with DNS); and
tools for verifying that the DNS server is operating properly.

BIND SDB (Simplified Database Backend) provides named_sdb, the DNS
name server compiled to include support for using alternative Zone Databases
stored in an LDAP server (ldapdb), a postgreSQL database (pgsqldb), or in the
filesystem (dirdb), in addition to the standard in-memory RBT (Red Black Tree)
zone database.


CONFIGURE BIND TO USE THE POSTGRESQL DATABASE
=============================================

* The PostgreSQL database
-------------------------

First, create a database for this service (I do advice you to
have this DNS information in an own database, due to security)

Then add the PostgreSQL user you want named to connect as.

You should also know that if you don't give any user name in
the configuration the named will connect as the user named
is running.  (If root is running named, the PostgreSQL user
will be root)

Then create a reverse lookup table with something like this:

CREATE TABLE "reverse" (
        "ip" text,
        "ttl" int4,
        "rdtype" text,
        "rdata" text
);

You might want to restrict inserts, updates and selected to the
DNS tables with the REVOKE and GRANT commands.  The named users
will only need SELECT privilege, since named is not able to do any
updates.

Then you can create a table with the name lookups:

CREATE TABLE "example" (
        "name" text,
        "ttl" int4,
        "rdtype" text,
        "rdata" text
);

You might want to have a look on the pgsql_examples.sql to see how
the data should be inserted.


* Configure BIND
----------------

There is no major change in the configuration file for BIND when
you want to use this database interface instead the standard file
interface.

Exchange the 'file "dns_file";'
with 'database "pgsql <parameters>";'

That's all the "major" change

The parameters you can send is:

        pgsql <database> <table>
   or
        pgsql <database> <user name> <password> <table>

Look at the 'pgsql_examples.conf' file which is added in this directory


* Let's test it
---------------

The example files included are a working example ... so if you want to
test it, execute these commands ...

        createdb exampledb
        createuser named
        psql -f pgsql_examples.sql exampledb
        {path to named binary}/named -g -c pgsql_examples.conf

I do assume you know you should try to start named when you're logged in
as root *and* that there is no other named server running.

If you now do something like:  dig @127.0.0.1 axfr example.com
... and I assume that you received something familiar.


* Hints!
--------

- I've rewritten the database driver so it returns the error messages the
PostgreSQL backend gives ... so if you run named with the '-g' parameter
all error messages will appear on your terminal.

- All messages from the PostgreSQL driver will alway start with 'pgsqldb:'

- If you add the argument '-d{2,3,4}' to named, you will get even more
debug info from named, including the PostgreSQL driver.


트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://poorpuppet.egloos.com/tb/3286662 [도움말]

덧글

덧글 입력 영역