You are here

PowerDNS

I installed and set up PowerDNS and a few things came to my attention, which I thought worthy of note.

1. The supplied pdns.conf does not contain example gmysql elements which would be helpful, especially as they recommend mysql.

2. When testing my config as per their instructions, I came across an error: -

gmysql Connection failed: Unable to connect to database: Access denied for user ''@'localhost' to database pdns

This was caused by my config not including a gmysql-password entry because as soon as I added one, pdns started to use the specified user & password. This config works for me: -

% grep -v "^#" /etc/pdns/pdns.conf | grep -v "^$"
setuid=pdns
setgid=pdns
allow-recursion=10.6.8.0/24
config-dir=/etc/pdns
launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdns
gmysql-password=pdns
gmysql-dbname=pdns
recursor=10.6.8.1
webserver=yes
webserver-address=0.0.0.0

3. When converting my old config (named.conf and 'bind' zonefiles) to pdns format (in my case, SQL INSERT queries for the mysql backend), I tried using 'zone2sql' but a couple of things caused me to have to take manual action...

3.1 The INSERTs INTO the domains table were scattered throughout the resulting output but as the INSERTs INTO the records table, rely on there already being domains and I passed the output through 'sort' to get around this: -

zone2sql --gmysql | sort

3.2 The most problematic issue though, is that when the domains get inserted they are appended with a dot '.' as shown: -

mysql> select * from domains;
+----+-------------------------------------------------------------------------+--------+------------+--------+-----------------+---------+
| id | name                                                                    | master | last_check | type   | notified_serial | account |
+----+-------------------------------------------------------------------------+--------+------------+--------+-----------------+---------+
| 20 | 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa. | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 21 | 0.0.127.in-addr.arpa.                                                   | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 22 | 0.in-addr.arpa.                                                         | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 23 | 255.in-addr.arpa.                                                       | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 24 | 8.6.10.in-addr.arpa.                                                    | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 25 | hq.rainbow-it.net.                                                      | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 26 | localdomain.                                                            | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 27 | localhost.                                                              | NULL   |       NULL | NATIVE |            NULL | NULL    | 
| 28 | .                                                                       | NULL   |       NULL | NATIVE |            NULL | NULL    | 
+----+-------------------------------------------------------------------------+--------+------------+--------+-----------------+---------+
9 rows in set (0.00 sec)

However, the INSERTs INTO the records table do not take this into account (as shown): -

insert into records (domain_id, name,type,content,ttl,prio) select id ,'xbox-ethernet.hq.rainbow-it.net', 'A', '10.6.8.58 ', 3600, 0 from domains where name='hq.rainbow-it.net';

I had to add the dot in vi like this (I'd have used sed but I was already in vi): -

:%s/';$/.';/g

I could have done it all on the command line like this: -

zone2sql --gmysql | sort | sed -e 's/';$/.';/g'