From e615b8318c94765a78fc182d1d2fe1f568566e68 Mon Sep 17 00:00:00 2001 From: Peter Schiffer Date: Tue, 6 Nov 2018 22:51:45 +0100 Subject: [PATCH] Update / fix pdns-recursor image --- pdns-recursor/Dockerfile | 17 ++++++++--------- pdns-recursor/Dockerfile.alpine | 7 +++---- pdns-recursor/docker-cmd.sh | 25 ++++++++++++++----------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/pdns-recursor/Dockerfile b/pdns-recursor/Dockerfile index e6403bf..788bbc4 100644 --- a/pdns-recursor/Dockerfile +++ b/pdns-recursor/Dockerfile @@ -1,19 +1,18 @@ -FROM fedora:27 -MAINTAINER "Peter Schiffer" +FROM fedora:29 +MAINTAINER "Peter Schiffer" RUN dnf -y --setopt=install_weak_deps=False install \ pdns-recursor \ && dnf clean all -RUN pip3 install envtpl \ - && rm -rf ~/.cache/* +RUN pip3 install --no-cache-dir envtpl -RUN mkdir -p /etc/pdns/api.d \ - && chown -R pdns-recursor:pdns-recursor /etc/pdns/api.d +RUN mkdir -p /etc/pdns-recursor/api.d \ + && chown -R pdns-recursor: /etc/pdns-recursor/api.d -ENV VERSION=4.0 \ - PDNS_setuid=recursor \ - PDNS_setgid=recursor \ +ENV VERSION=4.1 \ + PDNS_setuid=pdns-recursor \ + PDNS_setgid=pdns-recursor \ PDNS_daemon=no EXPOSE 53 53/udp diff --git a/pdns-recursor/Dockerfile.alpine b/pdns-recursor/Dockerfile.alpine index d179f78..8fbe08f 100644 --- a/pdns-recursor/Dockerfile.alpine +++ b/pdns-recursor/Dockerfile.alpine @@ -1,15 +1,14 @@ FROM alpine:3.8 -MAINTAINER "Peter Schiffer" +MAINTAINER "Peter Schiffer" RUN apk add --no-cache \ pdns-recursor \ python3 -RUN pip3 install envtpl \ - && rm -rf ~/.cache/* +RUN pip3 install --no-cache-dir envtpl RUN mkdir -p /etc/pdns/api.d \ - && chown -R recursor:recursor /etc/pdns/api.d + && chown -R recursor: /etc/pdns/api.d ENV VERSION=4.1 \ PDNS_setuid=recursor \ diff --git a/pdns-recursor/docker-cmd.sh b/pdns-recursor/docker-cmd.sh index e373f56..37a1b53 100755 --- a/pdns-recursor/docker-cmd.sh +++ b/pdns-recursor/docker-cmd.sh @@ -5,19 +5,22 @@ set -euo pipefail # Configure base vars : "${PDNS_local_port:=53}" : "${PDNS_local_address:=0.0.0.0}" +: "${PDNS_allow_from:=0.0.0.0/0}" -export PDNS_local_port PDNS_local_address +export PDNS_local_port PDNS_local_address PDNS_allow_from -# Create config file from template -envtpl < /recursor.conf.tpl > /etc/pdns/recursor.conf - -# fix config right -if getent passwd | grep -q '^pdns-recursor:'; then - # Fedora user - chown pdns-recursor:pdns-recursor /etc/pdns/recursor.conf -else - # Alpine user - chown recursor:recursor /etc/pdns/recursor.conf +if [ -f /etc/fedora-release ]; then + config_file=/etc/pdns-recursor/recursor.conf + pdns_user=pdns-recursor +elif [ -f /etc/alpine-release ]; then + config_file=/etc/pdns/recursor.conf + pdns_user=recursor fi +# Create config file from template +envtpl < /recursor.conf.tpl > $config_file + +# Fix config file ownership +chown ${pdns_user}: $config_file + exec /usr/sbin/pdns_recursor