Browse Source

Added check of db before signing. Also method to disallow restart if signed zone file doesnt exist

root 6 years ago
parent
commit
fc197f87d2
1 changed files with 14 additions and 0 deletions
  1. 14 0
      dnssec-signer

+ 14 - 0
dnssec-signer

@@ -109,6 +109,20 @@ function sign {
 
 	ZONEF="db.zone"
 	ZONEINCF="${ZONEF}.include"
+
+	note_msg "${ZONE}" "Validating unsigned zone file"
+	${CHECKZONE} "${ZONE}" "${F}"
+
+	if [ $? -ne 0 ]; then
+		error_msg "${ZONE}" "Error(s) in zone file"
+		if [ -r "${ZONEF}" ]; then
+			note_msg "${ZONE}" "Existing signed zone, allowing restart"
+			return 1
+		else
+			note_msg "${ZONE}" "No existing signed zone, disallowing restart"
+			return 2
+		fi
+	fi
 	
 	KEYS=()