Skip to content

Commit

Permalink
Adding source files
Browse files Browse the repository at this point in the history
  • Loading branch information
bfren committed Sep 15, 2023
1 parent 84c3938 commit 9ed6b3a
Show file tree
Hide file tree
Showing 17 changed files with 1,424 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM bfren/alpine-s6:alpine3.18-4.5.7

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-unbound"

ARG BF_IMAGE
ARG BF_VERSION

EXPOSE 53/tcp
EXPOSE 53/udp

COPY ./overlay /

RUN bf-install
12 changes: 12 additions & 0 deletions overlay/etc/bf/init.d/10-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/command/with-contenv sh

set -euo pipefail
export BF_E=`basename ${0}`


#======================================================================================================================
# Set environment variables.
#======================================================================================================================

bf-env "UNBOUND_CONF" "/etc/unbound/unbound.conf"
bf-env "UNBOUND_TRUSTED_KEY" "/usr/share/dnssec-root/trusted-key.key"
13 changes: 13 additions & 0 deletions overlay/etc/bf/init.d/11-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/command/with-contenv sh

set -euo pipefail
export BF_E=`basename ${0}`


#======================================================================================================================
# Generate Unbound config file.
#======================================================================================================================

bf-esh \
${BF_TEMPLATES}/unbound.conf.esh \
${UNBOUND_CONF}
1,280 changes: 1,280 additions & 0 deletions overlay/etc/bf/templates/unbound.conf.esh

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions overlay/etc/periodic/daily/update-anchor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/command/with-contenv sh
set -euo pipefail
export BF_E=`basename ${0}`


#======================================================================================================================
# Update root anchor.
#======================================================================================================================

unbound-update-root-anchor
Empty file.
11 changes: 11 additions & 0 deletions overlay/etc/s6-overlay/s6-rc.d/unbound/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/command/with-contenv sh

set -euo pipefail
export BF_E="${PWD##*/}/$(basename ${0})"


#======================================================================================================================
# Show helpful log message.
#======================================================================================================================

bf-svc-finish -t
20 changes: 20 additions & 0 deletions overlay/etc/s6-overlay/s6-rc.d/unbound/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/command/with-contenv sh

set -euo pipefail
export BF_E="${PWD##*/}/$(basename ${0})"


#======================================================================================================================
# Run Unbound service.
#======================================================================================================================

[[ ! -f ${UNBOUND_CONF} ]] && bf-error "Unbound configuration file not found."

bf-echo "Updating root anchor."
unbound-update-root-anchor

bf-echo "Checking Unbound configuration."
unbound-checkconf ${UNBOUND_CONF}

bf-echo "Starting Unbound in daemon mode."
unbound -c ${UNBOUND_CONF} -d
1 change: 1 addition & 0 deletions overlay/etc/s6-overlay/s6-rc.d/unbound/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
1 change: 1 addition & 0 deletions overlay/tmp/UNBOUND_BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.17.1-r1
1 change: 1 addition & 0 deletions overlay/tmp/UNBOUND_MAJOR
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions overlay/tmp/UNBOUND_MINOR
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.17
1 change: 1 addition & 0 deletions overlay/tmp/UNBOUND_REVISION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.17.1
38 changes: 38 additions & 0 deletions overlay/tmp/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

set -euo pipefail
export BF_E=`basename ${0}`


#======================================================================================================================
# Add Unbound user.
#======================================================================================================================

bf-adduser unbound


#======================================================================================================================
# Get Unbound version.
#======================================================================================================================

cd /tmp

VERSION=$(cat UNBOUND_BUILD)
bf-echo "Unbound version ${VERSION}."


#======================================================================================================================
# Install Unbound and dependencies.
#======================================================================================================================

bf-echo "Installing Unbound v${VERSION}..."
apk add --no-cache \
unbound=${VERSION}
bf-done


#======================================================================================================================
# Cleanup.
#======================================================================================================================

bf-done
11 changes: 11 additions & 0 deletions overlay/usr/bin/bf/healthcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/command/with-contenv sh

set -euo pipefail
export BF_E=`basename ${0}`


#======================================================================================================================
# Attempt to connect to the local Samba server.
#======================================================================================================================

drill @127.0.0.1 cloudflare.com || exit 1
11 changes: 11 additions & 0 deletions overlay/usr/bin/bf/unbound-update-root-anchor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/command/with-contenv sh

set -euo pipefail
export BF_E=`basename ${0}`


#======================================================================================================================
# Update root anchor.
#======================================================================================================================

unbound-anchor -v -a ${UNBOUND_TRUSTED_KEY}

0 comments on commit 9ed6b3a

Please sign in to comment.