-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (50 loc) · 2.35 KB
/
Dockerfile
File metadata and controls
56 lines (50 loc) · 2.35 KB
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
56
FROM alpine:3.10
LABEL description "Simple DNS authoritative server with DNSSEC support" \
maintainer="Hardware <contact@meshup.net>"
ARG NSD_VERSION=4.2.4
# https://pgp.mit.edu/pks/lookup?search=0xE7194568&fingerprint=on&op=index
# pub 4096R/E7194568 2019-12-10 Jeroen Koekkoek <jeroen@nlnetlabs.nl>
ARG GPG_SHORTID="0xE7194568"
ARG GPG_FINGERPRINT="C3E3 5678 8FAD 0179 D872 D092 BA81 1E62 E719 4568"
ARG SHA256_HASH="9ebd6d766765631a56c0eb332eac26b310fa39f662e5582c8210488cf91ef27c"
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 hkps.pool.sks-keyservers.net --recv-keys ${GPG_SHORTID} || \
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"]