2013-09-01 14:13:51 +00:00
|
|
|
# DNS: Configure a DNS server using nsd
|
|
|
|
#######################################
|
|
|
|
|
2014-06-13 00:18:53 +00:00
|
|
|
# This script installs packages, but the DNS zone files are only
|
|
|
|
# created by the /dns/update API in the management server because
|
|
|
|
# the set of zones (domains) hosted by the server depends on the
|
|
|
|
# mail users & aliases created by the user later.
|
2013-09-01 14:13:51 +00:00
|
|
|
|
2014-06-03 11:12:38 +00:00
|
|
|
source setup/functions.sh # load our functions
|
2014-05-01 19:13:00 +00:00
|
|
|
|
2014-04-18 00:17:24 +00:00
|
|
|
# Install nsd, our DNS server software.
|
2013-08-21 20:53:22 +00:00
|
|
|
|
2014-04-23 21:53:59 +00:00
|
|
|
# ...but first, we have to create the user because the
|
|
|
|
# current Ubuntu forgets to do so in the .deb
|
2014-04-23 22:40:33 +00:00
|
|
|
# see issue #25 and https://bugs.launchpad.net/ubuntu/+source/nsd/+bug/1311886
|
2014-04-23 21:53:59 +00:00
|
|
|
if id nsd > /dev/null 2>&1; then
|
2014-04-23 22:40:33 +00:00
|
|
|
true; #echo "nsd user exists... good";
|
2014-04-23 21:53:59 +00:00
|
|
|
else
|
|
|
|
useradd nsd;
|
2014-04-23 22:40:33 +00:00
|
|
|
fi
|
|
|
|
|
2014-06-13 00:18:53 +00:00
|
|
|
# Okay now install the packages.
|
2014-04-23 22:40:33 +00:00
|
|
|
|
2014-06-04 21:27:01 +00:00
|
|
|
apt_install nsd
|
2013-08-21 20:53:22 +00:00
|
|
|
|
2014-04-18 00:17:24 +00:00
|
|
|
# Prepare nsd's configuration.
|
2013-09-01 14:13:51 +00:00
|
|
|
|
2014-04-18 00:17:24 +00:00
|
|
|
sudo mkdir -p /var/run/nsd
|
2013-09-01 14:13:51 +00:00
|
|
|
|
|
|
|
# Permit DNS queries on TCP/UDP in the firewall.
|
2013-08-21 20:53:22 +00:00
|
|
|
|
2014-05-01 19:35:18 +00:00
|
|
|
ufw_allow domain
|
2013-08-21 20:53:22 +00:00
|
|
|
|