diff --git a/rootfs/app/entrypoint.sh b/rootfs/app/entrypoint.sh index 765134d..3b46893 100755 --- a/rootfs/app/entrypoint.sh +++ b/rootfs/app/entrypoint.sh @@ -1,5 +1,39 @@ #!/bin/sh +LOGS=${LOGS:-false} +LOGDIR=${LOGDIR:-/logs} +PORT=${PORT:-1053} +VERBOSITY=${VERBOSITY:-1} +# 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 + +# start unbound /usr/sbin/unbound -d diff --git a/rootfs/etc/unbound/unbound.conf b/rootfs/etc/unbound/unbound.conf index 061b3c2..76bc348 100644 --- a/rootfs/etc/unbound/unbound.conf +++ b/rootfs/etc/unbound/unbound.conf @@ -1,6 +1,5 @@ server: interface: 0.0.0.0 - port: 1053 do-ip4: yes do-ip6: no do-udp: yes @@ -10,14 +9,6 @@ server: cache-max-ttl: 86400 prefetch: yes num-threads: 4 - verbosity: 1 -# log-queries: yes - log-queries: no -# log-replies: yes - logfile: "" - log-time-ascii: yes - log-servfail: yes -# log-local-actions: yes use-syslog: no msg-cache-slabs: 8 rrset-cache-slabs: 8 @@ -36,3 +27,4 @@ dynlib: remote-control: control-enable: yes control-interface: /run/unbound.control.sock +include-toplevel: "/etc/unbound/unbound.conf.d/*.conf"