Today i got asked on twitter on how i did my PowerDNS Setup with DataMapper, so i thought “why not make a post out of it?”. Anyway, the code is pretty straight forward.

DNS Zone

In my Setup, i have 2 different Models for DNS Names, one being DNS Zone and the other being the related DNS Domain (rdbms mapping to my upstream domain registries). Today we’ll only handle DNS Zone as DNS Domain would be part of my DNS Robot.

Here is the model for the DNS Zone which is pretty straight forward:

DNS Record

Now this also is not much of a mystery, but i guess you’ll like the generate_serial method which will auto-increment your zones serial accordingly.


At first, we need to define the DB-connection:


Since my schema is not really compatible with PowerDNS, i’ve created two views to make it compatible:

Final steps

Adjust your pdns.conf to your needs, this is important (at least for me), since i don’t want unauthorized AXFR requests which would give an attacker even more targets to focus on.

Anyway, i hope this helps some of you getting your PowerDNS populated, the GUI part is all for your imagination. ;)

best regards