summaryrefslogtreecommitdiffstats
path: root/debian/bind9.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:59:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:59:49 +0000
commit0e764bd6a393ec1a7e876e4cafbbf0665e78849c (patch)
treebd15cfb16df2d659532769e8bdfd76a16c7f7ad6 /debian/bind9.postinst
parentAdding upstream version 1:9.18.19. (diff)
downloadbind9-0e764bd6a393ec1a7e876e4cafbbf0665e78849c.tar.xz
bind9-0e764bd6a393ec1a7e876e4cafbbf0665e78849c.zip
Adding debian version 1:9.18.19-1~deb12u1.debian/1%9.18.19-1_deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/bind9.postinst')
-rw-r--r--debian/bind9.postinst37
1 files changed, 37 insertions, 0 deletions
diff --git a/debian/bind9.postinst b/debian/bind9.postinst
new file mode 100644
index 0000000..69333d0
--- /dev/null
+++ b/debian/bind9.postinst
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = configure ]; then
+ # lets give them a bind user/group in all cases.
+ getent group bind >/dev/null 2>&1 || addgroup --system bind
+ getent passwd bind >/dev/null 2>&1 ||
+ adduser --system --home /var/cache/bind --no-create-home \
+ --disabled-password --ingroup bind bind
+
+ # create data directory on fresh install
+ if [ -z "$2" ]; then
+ mkdir -p /var/lib/bind
+ chown root:bind /var/lib/bind
+ chmod 775 /var/lib/bind
+ fi
+
+ if [ ! -s /etc/bind/rndc.key ] && [ ! -s /etc/bind/rndc.conf ]; then
+ rndc-confgen -a
+ fi
+
+ uid=$(ls -ln /etc/bind/rndc.key | awk '{print $3}')
+ if [ "$uid" = "0" ]; then
+ chown bind /etc/bind/rndc.key
+ chgrp bind /etc/bind
+ chmod g+s /etc/bind
+ chgrp bind /etc/bind/rndc.key /var/cache/bind
+ chgrp bind /etc/bind/named.conf* || true
+ chmod g+r /etc/bind/rndc.key /etc/bind/named.conf* || true
+ chmod g+rwx /var/cache/bind
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0