Change cPanel DNSOnly to write to _default.nzf instead of named.conf

MoreDakka

Registered
Sep 12, 2022
3
1
3
Edmonton, AB
cPanel Access Level
DataCenter Provider
Hello,
I'm trying to get Plesk Slave DNS to jive with a cPanel DNSOnly cluster.
I've been able to get Plesk Slave DNS to write to cPanel DNSOnly but the problem is that when Plesk sends the add domain command it will add it to /var/named/_default.nzf.
cPanel nodes write to the cluster and it saves under /etc/named.conf

The Plesk Slave DNS commands seem to be the default way that bind adds domains. So I'm trying to figure out how to get cPanel to write to the /var/named/_default.nzf instead.

Is this possible?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
Hey there! I don't know of a way to change that behavior, as that is the way the cluster and DNS system is hard coded. Could you create a tool that copies the data you need to the _default.nzf file, instead of trying to change the cPanel behavior directly?
 

MoreDakka

Registered
Sep 12, 2022
3
1
3
Edmonton, AB
cPanel Access Level
DataCenter Provider
Now we get to introduce another problem. Since the systems write in different places then the checks to see if a domain exists doesn't work causing a very ugly situation if bind needs to restart and there are duplicates.
Is there a way to change the location that rndc addzone writes? Maybe get that to write to named.conf instead of _default.nzf?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
I know from a cPanel standpoint, that isn't possible. It might be best to see if the _default.nzf file is compatible with /etc/named.conf as you could then just create a symlink, but there isn't going to be a way to change the cPanel DNS behavior.
 

MoreDakka

Registered
Sep 12, 2022
3
1
3
Edmonton, AB
cPanel Access Level
DataCenter Provider
cPRex, took your advice and created an include in the /etc/named.conf file. Here is a blurb I wrote in our KB for this situation:
Maybe this can help someone else looking for this info, I'm certain we aren't the only cPanel(linux) and Plesk(windows) shop that wants a shared DNS cluster.

The only problem we can think of with this is if there is ever an update to the Slave DNS module and that updated removes the .db edit. SlaveDNS might re-sync the zones without the .db and cause duplicates causing bind to fail if it was restarted. Waiting on Plesk support to see about that. Was thinking of making that file read only?



When cPanel writes a DNS record to the cPanel DNSOnly servers it creates a file like this:

/var/named/pleskdomain.com.db

Plesk SlaveDNS writes them like this:

/var/named/pleskdomain.com

The records need to have the .db on them to be recognized by the cPanel DNSOnly cluster.
To fix, on the Window plesk server (make sure it's set to use Bind):

The file name is defined by file C:\Program Files (x86)\Plesk\admin\plib\modules\slave-dns-manager\library\Rndc.php.

Change

" \"{ type slave; file \\\"{$domain}\\\"; masters { {$slave->getMasterPublicIp()}; }; };\"");

To

" \"{ type slave; file \\\"{$domain}.db\\\"; masters { {$slave->getMasterPublicIp()}; }; };\"");

afterwards the files are generated with ".db" suffix:

-rw-r--r-- 1 named named 949 Sep 5 05:39 pleskdomain.com.db
-rw-r--r-- 1 named named 936 Sep 5 03:47 pleskdomain.com


You will also need to edit the /etc/named.conf to add:

include "/var/named/_default.nzf";

That will make it so Plesk SlaveDNS module doesn't overwrite the domain when it tries to run rndc addzone. No errors happen, it just doesn't do anything, it would be nice if it errored.
 
Last edited:
  • Like
Reactions: cPRex