AddonDomain::addaddondomain API 2 PHP non-resolving domains
Hi Cpanel Community.
Apologies on advance if this was ever addressed, I've searched everywhere on the forum and couldnt find a similar problem.
I manage close to 11000 (eleven k) domains under a VPS hosting account (with root WHM and cpanel ). Im not a reseller, just a large domain portfolio care taker.
Due to the large number of domains, I took the direction of implementing a tool-box that
allows simple queries ( list email, list subdomains, ... ) and also it allows SubDomain creation,
Batch SubDomain Creation, Email boxes creation/delete, Subdomain Delegation ( A Record ) -
everything is working fine except with the addaddondomain.
When I add ( via API 2 and php ) an add on domain, the domain is created, a subdomain
of the main domain is also created, and the result message is success "Add On domain successfully parked on .. " however, only the subdomain+maindomain resolves, the actual addon domain doesnt. Here's the flow in detail:
-via php ( xml-api.php - api2 )
-array arg$ is 'dir', 'newdomain' and 'subdomain'
For example:
main domain: themaindomain.com
Add On Domain to be added: anotherdomain.com
so the arg$ value becomes
newdomain = anotherdomain.com
subdomain = maindomaincom
dir = /public_html/anotherdomain
The result is:
anotherdomaincom.maindomain.com
but, anotherdomain.com doesnt resolve ( as in not live )
-I noticed that the DNS Zone for newdomain.com is created and visible in WHM but
it is not visible from Cpanel's Zone Edit.
-the DNS record of the newdomain.com appears OK ( in WHM ) - doesnt show in cpanel.
-im authenticating using the cpanel user ( i tried root but same result )
-the subdomain newdomaincom.maindomain.com is present in Cpanel ( under the accordingly user used in the api call ) 's Subdomains page .. ( but not in Dns Edit - only on dns edit at WHM )
i have been fighting with this for 4 days now.
Questions
-When I use addaddondomain, it should show in both cpanel and whm, right ?
-what is the serial # on the whm edit zone page ?
-Am I supposed to handle the DNS part as well ? ( addZone ) ? I am under
the impression that the api covers it all, or am I mistaken ?
-The Park/Unpark Main Domain/Subdomain relation seemed clear to me, but now
after days, im getting confused for real.
What am I doing wrong ? really appreciative if someone could help me out.
below is the excerpt from my code:
[xmlapi.php]
$cpaneluser = 'cpaneluser'
$password = 'password';
$box = xxx.xxx.xxx.xx
$client = new xmlapi($box);
$client->set_output('json');
$client->password_auth($cpaneluser, $password );
$arg$ = array ('dir' => $dir, 'newdomain' => $domain, 'subdomain' => $trimmeddomain );
$resp = $client->api2_query ( $cpaneluser, 'AddonDomain', 'addaddondomain', $arraydata );
thanks in advance for anyone willing to save me.
thanks,
ps: I did play with the domain tweaks ( whm ) but without any further success.
ps2: I realize the above code needs to be highlighted in a special format here in the thread, but I couldnt find the option, apologies.
-
Hi David, thanks for your reply. I finally managed to fix it and the description is a bit complex, to summarize: I believe there is a problem with certain new top level domains (nGTLDs ) that might cause trouble on the resolving of a tertiary name server. I believe it is related to the resolving of A Records when one uses more than two nameservers AND delegated subdomains, for instance: SLD.TLD -> authoritative or parent at the Registrar level as ns1.sld.tld, ns2.sld.tld and (please note tertiary is not mandatory ) ns3.sld.tld on my side ( non-shared, VPS, cpanel, whm ) matching name and proper SOA ns1.sld.tld ns2.sld.tld .. ns3.sld.tld please also note im not using the hosting provider's nameservers but rather pointing to my own custom ( same server though, extra A record - but needed for my digitial asset mgmt platform, which is custom ). If I dont use a tertiary then AddonDomain::addaddondomain works ok, and new addon domain resolves properly. If I use a tertiary, then the AddonDomain::addaddondomain works ok, that is the result seems ok, dir created, appears in WHM ( but not in cpanel ) AND does *not* resolve. to make it even more complex, it seems to apply to certain .tlds only. ( please also note im not using any ccTLD on this test .. yet ) in order to make the faulty one ( domain ) under the tertiary context to work, I have to wipe the tertiary from the dns zone ( in WHM or via API ( ::fetchzone, find line # then ::editfileZone and finally resetFileZone -or synch records via whm, if I re-add it manually ( via the GUI, whm that is ) the tertiary record, then it resolves. The leftover of this context, for the faulty ones, it doesnt show in cpanel ( but it does in whm ) which also creates trouble to remove the domain ( manually or via API ) ... the workaround works, as a final note, it is important to add that most of the domains Im using have a need of delegation, that is: NameServer under whm but main domain resolves somewhere else, subdomain1 resolves local, subdomain2... example: Welcome.link ( dot link is a newGTLD ) NS in same server as WHM and cpanel, but A record of welcome.link will resolve somewhere else. geoLocation1.welcome.link [ somewhere else, and not the same as previous ] geoLocation2........ sometimes up to 7 subdomains. txs, s 0 -
FYI, I think this problem is related to the fact that new gTLDs require a different validation anywhere where there is a verification of the domain validity, for example, domains like , can cause domain validation to fail in some contexts ( such as email validation, something@sudo.host and alikes seems to irritate countless contact forms throughout the Internet ), in this specific case the workaround I found was to add tertiary nameserver using "normal gTLDs" such as .com will allow an update to work. ex: if you want to add a tertiary NS and pass all the validations, just use a .com or .net, allow the synchronization ( all dnszones + multi cluster ) and then once it is in the whm DnsZone, use the api ZoneEdit::fetchzones to get the line # of the specific DnsZone DNS record, and then ZoneEdit::edit_zone_report and re-synch zones. 0
Please sign in to leave a comment.
Comments
3 comments