Update / fix pdns-recursor image

This commit is contained in:
Peter Schiffer 2018-11-06 22:51:45 +01:00
parent a0038d10d8
commit e615b8318c
No known key found for this signature in database
GPG key ID: 6CCC5046E2B0B44B
3 changed files with 25 additions and 24 deletions

View file

@ -1,19 +1,18 @@
FROM fedora:27 FROM fedora:29
MAINTAINER "Peter Schiffer" <pschiffe@redhat.com> MAINTAINER "Peter Schiffer" <peter@rfv.sk>
RUN dnf -y --setopt=install_weak_deps=False install \ RUN dnf -y --setopt=install_weak_deps=False install \
pdns-recursor \ pdns-recursor \
&& dnf clean all && dnf clean all
RUN pip3 install envtpl \ RUN pip3 install --no-cache-dir envtpl
&& rm -rf ~/.cache/*
RUN mkdir -p /etc/pdns/api.d \ RUN mkdir -p /etc/pdns-recursor/api.d \
&& chown -R pdns-recursor:pdns-recursor /etc/pdns/api.d && chown -R pdns-recursor: /etc/pdns-recursor/api.d
ENV VERSION=4.0 \ ENV VERSION=4.1 \
PDNS_setuid=recursor \ PDNS_setuid=pdns-recursor \
PDNS_setgid=recursor \ PDNS_setgid=pdns-recursor \
PDNS_daemon=no PDNS_daemon=no
EXPOSE 53 53/udp EXPOSE 53 53/udp

View file

@ -1,15 +1,14 @@
FROM alpine:3.8 FROM alpine:3.8
MAINTAINER "Peter Schiffer" <pschiffe@redhat.com> MAINTAINER "Peter Schiffer" <peter@rfv.sk>
RUN apk add --no-cache \ RUN apk add --no-cache \
pdns-recursor \ pdns-recursor \
python3 python3
RUN pip3 install envtpl \ RUN pip3 install --no-cache-dir envtpl
&& rm -rf ~/.cache/*
RUN mkdir -p /etc/pdns/api.d \ 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 \ ENV VERSION=4.1 \
PDNS_setuid=recursor \ PDNS_setuid=recursor \

View file

@ -5,19 +5,22 @@ set -euo pipefail
# Configure base vars # Configure base vars
: "${PDNS_local_port:=53}" : "${PDNS_local_port:=53}"
: "${PDNS_local_address:=0.0.0.0}" : "${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 if [ -f /etc/fedora-release ]; then
envtpl < /recursor.conf.tpl > /etc/pdns/recursor.conf config_file=/etc/pdns-recursor/recursor.conf
pdns_user=pdns-recursor
# fix config right elif [ -f /etc/alpine-release ]; then
if getent passwd | grep -q '^pdns-recursor:'; then config_file=/etc/pdns/recursor.conf
# Fedora user pdns_user=recursor
chown pdns-recursor:pdns-recursor /etc/pdns/recursor.conf
else
# Alpine user
chown recursor:recursor /etc/pdns/recursor.conf
fi 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 exec /usr/sbin/pdns_recursor