From 954afd3e6e7742dc9e944533f680cc236063b6a5 Mon Sep 17 00:00:00 2001 From: Jochen Welzel Date: Mon, 18 Jan 2021 20:45:06 +0100 Subject: [PATCH] add nsd to dockerfile and local zonefile check --- Dockerfile | 2 +- scp_and_reload.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 03090d2..a8d0426 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:latest MAINTAINER Jochen Welzel -RUN apk update && apk upgrade && apk add bash && apk add openssh-client && apk add git +RUN apk update && apk upgrade && apk add bash && apk add openssh-client && apk add git && apk add nsd COPY scp_and_reload.sh /usr/local/bin/ RUN chmod 755 /usr/local/bin/scp_and_reload.sh diff --git a/scp_and_reload.sh b/scp_and_reload.sh index 866a036..afed095 100644 --- a/scp_and_reload.sh +++ b/scp_and_reload.sh @@ -10,19 +10,19 @@ echo "Changed files: $CHFILENAMES" for file in $CHFILENAMES; do if [[ $file == *"zone" ]]; then + ZONE=$(echo $file | sed 's/\.zone//') + echo "Check zone file" + nsd-checkzone $ZONE $file + if [ $? -ne 0 ]; then + echo "Zone file check failed" 1>&2 + exit 1 + fi echo "SCP of $file started" scp -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file if [ $? -ne 0 ]; then echo "SCP failed" 1>&2 exit 1 fi - ZONE=$(echo $file | sed 's/\.zone//') - echo "Check uploaded zone file" - ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-checkzone $ZONE "$PLUGIN_TARGET"/"$file" - if [ $? -ne 0 ]; then - echo "Zone file check failed" 1>&2 - exit 1 - fi echo "Reload $ZONE zone" ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE if [ $? -ne 0 ]; then