Connect DirectAdmin server to cPanel DNS cluster servers

I am using cpanel dnsonly as dns cluster and use this script.
I do account migration from cpanel to DA. Account has been restored, but there was no MX record in the zone file on dnsonly server.

cpdnslog.txt:

Code:
MX records from DA: array (
  0 =>
  array (
    0 => 'domain.com.',
    1 => '10',
    2 => 'mail',
  ),
)
MX records from DA: array (
  0 =>
  array (
    0 => 'domain.com.',
    1 => '10',
    2 => 'mail',
  ),
MX records from DA: array (
  0 =>
  array (
    0 => 'domain.com.',
    1 => '0     domain.com.',
    2 => NULL,
  ),
)
MX records from DA: array (
  0 =>
  array (
    0 => 'domain.com.',
    1 => '0     domain.com.',
    2 => NULL,
  ),
)
MX records from DA: array (
  0 =>
  array (
    0 => 'domain.com.',
    1 => '0     domain.com.',
    2 => NULL,
  ),
)

And from cpanel error_log
info [xml-api] Invalid DNS record: Supplied exchange for MX record is invalid [addzonerecord] version [1].
info [xml-api] Invalid DNS record: Invalid name provided. [addzonerecord] version [1]

line 87-88, preference should be integer.
 
Last edited:
Right I was trying to get TTL values done for the next release, but I don't think it's going to be possible due to the lack of parameters in the env variables.

it is impossible to get proper TTL for any row in DNS zone, but, as I already checked, zone SERIAL changes on cpanel-side and on DA-side same time after zone added/edited. So you don't need to set up 300 for TTL. I modified the script and changed 300 to 14400, as of this DA-api doesn't let me know exact ttl for every row.
 
directadmin servers with cpanel dnsonly cluster

Hi everyone,
I wrote a different approach to run directadmin servers with cpanel dnsonly cluster.

You can download it here.
https://github.com/promek/px-dns-da2cp

Every time a change is made in DNS, refreshing slows down usage.
so I chose to use at job. your changes are synchronized after 5 min.

Since dns records are very diverse, I updated the direct /var/named/dnsfile.db file with rsync instead of checking the records one by one.

This approach seems more useful.
I hope you will like it.
 
Looks intresting, have you tested it with PowerDNS on Cpanel-side? Does rndc update all stuff?

Thanks a lot for this solution!

Hi,

will not work with powerdns. Because the script synchronizes the file in /var/named.

as far as cpanel works dnsonly just bind.

Zone reload is added with rndc command.
 
Looks intresting, have you tested it with PowerDNS on Cpanel-side? Does rndc update all stuff?

Thanks a lot for this solution!

will not work with powerdns.
Because the script synchronizes the file in /var/named.
as far as cpanel works dnsonly just bind.

Zone reload is added with rndc command.
 
Why do you think CPANEL DNSONLY works with just BIND? It has PowerDNS too.
 
I got solution for MX problem, line 86:
Code:
  $rec2 = explode(" ",$rec_arr[1]);

replace with preg_split:
Code:
  $rec2 = preg_split('/[\s]+/',$rec_arr[1]);
 
Does anyone know if there's a way to resync a DNS zone into the cPanel DNS clusters for a domain name via SSH / terminal?
 
you can resync zone using any solution from this two: provided by topic starter or by ibrahim
 
Why do you think CPANEL DNSONLY works with just BIND? It has PowerDNS too.

I have installed systems working with bind. I don't have a system installed with powerdns.
When I have time I will try to make a setup that works with powerdns.
I'll see if I can write a script that works with powerdns. :)
 
Hi everyone,
I wrote a different approach to run directadmin servers with cpanel dnsonly cluster.

You can download it here.
https://github.com/promek/px-dns-da2cp

Every time a change is made in DNS, refreshing slows down usage.
so I chose to use at job. your changes are synchronized after 5 min.

Since dns records are very diverse, I updated the direct /var/named/dnsfile.db file with rsync instead of checking the records one by one.

This approach seems more useful.
I hope you will like it.

Works perfectly for me, wish there was a way to use the access hash
 
Works perfectly for me, wish there was a way to use the access hash

dnsonly record insertion and deletion can be done using api.
but it is necessary to use ssh for rsync file.
so I took all the operations on ssh.
 
dnsonly record insertion and deletion can be done using api.
but it is necessary to use ssh for rsync file.
so I took all the operations on ssh.

Hi Ibrahim,

When the script runs, it does the update on cpanel dns only but gives error as;

rndc: 'reload' failed: not found
rndc: 'reload' failed: not found

I got 2 cpanel dns only that's why errors are 2 times. Server is Centos 7.6. how can i solve it?
 
Thank you for the response Ibrahim.

While i am doing so many dns changes in DA server, i received error from DA root;

ssh: Could not resolve hostname ns2.xxx.com: Name or service not known
ssh: Could not resolve hostname ns2.xxx.com: Name or service not known
ssh: Could not resolve hostname ns2.xxx.com: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]

However, both ns1 and ns2 was up and running.

There might be only some time DA could not access to one of dns in the cluster.

Is there anyway I can initiate a sync for all dns zones from DA to both cpanel dns only?


 
Thank you for the response Ibrahim.

While i am doing so many dns changes in DA server, i received error from DA root;

ssh: Could not resolve hostname ns2.xxx.com: Name or service not known
ssh: Could not resolve hostname ns2.xxx.com: Name or service not known
ssh: Could not resolve hostname ns2.xxx.com: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]

However, both ns1 and ns2 was up and running.

There might be only some time DA could not access to one of dns in the cluster.

Is there anyway I can initiate a sync for all dns zones from DA to both cpanel dns only?


/opt/px-dns-da2cp/config.sh You should check the settings in the file.

for syncronization from ssh terminal
/opt/px-dns-da2cp/px-dns-da2cp.sh sync xxx.com

or

directadmin interface can be synchronized by editing and saving individual domains from the DNS Administration section.
 
Last edited:
DirectSlave or this?

Coming over from cPanel DNSOnly cluster, this looks good because the zones look like a nightmare to move to DirectSlave. However, from what I see, it seems like the DNS transfer is only one way? If I delete the zone file on the the NS, the changes would not propagate backwards to the DA servers?
 
Back
Top