PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.7k stars 908 forks source link

cname reply to NS request #5052

Closed 7c closed 7 years ago

7c commented 7 years ago

Behaviour tested versions: pdns-backend-mysql 4.0.2-1pdns.trusty pdns-server 4.0.2-1pdns.trusty and also same packages in version 4.0.3-1pdns.trusty.

So i do run mysql as backend with following records dump:

+----------------------------------------------------------------------------------+-------+------+------+-----------+
| content                                                                          | ttl   | prio | type | name      |
+----------------------------------------------------------------------------------+-------+------+------+-----------+
| 1.2.3.4                                                                          | 86400 |    0 | A    | osman.com |
| nameserver1.com                                                                | 86400 |    0 | NS   | osman.com |
| nameserver2.com                                                                | 86400 |    0 | NS   | osman.com |
| nameserver3.com                                                                | 86400 |    0 | NS   | osman.com |
| nameserver1.com hostmaster.nameserver1.com. 2017021713 3600 900 604800 43200 | 43200 | NULL | SOA  | osman.com |
+----------------------------------------------------------------------------------+-------+------+------+-----------+

If i type local or remote:

host -t NS osman.com localhost

i see: osman.com name server nameserver2.com. osman.com name server nameserver3.com. osman.com name server nameserver1.com.

but if i change the zone to:

+----------------------------------------------------------------------------------+-------+------+-------+-----------+
| content                                                                          | ttl   | prio | type  | name      |
+----------------------------------------------------------------------------------+-------+------+-------+-----------+
| target.com                                                                       | 86400 |    0 | CNAME | osman.com |
| nameserver1.com                                                                | 86400 |    0 | NS    | osman.com |
| nameserver2.com                                                                | 86400 |    0 | NS    | osman.com |
| nameserver3.com                                                                | 86400 |    0 | NS    | osman.com |
| nameserver1.com hostmaster.nameserver1.com. 2017021714 3600 900 604800 43200 | 43200 | NULL | SOA   | osman.com |
+----------------------------------------------------------------------------------+-------+------+-------+-----------+

as you see i have inserted a CNAME instead of A. I get by

host -t NS osman.com localhost

result:

osman.com is an alias for target.com.

I believe this is a bug. Expected behaviour is that since i have requested NS RR it should return me the same from the first query.

Habbie commented 7 years ago

Hello,

it appears you edited your mysql output a lot. Please update with unedited content. To understand why, read https://blog.powerdns.com/2016/01/18/open-source-support-out-in-the-open/

7c commented 7 years ago

Hi Habbie, i have edited it to anonimize that is all, current output is actual and real scenario

phonedph1 commented 7 years ago

The real problem here is you are trying to use a CNAME at your zone apex. Although this sometimes "works" in various implementations it's definitely not recommended.

Maybe you want an ALIAS record instead?

7c commented 7 years ago

Many thanks, i am more wise know. I did not know about the restriction of cname at zone apex.