DNSOnly api connection through a production Cpanel server - ANY DOCUMENTATION OUT THERE?

craigedmonds

Well-Known Member
Oct 29, 2007
115
1
68
Europe
cPanel Access Level
Root Administrator
Twitter
I have 8 Cpanel production servers linked into 6 Cpanel DNS ONLY which are all clustered together.

What I want to do is this:

1. create an external PHP application (ie my own API) that connects to the DNSonly system through one of the production server
2. query the cluster DNS to get a list of domains
2. Send DNS settings to the cluster (through the production server) for example A records, delete zones, add zones etc.

I "don't think" its possible to connect directly to the DNSonly servers (which is odd anyway) so do I need to connect to one of my normal servers via API and make the updates there?
 
  • Like
Reactions: RadWebHosting

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,796
1,530
313
cPanel Access Level
Root Administrator
Hey there! I'm not seeing that we have any API calls at this time that would help perform that work. In general, all DNS should be managed on the webserver, and then those changes will propagate to the clustered nameservers.

We do have a tool that will sync a DNS zone after changes have been made, which is the "/scripts/dnscluster" tool:

Code:
# /scripts/dnscluster
Usage: dnscluster [ACTION] [OPTIONS]...

Examples:
   /usr/local/cpanel/scripts/dnscluster syncall --full               # Sync all zones (even ones not in /etc/userdomains)
   /usr/local/cpanel/scripts/dnscluster synczonelocal mydomain.org   # Sync mydomain.org to the local machine

Actions:
    syncall [--full] - make sure all dns zones are
       in sync within the cluster. If any zone files
       are out out of sync, the ones with the largest
       serial numbers will be copied to all servers.

    syncalllocal [--full] - make sure all dns zones are
       in sync within the cluster. If any zone files are
       out out of sync, the ones with the largest serial
       numbers will be copied to the local server only.

    synczone <zone> - sync one zone
       If the zone is out out of sync, the one with the largest
       serial number will be copied to all servers.

    synczonelocal <zone> - sync one zone
       If the zone is out out of sync, the one with the largest
       serial number will be copied to the local server.

Operation modifiers:
    -F, --full
       If the --full flag is specified then zones that are not
       local to this server (in /etc/userdomains) will be pulled
       in as well.  This was the default behavior prior to 11.24.5

Help:
    -H, --help (or no arguments)
       This will show this screen.
so you may be able to use some of the API calls outlined here to perform your work, and then include that /scripts command to sync the data:


If you need something that isn't covered there, I'd recommend submitting a feature request using the link in my signature to see if our team can get some additional API functions added in the future.