Connect DirectAdmin server to cPanel DNS cluster servers

zlygis

New member
Joined
Oct 10, 2019
Messages
2
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?

Got the same question – do changes on cPanel DNS only cluster propagate to DA cluster? Thank you!
 

shvaber

Verified User
Joined
Aug 9, 2019
Messages
27
Got the same question – do changes on cPanel DNS only cluster propagate to DA cluster? Thank you!

Good day,
I don't understand, why do you need to have 2 clusters running? DNSOnly and DA?

I had DNSOnly cluster with 2 Cpanel servers separatedly, which used that cluster. For now I have 2 DA servers and 1 Cpanel (it is still under migration), which use same DNSCLuster.

Everything is fine.
 

zlygis

New member
Joined
Oct 10, 2019
Messages
2
Good day,
I don't understand, why do you need to have 2 clusters running? DNSOnly and DA?

Good point :) All my NS run on cPanel DNSonly and I was thinking about possibility to replace some or all cPanel DNSonly with DA on my DNS cluster. Guess it is not possible with currently available tools while having cPanel servers on the same NS...

I was also wondering how do solutions on this topic prevent users on DA server from creating (adding)/editing/removing DNS zones that belong to users on cPanel server? Thank you.
 

anadx

New member
Joined
Mar 26, 2020
Messages
2
Hi,

Can this script be modified to work with external cluster of pdns ? We have a 3 server cluster running on pdns.

Thanks
 

nick-a

Verified User
Joined
Feb 23, 2007
Messages
49
I've just updated this to fix numerous bugs I found now we need it for production, got a few more to go but it's a lot more reliable now in case anyone need this.

Let me know if you find any bugs too of course.
 

Simonj

New member
Joined
Nov 25, 2020
Messages
2
I've just updated this to fix numerous bugs I found now we need it for production, got a few more to go but it's a lot more reliable now in case anyone need this.

Let me know if you find any bugs too of course.
Hi Nick,
Where can I get the latest version of this? And does it work with powerdns?
 

Simonj

New member
Joined
Nov 25, 2020
Messages
2
First post. It works with cpanel DNS clusters
Thanks for the reply. Yes im aware its for CPANEL DNS Clusters, but my Cpanel DNS cluster is running PowerDNS not Bind as attached so I wanted to ensure it works with this setting.
 

Attachments

  • dns.jpg
    dns.jpg
    325.8 KB · Views: 17

dotcanada

Verified User
Joined
Aug 20, 2003
Messages
13
We tried this back when we first migrated 8,000 accounts to DirectAdmin and it worked great.

It did the trick while we were moving from cP to DA. After the successful migration, we changed the nameservers to DA and life has been great.

Now we find ourselves in a situation where we want to have multiple control panels sharing the same nameserver clusters and we want to go back to cPanel DNSOnly as the Nameservers.

Here is my question... after I set up the DA servers with the scripts as for the first post, how can I get the existing domain zones from the DA servers onto the cPanel DNSOnly box. I know if I make a change to a zone, it will get updated on the cluster properly, but is there a good way to get the zones there without having to make DNS changes in DA to each of the domains? Maybe a script that would make DNS changes that might also trigger dns_write_post.sh ?

Thanks!
 

nick-a

Verified User
Joined
Feb 23, 2007
Messages
49

echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue

I don't know if that will affect any custom records though?
 

shvaber

Verified User
Joined
Aug 9, 2019
Messages
27
you can just copy domain.db files to CPDNSonly and reconfigure it to handle all zones on this server. It should take under control your DA zones too. OR, you can easyly write a script on DA server which will do:
/opt/px-dns-da2cp/px-dns-da2cp.sh sync some.domain


Both ways should work
 

justjosh

Verified User
Joined
Oct 13, 2019
Messages
29

echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue

I don't know if that will affect any custom records though?
Hey Nick,

I've tried using the script in the first post. Not seeing any new .db file being created on the cPanel DNS Only server for a new zone. Seems like cPanel server isn't responding to the API calls.

Here is the log:

# cat cpdnslog.txt
A records from DA: array (
0 =>
array (
0 => 'ftp.<DOMAIN>.',
1 => '<IP>',
),
1 =>
array (
0 => '<DOMAIN>.',
1 => '<IP>',
),
2 =>
array (
0 => 'mail.<DOMAIN>.',
1 => '<IP>',
),
3 =>
array (
0 => 'pop.<DOMAIN>.',
1 => '<IP>',
),
4 =>
array (
0 => 'smtp.<DOMAIN>.',
1 => '<IP>',
),
5 =>
array (
0 => 'www.<DOMAIN>.',
1 => '<IP>',
),
)
MX records from DA: array (
0 =>
array (
0 => '<DOMAIN>.',
1 => '10',
2 => 'mail',
),
)
NS records from DA: array (
0 =>
array (
0 => '<DOMAIN>.',
1 => 'ns1.<NS>.',
),
1 =>
array (
0 => '<DOMAIN>.',
1 => 'ns2.<NS>.',
),
)
TXT records from DA: array (
0 =>
array (
0 => '"v=spf1 a mx ip4:<IP> ~all"',
1 => '<DOMAIN>.',
),
)
SRV records from DA: false
check_dns_zone running...
Our cURL url: https://ns0.<NS>:2087/json-api/dumpzone?api.version=1&domain=<DOMAIN>
cPanel server said:

