#!/bin/sh set -e RNDC_KEY_FILE="/etc/bind/rndc.key" # Generate an rndc key fresh for every server startup. This is only used for # internal management with the rndc command so there's no need to persist it. touch $RNDC_KEY_FILE chown named:named $RNDC_KEY_FILE chmod 0660 $RNDC_KEY_FILE /usr/sbin/ddns-confgen -q -k rndc-key > $RNDC_KEY_FILE # Create directories for secondaries for i in $(grep ^view /etc/bind/local/named.conf | cut -d' ' -f2); do mkdir -p /etc/bind/local/zones/$i done mkdir -p /etc/bind/local/managed-keys # Make sure BIND can write everything chown -R named:named /etc/bind/local exec "$@"