diff --git a/Dockerfile b/Dockerfile index 9b9ea54..3020157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,10 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ apt-get install -q -y bind9 dnsutils && \ apt-get clean +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + apt-get install -q -y vim udev cron && \ + apt-get clean + RUN chmod 770 /var/cache/bind COPY setup.sh /root/setup.sh RUN chmod +x /root/setup.sh diff --git a/Makefile b/Makefile index d3af69e..d8ad9bb 100644 --- a/Makefile +++ b/Makefile @@ -25,4 +25,4 @@ api_test_recursion: dig @docker.local google.com deploy: image - docker run -it -d -p 8080:8080 -p 53:53 -p 53:53/udp --env-file envfile --name=dyndns davd/docker-ddns:latest + docker run -it -d --restart="always" -p 8080:8080 -p 53:53 -p 53:53/udp -v /opt/bind:/var/cache/bind --env-file envfile --name=dyndns davd/docker-ddns:latest diff --git a/envfile b/envfile index fc51a2d..db36003 100644 --- a/envfile +++ b/envfile @@ -1,3 +1,4 @@ SHARED_SECRET=changeme ZONE=example.org -RECORD_TTL=3600 \ No newline at end of file +RECORD_TTL=3600 +NS=ns.example.org diff --git a/named.conf.options b/named.conf.options index 9c0925d..6393c05 100644 --- a/named.conf.options +++ b/named.conf.options @@ -1,8 +1,10 @@ options { directory "/var/cache/bind"; - dnssec-validation auto; + dnssec-enable yes; + dnssec-validation yes; + dnssec-lookaside auto; recursion no; allow-transfer { none; }; auth-nxdomain no; listen-on-v6 { any; }; -}; \ No newline at end of file +}; diff --git a/setup.sh b/setup.sh index c373bc7..f8dbc3b 100755 --- a/setup.sh +++ b/setup.sh @@ -6,29 +6,41 @@ if [ ! -f /var/cache/bind/$ZONE.zone ] then - echo "creating zone..."; - cat >> /etc/bind/named.conf <> /etc/bind/named.conf < /var/cache/bind/$ZONE.zone < /var/cache/bind/$ZONE.zone < /etc/dyndns.json < /etc/dyndns.json <> $ZONE.zone + done + + dnssec-signzone -A -3 $(head -c 1000 /dev/urandom | sha1sum | cut -b 1-16) -N INCREMENT -o $ZONE -t $ZONE.zone +fi + +# Increase safety to prevents hacks with raindow tables +if [ ! -f /usr/sbin/zonesigner.sh ] +then + echo "Creating /usr/sbin/zonesigner.sh..." + cat > /usr/sbin/zonesigner.sh < /var/spool/cron/crontabs/root <