From 24b96e74a13496a946e960cfed7573a4517b4a7b Mon Sep 17 00:00:00 2001 From: Steve HOLWEG Date: Wed, 27 Dec 2017 18:58:53 +0100 Subject: [PATCH] Add api directory for api use (#8) * Add API conf directory * Correct PDNS recursor user on fedora * Fix config user right --- pdns-recursor/Dockerfile | 3 +++ pdns-recursor/Dockerfile.alpine | 3 +++ pdns-recursor/docker-cmd.sh | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/pdns-recursor/Dockerfile b/pdns-recursor/Dockerfile index e09ffa9..e6403bf 100644 --- a/pdns-recursor/Dockerfile +++ b/pdns-recursor/Dockerfile @@ -8,6 +8,9 @@ RUN dnf -y --setopt=install_weak_deps=False install \ RUN pip3 install envtpl \ && rm -rf ~/.cache/* +RUN mkdir -p /etc/pdns/api.d \ + && chown -R pdns-recursor:pdns-recursor /etc/pdns/api.d + ENV VERSION=4.0 \ PDNS_setuid=recursor \ PDNS_setgid=recursor \ diff --git a/pdns-recursor/Dockerfile.alpine b/pdns-recursor/Dockerfile.alpine index 6cde23d..cdbc69d 100644 --- a/pdns-recursor/Dockerfile.alpine +++ b/pdns-recursor/Dockerfile.alpine @@ -8,6 +8,9 @@ RUN apk add --no-cache \ RUN pip3 install envtpl \ && rm -rf ~/.cache/* +RUN mkdir -p /etc/pdns/api.d \ + && chown -R recursor:recursor /etc/pdns/api.d + ENV VERSION=4.0 \ PDNS_setuid=recursor \ PDNS_setgid=recursor \ diff --git a/pdns-recursor/docker-cmd.sh b/pdns-recursor/docker-cmd.sh index 2209349..fc205f5 100755 --- a/pdns-recursor/docker-cmd.sh +++ b/pdns-recursor/docker-cmd.sh @@ -11,4 +11,13 @@ export PDNS_local_port PDNS_local_address # Create config file from template envtpl < /recursor.conf.tpl > /etc/pdns/recursor.conf +# fix config right +if [ getent passwd | grep -c '^pdns-recursor:' ]; then + # Fedora user + chown pdns-recursor:pdns-recursor /etc/pdns/recursor.conf +else + # Alpine user + chown recursor:recursor /etc/pdns/recursor.conf +fi + exec /usr/sbin/pdns_recursor