Skip to content

Commit c1e798b

Browse files
authored
Merge pull request #65 from pi-hole/mbedtls-zip
Add mbedTLS library and ZIP into FTL builder
2 parents 555dcba + 6aea9b0 commit c1e798b

File tree

10 files changed

+121
-1
lines changed

10 files changed

+121
-1
lines changed

ftl-build/aarch64/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARG idnversion=1.41
44
ARG readlineversion=8.1
55
ARG termcapversion=1.3.1
66
ARG nettleversion=3.8.1
7+
ARG mbedtlsversion=3.4.0
78

89
RUN dpkg --add-architecture arm64 \
910
&& apt-get update \
@@ -30,6 +31,8 @@ RUN dpkg --add-architecture arm64 \
3031
jq \
3132
git \
3233
dnsutils \
34+
perl \
35+
python3 \
3336
&& rm -rf /var/lib/apt/lists/*
3437

3538
ENV CC aarch64-linux-gnu-gcc -isystem /usr/local/include
@@ -66,6 +69,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
6669
&& cd .. \
6770
&& rm -r nettle-${nettleversion}
6871

72+
# Build static mbedTLS with pthread support
73+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
74+
&& cd mbedtls-${mbedtlsversion} \
75+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
76+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
77+
&& make -j $(nproc) install \
78+
&& cd .. \
79+
&& rm -r mbedtls-${mbedtlsversion}
80+
6981
FROM builder AS tester
7082

7183
# For FTL test compilation

ftl-build/armv4t/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ARG idnversion=1.41
55
ARG readlineversion=8.1
66
ARG termcapversion=1.3.1
77
ARG nettleversion=3.8.1
8+
ARG mbedtlsversion=3.4.0
89

910
RUN dpkg --add-architecture armel \
1011
&& apt-get update \
@@ -30,6 +31,8 @@ RUN dpkg --add-architecture armel \
3031
libc6:armel \
3132
xxd \
3233
jq \
34+
perl \
35+
python3 \
3336
&& rm -rf /var/lib/apt/lists/*
3437

3538
# Github actions/Checkout@v2 requires git >=2.18 else it will fall back to github API to download tarball
@@ -76,6 +79,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
7679
&& cd .. \
7780
&& rm -r nettle-${nettleversion}
7881

82+
# Build static mbedTLS with pthread support
83+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
84+
&& cd mbedtls-${mbedtlsversion} \
85+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
86+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
87+
&& make -j $(nproc) install \
88+
&& cd .. \
89+
&& rm -r mbedtls-${mbedtlsversion}
90+
7991
FROM builder AS tester
8092

8193
# For FTL test compilation

ftl-build/armv5te/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM debian:buster@sha256:0685c900f6e691bdda6980c0ed0779d20183bc58770059b64adb56
44
ARG idnversion=1.41
55
ARG readlineversion=8.1
66
ARG termcapversion=1.3.1
7+
ARG mbedtlsversion=3.4.0
78

89
RUN dpkg --add-architecture armel \
910
&& apt-get update \
@@ -28,6 +29,8 @@ RUN dpkg --add-architecture armel \
2829
jq \
2930
git \
3031
dnsutils \
32+
perl \
33+
python3 \
3134
&& rm -rf /var/lib/apt/lists/*
3235

3336
ENV CC "arm-linux-gnueabi-gcc -isystem /usr/local/include"
@@ -58,6 +61,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/readline-${readlineversion}.tar.
5861
&& cd .. \
5962
&& rm -r readline-${readlineversion}
6063

64+
# Build static mbedTLS with pthread support
65+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
66+
&& cd mbedtls-${mbedtlsversion} \
67+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
68+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
69+
&& make -j $(nproc) install \
70+
&& cd .. \
71+
&& rm -r mbedtls-${mbedtlsversion}
72+
6173
FROM builder AS tester
6274

6375
# For FTL test compilation

ftl-build/armv6hf/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM debian:buster@sha256:0685c900f6e691bdda6980c0ed0779d20183bc58770059b64adb56
44
ARG idnversion=1.41
55
ARG readlineversion=8.1
66
ARG termcapversion=1.3.1
7+
ARG mbedtlsversion=3.4.0
78

89
# Packages required to install compiler and libraries
910
RUN dpkg --add-architecture armel \
@@ -29,6 +30,8 @@ RUN dpkg --add-architecture armel \
2930
xxd \
3031
jq \
3132
git \
33+
perl \
34+
python3 \
3235
&& rm -rf /var/lib/apt/lists/*
3336

3437
# Use cross-compiler from https://github.com/abhiTronix/raspberry-pi-cross-compilers
@@ -73,6 +76,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/readline-${readlineversion}.tar.
7376
&& cd .. \
7477
&& rm -r readline-${readlineversion}
7578

79+
# Build static mbedTLS with pthread support
80+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
81+
&& cd mbedtls-${mbedtlsversion} \
82+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
83+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
84+
&& make -j $(nproc) install \
85+
&& cd .. \
86+
&& rm -r mbedtls-${mbedtlsversion}
87+
7688
FROM builder AS tester
7789

7890
# For FTL test compilation

ftl-build/armv7hf/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARG idnversion=1.41
44
ARG readlineversion=8.1
55
ARG termcapversion=1.3.1
66
ARG nettleversion=3.8.1
7+
ARG mbedtlsversion=3.4.0
78

89
RUN dpkg --add-architecture armhf \
910
&& apt-get update \
@@ -30,6 +31,8 @@ RUN dpkg --add-architecture armhf \
3031
jq \
3132
git \
3233
dnsutils \
34+
perl \
35+
python3 \
3336
&& rm -rf /var/lib/apt/lists/*
3437

3538
ENV CC "arm-linux-gnueabihf-gcc -isystem /usr/local/include"
@@ -67,6 +70,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
6770
&& cd .. \
6871
&& rm -r nettle-${nettleversion}
6972

73+
# Build static mbedTLS with pthread support
74+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
75+
&& cd mbedtls-${mbedtlsversion} \
76+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
77+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
78+
&& make -j $(nproc) install \
79+
&& cd .. \
80+
&& rm -r mbedtls-${mbedtlsversion}
81+
7082
FROM builder AS tester
7183

7284
# For FTL test compilation

ftl-build/armv8a/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARG idnversion=1.41
44
ARG readlineversion=8.1
55
ARG termcapversion=1.3.1
66
ARG nettleversion=3.8.1
7+
ARG mbedtlsversion=3.4.0
78

89
RUN dpkg --add-architecture armhf \
910
&& apt-get update \
@@ -30,6 +31,8 @@ RUN dpkg --add-architecture armhf \
3031
jq \
3132
git \
3233
dnsutils \
34+
perl \
35+
python3 \
3336
&& rm -rf /var/lib/apt/lists/*
3437

3538
ENV CC "arm-linux-gnueabihf-gcc -march=armv8-a -isystem /usr/local/include"
@@ -68,6 +71,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
6871
&& cd .. \
6972
&& rm -r nettle-${nettleversion}
7073

74+
# Build static mbedTLS with pthread support
75+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
76+
&& cd mbedtls-${mbedtlsversion} \
77+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
78+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
79+
&& make -j $(nproc) install \
80+
&& cd .. \
81+
&& rm -r mbedtls-${mbedtlsversion}
82+
7183
FROM builder AS tester
7284

7385
# For FTL test compilation

ftl-build/riscv64/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARG idnversion=1.41
44
ARG readlineversion=8.1
55
ARG termcapversion=1.3.1
66
ARG nettleversion=3.8.1
7+
ARG mbedtlsversion=3.4.0
78

89
RUN apt-get update \
910
&& apt-get install --no-install-recommends -y ca-certificates debian-ports-archive-keyring \
@@ -32,6 +33,8 @@ RUN apt-get update \
3233
jq \
3334
git \
3435
dnsutils \
36+
perl \
37+
python3 \
3538
&& rm -rf /var/lib/apt/lists/*
3639

3740
ENV CC riscv64-linux-gnu-gcc -isystem /usr/local/include
@@ -68,6 +71,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
6871
&& cd .. \
6972
&& rm -r nettle-${nettleversion}
7073

74+
# Build static mbedTLS with pthread support
75+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
76+
&& cd mbedtls-${mbedtlsversion} \
77+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
78+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
79+
&& make -j $(nproc) install \
80+
&& cd .. \
81+
&& rm -r mbedtls-${mbedtlsversion}
82+
7183
FROM builder AS tester
7284

7385
# For FTL test compilation

ftl-build/x86_32/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ARG idnversion=1.41
44
ARG readlineversion=8.1
55
ARG termcapversion=1.3.1
66
ARG nettleversion=3.8.1
7+
ARG mbedtlsversion=3.4.0
78

89
# We need a more recent dnsutils version for native HTTPS and SVCB support in dig
910
RUN dpkg --add-architecture i386 \
@@ -35,6 +36,8 @@ RUN dpkg --add-architecture i386 \
3536
python3 \
3637
python3-yaml \
3738
python3-requests \
39+
zip \
40+
perl \
3841
&& apt-get -t buster-backports install --no-install-recommends -y \
3942
dnsutils \
4043
&& rm -rf /var/lib/apt/lists/*
@@ -88,6 +91,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
8891
&& cd .. \
8992
&& rm -r nettle-${nettleversion}
9093

94+
# Build static mbedTLS with pthread support
95+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
96+
&& cd mbedtls-${mbedtlsversion} \
97+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
98+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
99+
&& make -j $(nproc) install \
100+
&& cd .. \
101+
&& rm -r mbedtls-${mbedtlsversion}
102+
91103
# Install bats-core directly into the build image
92104
RUN git clone https://github.com/bats-core/bats-core.git \
93105
&& cd bats-core

ftl-build/x86_64-musl/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ARG idnversion=1.41
55
ARG readlineversion=8.1
66
ARG termcapversion=1.3.1
77
ARG nettleversion=3.8.1
8+
ARG mbedtlsversion=3.4.0
89

910
RUN apk add --no-cache \
1011
alpine-sdk \
@@ -24,7 +25,9 @@ RUN apk add --no-cache \
2425
m4 \
2526
python3 \
2627
py3-yaml \
27-
py3-requests
28+
zip \
29+
py3-requests \
30+
perl
2831

2932
# Install pdns from community repo
3033
RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VER}/community" >> /etc/apk/repositories; \
@@ -70,6 +73,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/nettle-${nettleversion}.tar.gz |
7073
&& cd .. \
7174
&& rm -r nettle-${nettleversion}
7275

76+
# Build static mbedTLS with pthread support
77+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
78+
&& cd mbedtls-${mbedtlsversion} \
79+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
80+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
81+
&& make -j $(nproc) install \
82+
&& cd .. \
83+
&& rm -r mbedtls-${mbedtlsversion}
84+
7385
# Install bats-core directly into the build image
7486
RUN git clone https://github.com/bats-core/bats-core.git \
7587
&& cd bats-core

ftl-build/x86_64/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARG libnftnlversion=1.2.3
99
ARG nftablesversion=1.0.5
1010
ARG libnfnetlinkversion=1.0.2
1111
ARG libnetfilter_conntrackversion=1.0.9
12+
ARG mbedtlsversion=3.4.0
1213

1314
# We need a more recent dnsutils version for native HTTPS and SVCB support in dig
1415
RUN echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" >> /etc/apt/sources.list \
@@ -42,6 +43,8 @@ RUN echo "deb http://deb.debian.org/debian buster-backports main contrib non-fre
4243
python3 \
4344
python3-yaml \
4445
python3-requests \
46+
zip \
47+
perl \
4548
&& apt-get -t buster-backports install --no-install-recommends -y \
4649
dnsutils \
4750
&& rm -rf /var/lib/apt/lists/*
@@ -130,6 +133,15 @@ RUN curl -sSL https://ftl.pi-hole.net/libraries/libnetfilter_conntrack-${libnetf
130133
&& cd .. \
131134
&& rm -r libnetfilter_conntrack-${libnetfilter_conntrackversion}
132135

136+
# Build static mbedTLS with pthread support
137+
RUN curl -sSL https://ftl.pi-hole.net/libraries/mbedtls-${mbedtlsversion}.tar.gz | tar -xz \
138+
&& cd mbedtls-${mbedtlsversion} \
139+
&& sed -i '/#define MBEDTLS_THREADING_C/s*^//**g' include/mbedtls/mbedtls_config.h \
140+
&& sed -i '/#define MBEDTLS_THREADING_PTHREAD/s*^//**g' include/mbedtls/mbedtls_config.h \
141+
&& make -j $(nproc) install \
142+
&& cd .. \
143+
&& rm -r mbedtls-${mbedtlsversion}
144+
133145
# Install bats-core directly into the build image
134146
RUN git clone https://github.com/bats-core/bats-core.git \
135147
&& cd bats-core

0 commit comments

Comments
 (0)