forked from taosnet/docker-pdns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-pdns.sh
executable file
·43 lines (40 loc) · 1.31 KB
/
docker-pdns.sh
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# Initial setup
if ! [ -e /etc/pdns/conf.d/backend.conf ]; then
if [ -n "$BACKEND" ]; then
if [ "$BACKEND" = "sqlite" ]; then
mv /etc/pdns/default.conf.d/sqlite.conf /etc/pdns/conf.d/backend.conf
if ! [ -e /etc/pdns/db/zones.db ]; then
cp /etc/pdns/db.init/zones.db /etc/pdns/db/zones.db
fi
chown -R pdns.pdns /etc/pdns/db
fi
fi
if [ -n "$APIKEY" ]; then
sed "s/DNSAPIS3rv3r/$APIKEY/" /etc/pdns/default.conf.d/api.conf >/etc/pdns/conf.d/api.conf
if [ -n "$WEBKEY" ]; then
sed -i "s/DNSW3bP4ssword/$WEBKEY/" /etc/pdns/conf.d/api.conf
fi
fi
if [ -n "$MASTER" ] && [ "$MASTER" = "yes" ]; then
mv /etc/pdns/default.conf.d/master.conf /etc/pdns/conf.d/master.conf
if [ -n "$AXFR" ]; then
echo allow-axfr-ips="$AXFR" >>/etc/pdns/conf.d/master.conf
fi
fi
# Defaults to slave mode
if [ -z "$SLAVE" ] || [ "$SLAVE" = "yes" ]; then
mv /etc/pdns/default.conf.d/slave.conf /etc/pdns/conf.d/slave.conf
fi
if [ -n "$SMTP" ]; then
sed "s/default-soa-mail=DIRECTOR/default-soa-mail=$SMTP/" </etc/pdns/default.conf.d/soa.conf >/etc/pdns/conf.d/soa.conf
fi
if [ -n "$SOA_NAME" ]; then
echo "default-soa-name=$SOA_NAME" >>/etc/pdns/conf.d/soa.conf
fi
fi
if ! [ -e /etc/pdns/conf.d/backend.conf ]; then
echo Must specify a backend to use!
exit 1
fi
/usr/sbin/pdns_server --config-dir=/etc/pdns