Ticket #225 (closed defect: fixed)

Opened 19 months ago

Last modified 17 months ago

'rec_control reload-zones' command ignores 'export-etc-hosts=off' and imports zones based on /etc/hosts

Reported by: anon Owned by: somebody
Priority: normal Milestone:
Component: component1 Version:
Severity: normal Keywords: pdns-recursor rec_control export-etc-hosts
Cc: paul@…

Description

Firstly I have populated /etc/hosts with a dummy record and restarted pdns-recursor *without* explictly disabling export-etc-hosts; however it seems the default value is honoured from a clean start:

[root@cac01 ~]# grep test.example.com /etc/hosts
192.0.2.1       test.example.com

[root@cac01 ~]# grep "export-etc-hosts" /etc/pdns-recursor/recursor.conf 
# export-etc-hosts      If we should serve up contents from /etc/hosts
# export-etc-hosts=off

[root@cac01 ~]# service pdns-recursor restart
Stopping pdns-recursor:                                    [  OK  ]
Starting pdns-recursor:                                    [  OK  ]

[root@cac01 ~]# dig @127.0.0.1 test.example.com

; <<>> DiG 9.3.4-P1 <<>> @127.0.0.1 test.example.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 61632
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;test.example.com.              IN      A

;; AUTHORITY SECTION:
example.com.            3498    IN      SOA     dns1.icann.org. hostmaster.icann.org. 2007051703 7200 3600 1209600 86400

;; Query time: 7 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Feb 23 18:09:12 2009
;; MSG SIZE  rcvd: 95

But when we issue 'rec_control reload-zones it seems to ignore the default value and inserts the contents of /etc/hosts:

[root@cac01 ~]# grep test.example.com /etc/hosts
192.0.2.1       test.example.com

[root@cac01 ~]# grep "export-etc-hosts" /etc/pdns-recursor/recursor.conf 
# export-etc-hosts      If we should serve up contents from /etc/hosts
# export-etc-hosts=off

[root@cac01 ~]# rec_control reload-zones
ok

[root@cac01 ~]# tail -f /var/log/pdns 
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Reloading zones, purging data from cache
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Inserting forward zone 'localhost.localdomain.' based on hosts file
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Inserting forward zone 'localhost.' based on hosts file
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Inserting reverse zone '1.0.0.127.in-addr.arpa.' based on hosts file
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Inserting forward zone 'test.example.com.' based on hosts file
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Inserting reverse zone '1.2.0.192.in-addr.arpa.' based on hosts file
Feb 23 18:25:40 cac01 pdns_recursor[5927]: Inserting rfc 1918 private space zones


[root@cac01 ~]# dig @127.0.0.1 test.example.com

; <<>> DiG 9.3.4-P1 <<>> @127.0.0.1 test.example.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32722
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;test.example.com.              IN      A

;; ANSWER SECTION:
test.example.com.       86400   IN      A       192.0.2.1

;; Query time: 10 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Feb 23 18:27:17 2009
;; MSG SIZE  rcvd: 50

Then if we explicetly set the export-etc-hosts to off then repeat the above it seems to honour it:

[root@cac01 ~]# grep test.example.com /etc/hosts
192.0.2.1       test.example.com

[root@cac01 ~]# grep "export-etc-hosts" /etc/pdns-recursor/recursor.conf 
# export-etc-hosts      If we should serve up contents from /etc/hosts
export-etc-hosts=off

[root@cac01 ~]# service pdns-recursor restart
Stopping pdns-recursor:                                    [  OK  ]
Starting pdns-recursor:                                    [  OK  ]

[root@cac01 ~]# dig @8127.0.0.1 test.example.com

; <<>> DiG 9.3.4-P1 <<>> @127.0.0.1 test.example.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52900
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;test.example.com.              IN      A

;; AUTHORITY SECTION:
example.com.            3586    IN      SOA     dns1.icann.org. hostmaster.icann.org. 2007051703 7200 3600 1209600 86400

;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Feb 23 18:32:22 2009
;; MSG SIZE  rcvd: 95


[root@cac01 ~]# rec_control reload-zones
ok

[root@cac01 ~]# tail -f /var/log/pdns
Feb 23 18:33:39 cac01 pdns_recursor[5966]: Reloading zones, purging data from cache
Feb 23 18:33:39 cac01 pdns_recursor[5966]: Inserting rfc 1918 private space zones

[root@cac01 ~]# dig @127.0.0.1 test.example.com

; <<>> DiG 9.3.4-P1 <<>> @127.0.0.1 test.example.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 20906
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;test.example.com.              IN      A

;; AUTHORITY SECTION:
example.com.            86400   IN      SOA     dns1.icann.org. hostmaster.icann.org. 2007051703 7200 3600 1209600 86400

;; Query time: 18 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Feb 23 18:34:23 2009
;; MSG SIZE  rcvd: 95


So at least there is a work arround; however while I havent looked through the code to see if I can see where its going wrong, hopefully it can be reproduced and resolved :)

Paul Cairney

Change History

Changed 17 months ago by ahu

  • status changed from new to closed
  • resolution set to fixed

Fixed in revision 1348, thanks!

Note: See TracTickets for help on using tickets.