• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Plesk Bind master + PDNS slaves zone transfer

Andriy_Martynyuk

New Pleskian
Hi guys,

I'm experiencing the situation with zone transfer to PDNS slaves.

// $Id: named.conf,v 1.1.1.1 2001/10/15 07:44:36 kap Exp $

// -- THE FOLLOWING LINES WERE GENERATED BY PLESK. IF YOU MODIFY THEM, THEY WILL BE OVERWRITTEN WHEN THESE SETTINGS ARE MANAGED IN PLESK UI. --
options {
allow-recursion {
localnets;
};
notify yes;
also-notify {
SLAVE_IP_1;
SLAVE_IP_2;
};
listen-on-v6 { any; };
version "none";
directory "/var";
auth-nxdomain no;
pid-file "/var/run/named/named.pid";
};

key "rndc-key" {
algorithm hmac-md5;
secret "<key-here>";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};

zone "." {
type hint;
file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "localhost.rev";
};
// -- END OF LINES GENERATED BY PLESK. --


// -- PLEASE ADD YOUR CUSTOM DIRECTIVES BELOW THIS LINE. --
// ...
// -- END OF YOUR CUSTOM DIRECTIVES. --

PDNS have slave=yes enabled and works great with PDNS master server I also have.

But, as written by PDNS community:
For example, if you use ns1.solcon.nl as primary NS-record you need to
have ‘ns1.solcon.nl’ as the nameserver-record in de supermasters-table.

So I've added a small script to crontab updating supermasters table every n minutes:
#!/bin/bash
#Update PDNS Slave servers
pleskIP="plesk_IP"
DNSServerlist="slave_ip_1 slave_ip_2"
domainslist=`grep "zone" /etc/named.conf | grep -v "\(ARPA\|arpa\)" | awk -F\" '{if(NR>1)print $2 '}`
for i in $DNSServerlist; do
for count in $domainslist; do
domainns=ns.$count
echo "INSERT INTO supermasters (ip,nameserver) \
SELECT * FROM (SELECT '$pleskIP','$domainns') AS tmp \
WHERE NOT EXISTS (SELECT nameserver FROM supermasters WHERE nameserver = '$domainns') LIMIT 1;" | mysql -u pdns -h $i -pdecafoumookeness pdns
#echo $domainns $i
done
done
/etc/init.d/named reload
namedconfcheck=`grep "notify yes" /var/named/chroot/etc/named.conf`
if [ "$namedconfcheck" != " notify yes;" ]; then
echo "Please check /var/named/chroot/etc/named.conf to be sure all SLAVE DNS get updates" | mail -s "`uname -n` WARNING: named.conf \"notify\" not present" [email protected]
fi

It successfully updates supermasters table but does not send zone updates.
But when I do /etc/init.d/named restart all records are transfered. But restarting bind just by crontab is not a good solution...

So I've thought maybe you could help me with finding of domain creation script so I could modify it to run my script before it restarts Bind, or maybe drive me to other solution.

Thank you.
 
You can try to call

# /usr/local/psa/admin/bin/dnsmng --update domain.name

or

for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/admin/bin/dnsmng --update $i; done

for updating and transferring zones of all domains.
 
Back
Top