docker-dnscache/rootfs/app/entrypoint.sh
paspo 045c1b1904
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
dns proxy
2025-03-24 14:40:12 +01:00

48 lines
928 B
Bash
Executable File

#!/bin/sh
LOGS=${LOGS:-false}
LOGDIR=${LOGDIR:-/logs}
PORT=${PORT:-1053}
VERBOSITY=${VERBOSITY:-1}
DNSPROXY=${DNSPROXY:-false}
ACCESSLOG=${ACCESSLOG:-true}
# set logs
if [ "${LOGS}" = true ] ; then
mkdir -p "${LOGDIR}"
chown unbound:unbound "${LOGDIR}"
cat >> /etc/unbound/unbound.conf.d/logs.conf << EOF
server:
verbosity: ${VERBOSITY}
log-queries: yes
log-replies: yes
logfile: "${LOGDIR}/unbound.log"
log-time-ascii: yes
log-servfail: yes
log-local-actions: yes
EOF
else
cat >> /etc/unbound/unbound.conf.d/logs.conf << EOF
server:
verbosity: ${VERBOSITY}
log-queries: no
log-replies: no
logfile: ""
EOF
fi
# set port
cat >> /etc/unbound/unbound.conf.d/port.conf << EOF
server:
port: ${PORT}
EOF
if [ "${DNSPROXY}" = true ] ; then
export DNS_SERVER=127.0.0.1
export DNS_PORT="${PORT}"
/app/dnsproxy &
fi
# start unbound
/usr/sbin/unbound -d