summaryrefslogtreecommitdiff
path: root/extra/bind/bind.install
diff options
context:
space:
mode:
Diffstat (limited to 'extra/bind/bind.install')
-rw-r--r--extra/bind/bind.install23
1 files changed, 23 insertions, 0 deletions
diff --git a/extra/bind/bind.install b/extra/bind/bind.install
new file mode 100644
index 000000000..170042111
--- /dev/null
+++ b/extra/bind/bind.install
@@ -0,0 +1,23 @@
+post_install() {
+ getent group named &>/dev/null || groupadd -g 40 named
+ getent passwd named &>/dev/null || useradd -u 40 -c 'BIND DNS Server' -g named -d /var/named -s /bin/false named
+ passwd -l named &>/dev/null
+
+ touch var/log/named.log
+ chown named:named var/log/named.log
+
+ # create an rndc.key if it doesn't already exist
+ if [[ ! -s etc/rndc.key ]]; then
+ rndc-confgen -r /dev/urandom -b 256 | head -n 5 >>etc/rndc.key
+ chown root:named etc/rndc.key
+ chmod 640 etc/rndc.key
+ fi
+}
+
+pre_remove() {
+ getent passwd named &>/dev/null && userdel named >/dev/null
+ getent group named &>/dev/null && groupdel named >/dev/null
+ return 0
+}
+
+# vim:set ts=2 sw=2 et: