namedmanager
namedmanager copied to clipboard
Domain rename leaves junk NS records behind
Renaming a domain leaves some junk NS records behind that reference the original domain name.
Steps to reproduce:
- Create two nameservers (ns1.wonderfulhosting.example, ns2.wonderfulhosting.example)
- Create a domain called typodomain.example
- Notice the typo and rename to fixeddomain.example
The resulting zone file looks like this:
; Nameservers
fixeddomain.example. 86400 IN NS ns1.wonderfulhosting.example.
fixeddomain.example. 86400 IN NS ns2.wonderfulhosting.example.
typodomain.example 86400 IN NS ns1.wonderfulhosting.example.
typodomain.example 86400 IN NS ns2.wonderfulhosting.example.
This is relatively harmless since the records actually exist at typodomain.example.fixeddomain.example
, but it is likely not what the user intended.
One other interesting tidbit, in the database neither fixeddomain.example nor typodomain.example has a trailing dot, so I wonder if we couldn't simplify by replacing the NS records with @ instead? I'm not sure if there would be other side effects so I'm not prepared to make any changes to the code here myself.