URL: https://linuxfr.org/forums/linux-general/posts/comment-remplir-une-base-sql-pour-powerdns Title: Comment remplir une base SQL pour PowerDNS ? Authors: flan Date: 2015年08月18日T00:37:46+02:00 License: CC By-SA Tags: postgresql, dns et powerdns Score: 0 Bonjour à tous, Je cherche à utiliser un PowerDNS avec un backend PostgreSQL, en remplissant la base avec un script. Malheureusement, il n'y a pas tellement d'exemples de ce genre :( on ne sait pas trop comment remplir la base. Actuellement, j'ai un domaine (test.example.org), avec une machine (openldap.test.example.org) et un alias (directory01.test.example.org) qui pointe vers cette machine. Pour le serveur DNS, j'ai un recursor qui renvoie vers le serveur DNS quand ça tombe dans le bon domaine, et qui renvoie vers d'autres serveurs DNS dans les autres cas. Voici le contenu de ma base PSQL, et de mes fichiers de conf : powerdns=> select * from records; id | domain_id | name | type | content | ttl | prio | change_date | disabled | ordername | auth ----+-----------+------------------+-------+------------------------------------------------------------------------------+-------+------+-------------+----------+-----------+------ 1 | 1 | test.example.org | NS | directory01.test.example.org | 86400 | 0 | | | | 2 | 1 | test.example.org | SOA | directory01.test.example.org admin@test.example.org 1 10800 3600 604800 3600 | 86400 | 0 | | | | 3 | 1 | directory01 | CNAME | openldap.test.example.org | 3600 | 0 | | | | 4 | 1 | openldap | A | 192.168.56.101 | 3600 | | | | | 5 | 1 | 192.168.56.101 | PTR | openldap.test.example.org | 3600 | | | | | 6 | 1 | openldap | SSHFP | 2 1 ee43e37ed3d8526f212dbd833439fbe623121105 | 3600 | | | | | (6 rows) powerdns=> select * from domains; id | name | master | last_check | type | notified_serial | account ----+------------------+--------+------------+--------+-----------------+--------- 1 | test.example.org | | | NATIVE | | # cat /etc/powerdns/pdns.conf default-soa-mail=admin@test.example.org local-port=54 local-address=127.0.0.1:54 launch=gpgsql gpgsql-host=localhost gpgsql-user=powerdns gpgsql-dbname=powerdns gpgsql-password=toto gpgsql-dnssec=yes # cat /etc/powerdns/recursor.conf allow-from=127.0.0.1,192.168.56.0/24,::1 local-port=53 forward-zones=test.example.org=127.0.0.1:54,.=8.8.8.8;8.8.4.4 local-address=127.0.0.1,::1,192.168.56.101 (vous noterez la qualité des mots de passe) Voilà ce que me donne dig : root@openldap:~# dig openldap.test.example.org @127.0.0.1 -p 54 ; <> DiG 9.9.5-9ubuntu0.2-Ubuntu <> openldap.test.example.org @127.0.0.1 -p 54 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8647 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1680 ;; QUESTION SECTION: ;openldap.test.example.org. IN A ;; Query time: 6 msec ;; SERVER: 127.0.0.1#54(127.0.0.1) ;; WHEN: Tue Aug 18 00:26:25 CEST 2015 ;; MSG SIZE rcvd: 54 root@openldap:~# dig openldap.test.example.org @127.0.0.1 ; <> DiG 9.9.5-9ubuntu0.2-Ubuntu <> openldap.test.example.org @127.0.0.1 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 34989 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;openldap.test.example.org. IN A ;; Query time: 26 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Tue Aug 18 00:26:26 CEST 2015 ;; MSG SIZE rcvd: 43 Si vous savez pourquoi je n'ai pas de réponse DNS, je suis preneur !

AltStyle によって変換されたページ (->オリジナル) /