From b000892e4b1288ea3d75661a13f4608b0a3628de Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Sat, 12 Jul 2025 08:52:52 +0100 Subject: add named hook --- Makefile | 1 + named.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 named.sh diff --git a/Makefile b/Makefile index f52c91c..de3db43 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ HOOKDIR?= ${DESTDIR}${PREFIX}/share/lfldap/hooks HOOKS= apache24.sh \ chrony.sh \ + named.sh \ nginx.sh \ pf.sh \ postfix.sh 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 ";" + +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 -- cgit v1.2.3