summaryrefslogtreecommitdiffstats
path: root/named.sh
diff options
context:
space:
mode:
Diffstat (limited to 'named.sh')
-rw-r--r--named.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/named.sh b/named.sh
new file mode 100644
index 0000000..8c2ebaa
--- /dev/null
+++ b/named.sh
@@ -0,0 +1,27 @@
+# This source code is released into the public domain.
+#
+# The named allow_internal.conf file is an ACL definition containing a
+# list of "<prefix>;"
+
+NAMED_FILE="/usr/local/etc/namedb/allow_internal.conf"
+NAMED_TEMP="${NAMED_FILE}.ldaptmp"
+
+if [ ! -f "$NAMED_FILE" ]; then
+ exit 0
+fi
+
+printf >"$NAMED_TEMP" 'acl "allow_internal" {\n'
+awk <"$NETWORKS_FILE" >>"$NAMED_TEMP" '{ print $1 ";" }'
+printf >>"$NAMED_TEMP" '};\n'
+
+if cmp -s "$NAMED_TEMP" "$NAMED_FILE"; then
+ rm "$NAMED_TEMP"
+ exit 0
+fi
+
+printf '%s updated:\n\n' "$NAMED_FILE"
+diff "$NAMED_FILE" "$NAMED_TEMP"
+printf '\n'
+
+mv "$NAMED_TEMP" "$NAMED_FILE"
+/usr/local/sbin/rndc reload