2017-12-11 14:18:10 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Configure base vars
|
|
|
|
: "${PDNS_local_port:=53}"
|
|
|
|
: "${PDNS_local_address:=0.0.0.0}"
|
2018-11-06 22:51:45 +01:00
|
|
|
: "${PDNS_allow_from:=0.0.0.0/0}"
|
2017-12-11 14:18:10 +01:00
|
|
|
|
2018-11-06 22:51:45 +01:00
|
|
|
export PDNS_local_port PDNS_local_address PDNS_allow_from
|
|
|
|
|
|
|
|
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
|
2017-12-11 14:18:10 +01:00
|
|
|
|
|
|
|
# Create config file from template
|
2023-12-19 18:25:44 +01:00
|
|
|
subvars --prefix 'PDNS_' < /recursor.conf.tpl > $config_file
|
2017-12-11 14:18:10 +01:00
|
|
|
|
2018-11-06 22:51:45 +01:00
|
|
|
# Fix config file ownership
|
|
|
|
chown ${pdns_user}: $config_file
|
2017-12-27 18:58:53 +01:00
|
|
|
|
2018-11-22 19:45:43 +01:00
|
|
|
exec "$@"
|