This repository has been archived by the owner on Nov 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Dockerfile
55 lines (49 loc) · 2.27 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM alpine:3.10
LABEL description "Simple DNS authoritative server with DNSSEC support" \
maintainer="Hardware <[email protected]>"
ARG NSD_VERSION=4.2.1
# https://pgp.mit.edu/pks/lookup?search=0x7E045F8D&fingerprint=on&op=index
# pub 4096R/7E045F8D 2011-04-21 W.C.A. Wijngaards <[email protected]>
ARG GPG_SHORTID="0x7E045F8D"
ARG GPG_FINGERPRINT="EDFA A3F2 CA4E 6EB0 5681 AF8E 9F6F 1C2D 7E04 5F8D"
ARG SHA256_HASH="d17c0ea3968cb0eb2be79f2f83eb299b7bfcc554b784007616eed6ece828871f"
ENV UID=991 GID=991
RUN apk add --no-cache --virtual build-dependencies \
gnupg \
build-base \
libevent-dev \
openssl-dev \
ca-certificates \
&& apk add --no-cache \
ldns \
ldns-tools \
libevent \
openssl \
tini \
&& cd /tmp \
&& wget -q https://www.nlnetlabs.nl/downloads/nsd/nsd-${NSD_VERSION}.tar.gz \
&& wget -q https://www.nlnetlabs.nl/downloads/nsd/nsd-${NSD_VERSION}.tar.gz.asc \
&& echo "Verifying both integrity and authenticity of nsd-${NSD_VERSION}.tar.gz..." \
&& CHECKSUM=$(sha256sum nsd-${NSD_VERSION}.tar.gz | awk '{print $1}') \
&& if [ "${CHECKSUM}" != "${SHA256_HASH}" ]; then echo "ERROR: Checksum does not match!" && exit 1; fi \
&& ( \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys ${GPG_SHORTID} || \
gpg --keyserver keyserver.pgp.com --recv-keys ${GPG_SHORTID} || \
gpg --keyserver pgp.mit.edu --recv-keys ${GPG_SHORTID} \
) \
&& FINGERPRINT="$(LANG=C gpg --verify nsd-${NSD_VERSION}.tar.gz.asc nsd-${NSD_VERSION}.tar.gz 2>&1 \
| sed -n "s#Primary key fingerprint: \(.*\)#\1#p")" \
&& if [ -z "${FINGERPRINT}" ]; then echo "ERROR: Invalid GPG signature!" && exit 1; fi \
&& if [ "${FINGERPRINT}" != "${GPG_FINGERPRINT}" ]; then echo "ERROR: Wrong GPG fingerprint!" && exit 1; fi \
&& echo "All seems good, now unpacking nsd-${NSD_VERSION}.tar.gz..." \
&& tar xzf nsd-${NSD_VERSION}.tar.gz && cd nsd-${NSD_VERSION} \
&& ./configure \
CFLAGS="-O2 -flto -fPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wformat -Werror=format-security" \
LDFLAGS="-Wl,-z,now -Wl,-z,relro" \
&& make && make install \
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* /tmp/* /root/.gnupg
COPY bin /usr/local/bin
VOLUME /zones /etc/nsd /var/db/nsd
EXPOSE 53 53/udp
CMD ["run.sh"]