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.


* 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

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

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

That's all the "major" change

The parameters you can send is:

        pgsql <database> <table>
        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 @ axfr
... 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.


  • 움트트움트 2010/06/17 14:28 # 삭제 답글

    bind-sdb 패치가... rpm 으로 제공되는건 pgsql이안되고, 기존 epgsqldb 프로젝트는 bind 9.1에서 쓸수있네요...
    최신버젼에서 가능하게 하는방법 혹시 아시면 답변 부탁드립니다.
  • 무혼인형 2010/06/25 16:03 #

    죄송합니다. 관련 프로젝트 한 지도 오래되었고 생각처럼 잘 안되어서 지금은 새로 DNS 서버를 개발 구축해서 사용하고 있어서 최신버전에서의 문제 까지는 잘 모르겠네요
댓글 입력 영역