aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/authoritative_nameserver
blob: 0b7e73faec4388b60bf714164951d80cfebdcdb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

: ${nsd_zones:=''}
: ${nsd_threads:='2'}

# nsd_zones='example1 example2'
# nsd_example1_domain=example.com
# nsd_example1_slaves='1.2.3.4  5.6.7.8'

nsd_conf_dir=/usr/local/etc/nsd
nsd_run_dir=/var/run/nsd

# Install packages.
pkg install -y nsd

# Generate nsd configuration.
install_template -m 0644 /usr/local/etc/nsd/nsd.conf

# Copy zone files.
for zone in $nsd_zones; do
  eval "_domain=\${nsd_${zone}_domain}"
  install_file -m 0644 "${nsd_conf_dir}/${_domain}.zone"
done

# Enable and start nsd.
sysrc -v nsd_enable=YES
service nsd restart