Display More
Reporter Marc Pujol (kilburn) Created Oct 9, 2018 6:10:15 AM Updated Oct 9, 2018 6:13:18 AM Priority Normal Type Bug State Submitted Assignee Laurent Declercq (nuxwin) Subsystem No subsystem Affected versions 1.5.1 Milestone 1.6.0 Severity No severity This listener is supposed to prevent collisions between the panel-created DNS entries and user-entered custom DNS records.
Unfortunately, the logic is fatally flawed. At first glance it seems simple enough:
In thebeforeNamedAddCustomDNS
event, any default records that have an overriding custom record get deleted.
In theafterNamedAddCustomDNS
event, any default records that no longer have an overriding custom record are readded.
However, there is an important problem: whenever some property of the domain is modified, the alias is makedtoedit
, meaning that the entireaddDmn
chain will be run for it. Let's see what happens with an example:
1. Customer addsdomain.tld
to the panel. TheaddDmn
chain creates a zone with the default records for it.
2. Customer adds awww IN A xxx.xxx.xxx.xx
record for that domain.Modules::customDNS
is run, callingbeforeNamedAddCustomDNS
, that clears the defaultwww IN CNAME
record. ThenModules::customDNS
creates the custom record, and everything is fine up to here.
3. Customer changes some property of the domain (i.e.: the php settings). TheModules::Domain
chain is run. This ends up callingServers::named::bind::addDmn
, that recreates the zone's default records. Nowdomain.tld
has bothwww IN CNAME
(from the defaults) andwww IN A
(custom) records, andnamed-compilezone
fails fatally because the zone data is incorrect.
Unfortunately, I see no way to fix this using listeners only. The reason is that during theaddDmn
chain the custom DNS records are never loaded. We can listen to thebeforeNamedAddDmn
andafterNamedAddDmn
events, but the listener can't know which custom DNS records exist at this point.