aboutsummaryrefslogtreecommitdiff
path: root/bind/entrypoint.sh
blob: b8b5a9cbb9fcf8c4db0c8a233268ca728ca02d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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 "$@"