-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
48 lines (40 loc) · 1.41 KB
/
entrypoint.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
44
45
46
47
48
#!/bin/sh -e
if [ "$1" = 'unbound' ]; then
if [ ! -f ./data/root.hints ]; then
echo "-- Start bootstrap"
if [ -f /etc/unbound/unbound.conf ]; then
rm /etc/unbound/unbound.conf
fi
ln ./config/bootstrap.conf /etc/unbound/unbound.conf
unbound
echo "-----------------"
echo "-- Set nameserver"
echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "-----------------"
echo "-- Get root.hints from internic.net"
curl -s https://www.internic.net/domain/named.root > ./data/root.hints || echo "download failed !!"
if [ ! -f ./data/root.hints ]; then
echo "using bootstrap.hints"
ln ./data/bootstrap.hints ./data/root.hints
fi
echo "-----------------"
echo "-- Verify anchor(root.key)"
unbound-anchor -4 -v -a ./data/root.key || echo "verification failed !!"
echo "-----------------"
echo "-- Set permissions"
chown unbound ./data -R
chgrp unbound ./data -R
echo "-----------------"
echo "-- End bootstrap"
killall unbound
rm /etc/unbound/unbound.conf
ln ./config/unbound.conf /etc/unbound/unbound.conf
echo "-----------------"
fi
echo "-- Start unbound"
if [ ! -f /etc/unbound/unbound.conf ]; then
ln ./config/unbound.conf /etc/unbound/unbound.conf
fi
exec "$@"
fi
exit 0