[WHM API createacct] The system failed to find IPv4 addresses

ThosHost

Member
Aug 8, 2020
5
0
1
Romania
cPanel Access Level
Root Administrator
Hello, i want to integrate cPanel & WHM with my own commercial billing software and i got a problem on some domains, example.com domain and subdomains are working, but others got the following error (statusmsg):
Code:
(XID 3h75kx) The system failed to find IPv4 addresses for “a.gtld-servers.net”, “b.gtld-servers.net”, “c.gtld-servers.net”, “d.gtld-servers.net”, “e.gtld-servers.net”, “f.gtld-servers.net”, “g.gtld-servers.net”, “h.gtld-servers.net”, “i.gtld-servers.net”, “j.gtld-servers.net”, “k.gtld-servers.net”, “l.gtld-servers.net”, and “m.gtld-servers.net”. Because of this, the system cannot find “valmhost.com”’s authoritative nameservers. See the cPanel & WHM error log for more details.
I currently use this code for account creation:


Code:
function cpanel_createUser($whm_user, $whm_pass, $accountarray = null, $host = 'localhost', $returnJSON = 1) {
        // Don't touch this stuff
        $acc_username = $accountarray['username'];
        $acc_pass = $accountarray['password'];
        $acc_plan = $accountarray['plan'];
        $acc_email = $accountarray['email'];
        $acc_domain = $accountarray['domain'];
        $acc_reseller = $accountarray['reseller'];
        $url = "https://$host:2087/json-api/createacct?username=$acc_username&plan=$acc_plan&domain=";
        $url .= urlencode($acc_domain) . "&password=" . urlencode($acc_pass). "&reseller=" . urlencode($acc_reseller);
        $url .="&email=" . urlencode($acc_email);
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
        curl_setopt($curl, CURLOPT_HEADER,0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($curl, CURLOPT_USERPWD, $whm_user.":".$whm_pass);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15);
        curl_setopt($curl, CURLOPT_URL, $url);
        $curl_response = curl_exec($curl);
        if($returnJSON == 1) {
        return json_decode($curl_response, true); } else { return $curl_response; }
        curl_close($curl);
    }
    
    
    $userm = getUserVar($_SESSION['user_id']);
                    $usern = strtolower($userm['username']);                       
                    $usern = preg_replace('/\s+/', '', $usern);
                    $usern2 = mb_substr($usern, 0, 4);
                    $usern = 'cp'.rand(1, 99).''.$usern2;
                      $woDomain = $_SESSION['wo_domain'];
                    
                      $accountArray = array('username' => $usern, 'password' => random_str(12, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.][%_"), 'plan' => $pkg, 'domain' => $woDomain, 'reseller' => $pro_reseller_p, 'email' => $_SESSION['email']);
                      $log = cpanel_createUser($whm_root, $whm_pass, $accountArray, $whm_address, 0);
(all variables are set correctly)

What is the problem? I tried also on other cPanel web server and i got same statusmsg.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
The issue is that your server is not able to resolve the root nameservers, I doubt the issue is actually in your code, it looks like the error is occurring in the account creation process where the DNS lookup is performed.

  • Is the server NAT Routed?
  • Are ports 53 & 953 open for both TCP and UDP (inbound and outbound)?
  • What is listed in /etc/resolv.conf?
 

ThosHost

Member
Aug 8, 2020
5
0
1
Romania
cPanel Access Level
Root Administrator
The issue is that your server is not able to resolve the root nameservers, I doubt the issue is actually in your code, it looks like the error is occurring in the account creation process where the DNS lookup is performed.

  • Is the server NAT Routed?
  • Are ports 53 & 953 open for both TCP and UDP (inbound and outbound)?
  • What is listed in /etc/resolv.conf?

- The command display nat server returns
Code:
[[email protected] ~]# display nat server
display: unable to open X server `' @ error/display.c/DisplayImageCommand/410.
- Yes, these ports are open.
- In /etc/resolv.conf the output is:

Code:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 208.67.222.222
EDIT: As i see, when i use dig @8.8.8.8 +short NS domain.com it don't give the output of the domain nameservers (on other domains yes), only one domain have this problem.
 
Last edited:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
I'm not sure where you got the command "display nat server" but that wouldn't do anything I'm aware of. Usually you're aware if you're NAT routed which is an instance where you are assigned one or more private IP addresses that are translated to one or more public IP addresses. Easiest way to determine this is and that the server is routing them correctly is to run something like the following:

/scripts/build_cpnat

EDIT: As i see, when i use dig @8.8.8.8 +short NS domain.com it don't give the output of the domain nameservers (on other domains yes), only one domain have this problem.
Do you see any DNS issues for this domain when you use something like intodns.com or leafdns.com?
 

ThosHost

Member
Aug 8, 2020
5
0
1
Romania
cPanel Access Level
Root Administrator
I'm not sure where you got the command "display nat server" but that wouldn't do anything I'm aware of. Usually you're aware if you're NAT routed which is an instance where you are assigned one or more private IP addresses that are translated to one or more public IP addresses. Easiest way to determine this is and that the server is routing them correctly is to run something like the following:

/scripts/build_cpnat


Do you see any DNS issues for this domain when you use something like intodns.com or leafdns.com?
Looks like it is not in a NAT configuration.
Code:
info [build_cpnat] All publicly routeable addresses are the same as the local address. Not a NAT system.
I get these errors on intodns ONLY for this domain:


Code:
Mismatched NS records    WARNING: One or more of your nameservers did not return any of your NS records.
Error    DNS servers responded    ERROR: One or more of your nameservers did not respond:
The ones that did not respond are:
(IP of the web server)


ers    ERROR: Looks like you have less than 2 nameservers. According to RFC2182 section 5 you must have at least 3 nameservers, and no more than 7. Having 2 nameservers is also ok by me. (it have 2 nameservers)


You should already know that your NS records at your nameservers are missing, so here it is again: ...

SOA    Error    SOA record    No valid SOA record came back!
MX    Error    MX Records    Oh well, I did not detect any MX records so you probably don't have any and if you know you should have then they may be missing at your nameservers!
WWW    Error    WWW A Record    ERROR: I could not get any A records for www.valmhost.com!

(I only do a cache request, if you recently added a WWW A record, it might not show up here.)
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
Can you please open a ticket using the link in my signature? Once open please reply with the Ticket ID here so that we can update this thread with the resolution once the ticket is resolved.


Thanks!