watchdog dnsmanagerd to powerdns: do not update invalid zones.

This commit is contained in:
Philippe Pittoli 2024-12-10 00:41:17 +01:00
parent 89e970f450
commit bfcba42375

View File

@ -4,6 +4,11 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
# Copying files from the dnsmanagerd bind9 directory to the powerdns directory.
PDNSDIR="/var/powerdns/"
DNSMANDIR="/tmp/DATA-dnsmanagerd/bind9-zones/"
LOGFILE="/tmp/invalid-domains"
test_domain_validity() {
named-checkzone $1 $DNSMANDIR/$1 1>/dev/null 2>/dev/null
}
local_update() {
echo "update domain $1"
@ -19,8 +24,13 @@ action() {
file=$2
echo $event | grep "MOVED_TO" >/dev/null
if [ $? -eq 0 ]; then
test_domain_validity $file
if [ $? -eq 0 ]; then
local_update $file
else
echo "invalid domain: $file" >> $LOGFILE
fi
fi
echo $event | grep "DELETE" >/dev/null