summaryrefslogtreecommitdiff
path: root/extra/bind/install
blob: 287d0e05be60b45c8b47e587aac3c83e3d5c23d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
		usr/sbin/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
}