Référence : http://www.linuxnetworks.de/doc/index.php/PowerDNS_LDAP_Backend

Configuration des entrées dans OpenLDAP

Je pars du principe que vous avez un serveur LDAP fonctionnel.

Pour stocker les informations DNS votre annuaire OpenLDAP il y a deux possibilités soit utiliser le schéma standard de LDAP (cosine) avec les entrées dNSDomain mais qui ne vous permettra pas de faire du « reverse lookup » ou utiliser le schéma proposé par pdns-backend-ldap avec les entrées dNSDomain2 qui supprime la limitation précédente.

Ajouter le schéma dnsdomain2.schema dans votre LDAP (/etc/ldap/schema/dnsdomain2.schema) :
# A schema for storing DNS zones in LDAP
#
# ORDERING is not necessary, and some servers don't support
# integerOrderingMatch. Omit or change if you like

attributetype ( 1.3.6.1.4.1.2428.20.0.0  NAME 'dNSTTL'
        DESC 'An integer denoting time to live'
        EQUALITY integerMatch
        ORDERING integerOrderingMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )

attributetype ( 1.3.6.1.4.1.2428.20.0.1 NAME 'dNSClass'
        DESC 'The class of a resource record'
        EQUALITY caseIgnoreIA5Match
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.11 NAME 'wKSRecord'
        DESC 'a well known service description, RFC 1035'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.12 NAME 'pTRRecord'
        DESC 'domain name pointer, RFC 1035'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.13 NAME 'hInfoRecord'
        DESC 'host information, RFC 1035'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.14 NAME 'mInfoRecord'
        DESC 'mailbox or mail list information, RFC 1035'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.16 NAME 'tXTRecord'
        DESC 'text string, RFC 1035'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.17 NAME 'rPRecord'
        DESC 'for Responsible Person, RFC 1183'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.18 NAME 'aFSDBRecord'
        DESC 'for AFS Data Base location, RFC 1183'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.24 NAME 'SigRecord'
        DESC 'Signature, RFC 2535'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.25 NAME 'KeyRecord'
        DESC 'Key, RFC 2535'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.27 NAME 'gPosRecord'
        DESC 'Geographical Position, RFC 1712'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.28 NAME 'aAAARecord'
        DESC 'IPv6 address, RFC 1886'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.29 NAME 'LocRecord'
        DESC 'Location, RFC 1876'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.30 NAME 'nXTRecord'
        DESC 'non-existant, RFC 2535'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.33 NAME 'sRVRecord'
        DESC 'service location, RFC 2782'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.35 NAME 'nAPTRRecord'
        DESC 'Naming Authority Pointer, RFC 2915'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.36 NAME 'kXRecord'
        DESC 'Key Exchange Delegation, RFC 2230'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.37 NAME 'certRecord'
        DESC 'certificate, RFC 2538'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.38 NAME 'a6Record'
        DESC 'A6 Record Type, RFC 2874'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.39 NAME 'dNameRecord'
        DESC 'Non-Terminal DNS Name Redirection, RFC 2672'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.42 NAME 'aPLRecord'
        DESC 'Lists of Address Prefixes, RFC 3123'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.43 NAME 'dSRecord'
        DESC 'Delegation Signer, RFC 3658'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.44 NAME 'sSHFPRecord'
        DESC 'SSH Key Fingerprint, RFC 4255'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.45 NAME 'iPSecKeyRecord'
        DESC 'SSH Key Fingerprint, RFC 4025'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.46 NAME 'rRSIGRecord'
        DESC 'RRSIG, RFC 3755'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.47 NAME 'nSECRecord'
        DESC 'NSEC, RFC 3755'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.48 NAME 'dNSKeyRecord'
        DESC 'DNSKEY, RFC 3755'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.49 NAME 'dHCIDRecord'
        DESC 'DHCID, RFC 4701'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

attributetype ( 1.3.6.1.4.1.2428.20.1.99 NAME 'sPFRecord'
        DESC 'Sender Policy Framework, RFC 4408'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

objectclass ( 1.3.6.1.4.1.2428.20.2 NAME 'dNSDomain2'
        SUP 'dNSDomain' STRUCTURAL
        MAY ( DNSTTL $ DNSClass $ WKSRecord $ PTRRecord $
                HINFORecord $ MINFORecord $ TXTRecord $ RPRecord $
                AFSDBRecord $ SIGRecord $ KEYRecord $ GPOSRecord $
                AAAARecord $ LOCRecord $ NXTRecord $ SRVRecord $
                NAPTRRecord $ KXRecord $ CERTRecord $ A6Record $
                DNAMERecord $ APLRecord $ DSRecord $ SSHFPRecord $
                IPSECKEYRecord $ RRSIGRecord $ NSECRecord $
                DNSKEYRecord $ DHCIDRecord $ SPFRecord
        ) )
Il vous faut maintenant ajouter à votre configuration LDAP le schema dNSDomain2 et les index pour accélérer les requêtes (/etc/ldap/slapd.conf):
include         /etc/ldap/schema/dnsdomain2.schema

index   aRecord                 pres,eq
index   associatedDomain        pres,eq,sub
IMPORTANT : Reconstruction des index et relance du service LDAP
# /etc/init.d/slapd stop && slapindex -v && chown openldap:openldap /var/lib/ldap/* && /etc/init.d/slapd start
Installation et paramétrage de powerDNS:

Sous Debian trois paquets vont être nécessaires :

pdns-server : Le serveur DNS en lui même qui interceptera les demandes sur le port UDP 53 et y répondra.
pdns-recursor : Le « récurseur » qui contactera le backends LDAP pour fournir à pdns-server les informations demandées.
pdns-backend-ldap : Le module de connexion à l’annuaire LDAP.
apt-get install pdns-backend-ldap pdns-recursor pdns-server
Éditer les fichiers /etc/powerdns/pdns.conf et /etc/powerdns/recursor.conf et enfin /etc/powerdns/pdns.d/pdns.ldap.
# vi /etc/powerdns/pdns.conf

allow-recursion=127.0.0.1, 192.168.0.0/24
launch=ldap
config-dir=/etc/powerdns
daemon=yes
disable-axfr=yes
guardian=yes
lazy-recursion=yes
local-address=192.168.0.1
local-port=53
module-dir=/usr/lib/powerdns
recursor=127.0.0.1:54
setgid=pdns
setuid=pdns
socket-dir=/var/run
version-string=powerdns
include=/etc/powerdns/pdns.d
# vi /etc/powerdns/recursor.conf
allow-from=127.0.0.0/8, 192.168.0.0/24
dont-query=
local-address=127.0.0.1
local-port=54
quiet=yes
setgid=pdns
setuid=pdns
# touch /etc/powerdns/pdns.d/pdns.ldap
# vi /etc/powerdns/pdns.d/pdns.ldap
ldap-host=127.0.0.1:389
ldap-basedn=ou=DNS,dc=homelinux,dc=net
ldap-method=strict
Lancement des services de powerDNS
/etc/init.d/pdns start && /etc/init.d/pdns-recursor start