send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
check_dns_zone running...
Our cURL url: https://ns0.<NS>:2087/json-api/dumpzone?api.version=1&domain=<DOMAIN>
cPanel server said:

Records from cPanel:
NULL
DA Clean Records:
array (
0 =>
array (
'type' => 'A',
'name' => 'ftp.<DOMAIN>.',
'address' => '<IP>',
),
1 =>
array (
'type' => 'A',
'name' => '<DOMAIN>.',
'address' => '<IP>',
),
2 =>
array (
'type' => 'A',
'name' => 'mail.<DOMAIN>.',
'address' => '<IP>',
),
3 =>
array (
'type' => 'A',
'name' => 'pop.<DOMAIN>.',
'address' => '<IP>',
),
4 =>
array (
'type' => 'A',
'name' => 'smtp.<DOMAIN>.',
'address' => '<IP>',
),
5 =>
array (
'type' => 'A',
'name' => 'www.<DOMAIN>.',
'address' => '<IP>',
),
6 =>
array (
'type' => 'MX',
'name' => '<DOMAIN>.',
'preference' => '10',
'exchange' => 'mail',
),
7 =>
array (
'type' => 'NS',
'name' => '<DOMAIN>.',
'nsdname' => 'ns1.<NS>',
),
8 =>
array (
'type' => 'NS',
'name' => '<DOMAIN>.',
'nsdname' => 'ns2.<NS>',
),
9 =>
array (
'type' => 'TXT',
'name' => '<DOMAIN>.',
'txtdata' => '"v=spf1 a mx ip4:<IP> ~all"',
),
)
Clean cPanel records:
array (
)
adding new DA record to zone:
array (
'type' => 'A',
'name' => 'ftp.<DOMAIN>.',
'address' => '<IP>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'A',
'name' => '<DOMAIN>.',
'address' => '<IP>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'A',
'name' => 'mail.<DOMAIN>.',
'address' => '<IP>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'A',
'name' => 'pop.<DOMAIN>.',
'address' => '<IP>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'A',
'name' => 'smtp.<DOMAIN>.',
'address' => '<IP>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'A',
'name' => 'www.<DOMAIN>.',
'address' => '<IP>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'MX',
'name' => '<DOMAIN>.',
'preference' => '10',
'exchange' => 'mail',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'NS',
'name' => '<DOMAIN>.',
'nsdname' => 'ns1.<NS>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'NS',
'name' => '<DOMAIN>.',
'nsdname' => 'ns2.<NS>',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
adding new DA record to zone:
array (
'type' => 'TXT',
'name' => '<DOMAIN>.',
'txtdata' => '"v=spf1 a mx ip4:<IP> ~all"',
)
send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:
 

texo

Verified User
Joined
Jul 6, 2019
Messages
8
I am brand new to DA and have a basic understanding of DNS, so please forgive me if this is a stupid question.
I could not get the script to work. It does exactly the same as in @justjosh post above, connecting successfully to the cPanel DNS only servers and ending with

send_to_ns running...
cPanel server said:
send_to_ns running...
cPanel server said:

I logged into the DNS ONLY servers and there were no *.db files created in /var/named for the new domain.

So, what I did is simply scp the .db file for the new domain created on my DA testing server to both my cPanel DNS ONLY servers, and then onl those servers did a "Synchronize one zone to all servers" and the new DNS entries are now working on my DNS cluster.

QUESTION:
After creating a new account on my DA server, can't I just rsync the .db files to my two cpanel dns only nameservers and then sync the zones?
This can be added to a cronjob to sync all db every 5 minutes or so?

I have probably overlooked something, but would be grateful for any responses.
 

jigster

New member
Joined
Jul 23, 2021
Messages
1
Great script, thanks! Just one thing - when I delete an account in DA the zone is NOT deleted on the cPanel DNS servers. Is this by design or just a missing functionality? I see earlier in this discussion shvaber posted a custom dns_delete_post.sh to solve this, but their link no longer works. Anyone have a copy, or written a custom dns_delete_post.sh to solve this issue? Thanks a lot
 
Top