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. # Copying files from the dnsmanagerd bind9 directory to the powerdns directory.
PDNSDIR="/var/powerdns/" PDNSDIR="/var/powerdns/"
DNSMANDIR="/tmp/DATA-dnsmanagerd/bind9-zones/" 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() { local_update() {
echo "update domain $1" echo "update domain $1"
@ -20,7 +25,12 @@ action() {
echo $event | grep "MOVED_TO" >/dev/null echo $event | grep "MOVED_TO" >/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
local_update $file test_domain_validity $file
if [ $? -eq 0 ]; then
local_update $file
else
echo "invalid domain: $file" >> $LOGFILE
fi
fi fi
echo $event | grep "DELETE" >/dev/null echo $event | grep "DELETE" >/dev/null