Skip to content

Commit b0e3b6b

Browse files
committed
Replace Debian with Ubuntu 24.04 LTS
1 parent 14ce181 commit b0e3b6b

File tree

6 files changed

+115
-23
lines changed

6 files changed

+115
-23
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ Notable features:
2727

2828
The underlying spirit of this project is to allow "repeatable deployments", and all pull requests in this direction will be merged post-haste.
2929

30+
## Warning
31+
32+
As part of our recent efforts to reduce the number of CVEs affecting the Docker images, we recently changed the base image from Debian Bookworm to Ubuntu 24.04.
33+
34+
While the transition did not affect MISP and MISP modules, the GitHub Action triggered a bug affecting `libcurl` and Ubuntu 24.04 when running on `linux/arm64` and establishing TLS connections to `api.github.com` when the server decides toreturn a 302. The issue is being discussed here https://github.com/curl/curl/issues/14154 and being further investigated here https://bugs.launchpad.net/ubuntu/+source/curl/+bug/2073448.
35+
36+
To allow the build to complete, we temporarily disabled TLS verification (see `core/Dockerfile` when using `composer` to install PHP dependencies; the temporary workaround affects only the build when the target platform is `linux/arm64`, leaving the `linux/amd64` build unaffected.
37+
3038
## Getting Started
3139

3240
- Copy the `template.env` to `.env`

core/Dockerfile

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
ARG DOCKER_HUB_PROXY=""
22

33

4-
FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS php-base
4+
FROM "${DOCKER_HUB_PROXY}ubuntu:24.04" AS php-base
55
ENV DEBIAN_FRONTEND noninteractive
66

77
# Uncomment when building in corporate environments
88
# COPY ./rootca.crt /usr/local/share/ca-certificates/rootca.pem
99
# COPY ./rootca.crt /usr/lib/ssl/cert.pem
1010

1111
RUN apt-get update; apt-get install -y --no-install-recommends \
12-
lsb-release \
13-
ca-certificates \
14-
curl
15-
RUN curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
16-
RUN dpkg -i /tmp/debsuryorg-archive-keyring.deb
17-
RUN echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
12+
ca-certificates
13+
14+
COPY files/etc/apt/sources.list.d/ondrej-ubuntu-php-noble.sources /etc/apt/sources.list.d/ondrej-ubuntu-php-noble.sources
15+
COPY files/etc/apt/sources.list.d/ondrej-ubuntu-nginx-mainline-noble.sources /etc/apt/sources.list.d/ondrej-ubuntu-nginx-mainline-noble.sources
16+
17+
# RUN apt-get update; apt-get install -y --no-install-recommends \
18+
# software-properties-common
19+
# # && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
20+
# RUN add-apt-repository ppa:ondrej/php
21+
# RUN add-apt-repository ppa:ondrej/nginx-mainline
1822
RUN apt-get update
1923

2024

@@ -23,6 +27,7 @@ FROM php-base AS composer-build
2327
ENV COMPOSER_ALLOW_SUPERUSER 1
2428
ARG CORE_TAG
2529
ARG CORE_COMMIT
30+
ARG TARGETPLATFORM
2631

2732
RUN apt-get install -y --no-install-recommends \
2833
php7.4 \
@@ -42,10 +47,28 @@ FROM php-base AS composer-build
4247

4348
WORKDIR /tmp
4449
ADD https://raw.githubusercontent.com/MISP/MISP/${CORE_COMMIT:-${CORE_TAG}}/app/composer.json /tmp
45-
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
46-
RUN composer config --no-interaction allow-plugins.composer/installers true
47-
RUN composer install
48-
RUN composer require --with-all-dependencies --no-interaction \
50+
COPY --from=composer:2.7.7 /usr/bin/composer /usr/bin/composer
51+
52+
# See:
53+
# - https://github.com/curl/curl/issues/14154
54+
# - https://bugs.launchpad.net/ubuntu/+source/curl/+bug/2073448
55+
RUN <<-EOF
56+
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then
57+
cp /usr/bin/composer /composer.phar
58+
mkdir /out/
59+
php -r '$phar = new Phar("/composer.phar"); $phar->extractTo("/out/");'
60+
sed -i "/'verify_peer_name' =>.*/a 'verify_peer_status' => CURLOPT_SSL_VERIFYSTATUS," /out/src/Composer/Util/Http/CurlDownloader.php
61+
sed -i "/\$options = StreamContextFactory.*/a \$options['ssl']['verify_peer'] = false;" /out/src/Composer/Util/Http/CurlDownloader.php
62+
sed -i "/\$options = StreamContextFactory.*/a \$options['ssl']['verify_peer_name'] = false;" /out/src/Composer/Util/Http/CurlDownloader.php
63+
sed -i "/\$options = StreamContextFactory.*/a \$options['ssl']['verify_peer_status'] = false;" /out/src/Composer/Util/Http/CurlDownloader.php
64+
rm /usr/bin/composer
65+
ln -s /out/bin/composer /usr/bin/composer
66+
fi
67+
EOF
68+
69+
RUN php /usr/bin/composer config --no-interaction allow-plugins.composer/installers true
70+
RUN php /usr/bin/composer install
71+
RUN php /usr/bin/composer require --with-all-dependencies --no-interaction \
4972
supervisorphp/supervisor:^4.0 \
5073
guzzlehttp/guzzle:^7.4.5 \
5174
lstrojny/fxmlrpc \
@@ -106,6 +129,8 @@ FROM php-base AS python-build
106129

107130
RUN apt-get install -y --no-install-recommends \
108131
git \
132+
python3-pip \
133+
python3-wheel \
109134
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
110135

111136
# Download MISP using git in the /var/www/ directory. Remove unnecessary items.
@@ -185,6 +210,8 @@ FROM php-base
185210
gpg-agent \
186211
mariadb-client \
187212
rsync \
213+
python3-pip \
214+
python3-wheel \
188215
# PHP Requirements
189216
php7.4 \
190217
php7.4-apcu \
@@ -203,7 +230,7 @@ FROM php-base
203230
libldap-common \
204231
librdkafka1 \
205232
libbrotli1 \
206-
libsimdjson14 \
233+
libsimdjson19 \
207234
libzstd1 \
208235
ssdeep \
209236
libfuzzy2 \
@@ -217,8 +244,7 @@ FROM php-base
217244

218245
# Install python modules
219246
COPY --from=python-build /wheels /wheels
220-
RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels
221-
RUN pip uninstall -y pip
247+
RUN pip install --break-system-packages --no-cache-dir /wheels/*.whl && rm -rf /wheels
222248

223249
# PHP: install prebuilt libraries, then install the app's PHP deps
224250
COPY --from=php-build ["/usr/lib/php/${PHP_VER}/ssdeep.so", "/usr/lib/php/${PHP_VER}/rdkafka.so", "/usr/lib/php/${PHP_VER}/brotli.so", "/usr/lib/php/${PHP_VER}/simdjson.so", "/usr/lib/php/${PHP_VER}/zstd.so", "/usr/lib/php/${PHP_VER}/"]
@@ -229,6 +255,12 @@ FROM php-base
229255
COPY --from=composer-build --chown=www-data:www-data --chmod=0550 /tmp/Vendor /var/www/MISP/app/Vendor
230256
COPY --from=composer-build --chown=www-data:www-data --chmod=0550 /tmp/Plugin /var/www/MISP/app/Plugin
231257

258+
# python3-setuptools (distutils.version) is needed by 'mixbox'
259+
RUN cp /usr/lib/python3/dist-packages/setuptools/_distutils/version.py \
260+
/usr/local/lib/python3.12/dist-packages/mixbox/distutils_version.py
261+
RUN sed -i 's/from distutils\.version/from mixbox.distutils_version/' /usr/local/lib/python3.12/dist-packages/mixbox/parser.py
262+
RUN apt-get remove --purge python3-pip python3-wheel python3-setuptools -y
263+
232264
# Gather these in one layer, only act on actual directories under /etc/php/
233265
RUN <<-EOF
234266
set -- "ssdeep" "rdkafka" "brotli" "simdjson" "zstd"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Types: deb
2+
URIs: https://ppa.launchpadcontent.net/ondrej/nginx-mainline/ubuntu/
3+
Suites: noble
4+
Components: main
5+
Signed-By:
6+
-----BEGIN PGP PUBLIC KEY BLOCK-----
7+
.
8+
mI0ESX35nAEEALKDCUDVXvmW9n+T/+3G1DnTpoWh9/1xNaz/RrUH6fQKhHr568F8
9+
hfnZP/2CGYVYkW9hxP9LVW9IDvzcmnhgIwK+ddeaPZqh3T/FM4OTA7Q78HSvR81m
10+
Jpf2iMLm/Zvh89ZsmP2sIgZuARiaHo8lxoTSLtmKXsM3FsJVlusyewHfABEBAAG0
11+
H0xhdW5jaHBhZCBQUEEgZm9yIE9uZMWZZWogU3Vyw72ItgQTAQIAIAUCSX35nAIb
12+
AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEE9OoKrlJnpsQjYD/jW1NlIFAlT6
13+
EvF2xfVbkhERii9MapjaUsSso4XLCEmZdEGX54GQ01svXnrivwnd/kmhKvyxCqiN
14+
LDY/dOaK8MK//bDI6mqdKmG8XbP2vsdsxhifNC+GH/OwaDPvn1TyYB653kwyruCG
15+
FjEnCreZTcRUu2oBQyolORDl+BmF4DjLiQEzBBABCgAdFiEECvaBvTqO/UqmWMI/
16+
thEcm0xImQEFAmXTV0AACgkQthEcm0xImQGTTggAhuMHGeBZlRUAsZE7jJM7Mf06
17+
/WIhcgUfBfSFnJFlFH+xdEe/GFYyVk9kingDsPh90Ecnt4n8DJHTlsuUV1+SPBIO
18+
JfbQTUjx1n/+Ck+TVKzRByvrpRXtiZQ214m3zbhZpme2eBBMItZByjG7g925NUIq
19+
rL+R5ZoEcZvVlYscfsA0Sr8yJTsGJPefuLYI6eJkNDa1QkzBkSSW4XaCfNIxNBRs
20+
zN/qGe3xy0bibOaC4T2TcbZPSAVP855ahNbLAdqkyfAutiEWcKZmQpR9qNh4482k
21+
0pXVlQJ8UB860gVFHjwjFm/MsCeX8yfeAi38ZyInWL2OSG2pDx5ZzNESwnCPIg==
22+
=N1rh
23+
-----END PGP PUBLIC KEY BLOCK-----
24+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Types: deb
2+
URIs: https://ppa.launchpadcontent.net/ondrej/php/ubuntu/
3+
Suites: noble
4+
Components: main
5+
Signed-By: -----BEGIN PGP PUBLIC KEY BLOCK-----
6+
.
7+
mI0ESX35nAEEALKDCUDVXvmW9n+T/+3G1DnTpoWh9/1xNaz/RrUH6fQKhHr568F8
8+
hfnZP/2CGYVYkW9hxP9LVW9IDvzcmnhgIwK+ddeaPZqh3T/FM4OTA7Q78HSvR81m
9+
Jpf2iMLm/Zvh89ZsmP2sIgZuARiaHo8lxoTSLtmKXsM3FsJVlusyewHfABEBAAG0
10+
H0xhdW5jaHBhZCBQUEEgZm9yIE9uZMWZZWogU3Vyw72ItgQTAQIAIAUCSX35nAIb
11+
AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEE9OoKrlJnpsQjYD/jW1NlIFAlT6
12+
EvF2xfVbkhERii9MapjaUsSso4XLCEmZdEGX54GQ01svXnrivwnd/kmhKvyxCqiN
13+
LDY/dOaK8MK//bDI6mqdKmG8XbP2vsdsxhifNC+GH/OwaDPvn1TyYB653kwyruCG
14+
FjEnCreZTcRUu2oBQyolORDl+BmF4DjLiQEzBBABCgAdFiEECvaBvTqO/UqmWMI/
15+
thEcm0xImQEFAmXTV0AACgkQthEcm0xImQGTTggAhuMHGeBZlRUAsZE7jJM7Mf06
16+
/WIhcgUfBfSFnJFlFH+xdEe/GFYyVk9kingDsPh90Ecnt4n8DJHTlsuUV1+SPBIO
17+
JfbQTUjx1n/+Ck+TVKzRByvrpRXtiZQ214m3zbhZpme2eBBMItZByjG7g925NUIq
18+
rL+R5ZoEcZvVlYscfsA0Sr8yJTsGJPefuLYI6eJkNDa1QkzBkSSW4XaCfNIxNBRs
19+
zN/qGe3xy0bibOaC4T2TcbZPSAVP855ahNbLAdqkyfAutiEWcKZmQpR9qNh4482k
20+
0pXVlQJ8UB860gVFHjwjFm/MsCeX8yfeAi38ZyInWL2OSG2pDx5ZzNESwnCPIg==
21+
=N1rh
22+
-----END PGP PUBLIC KEY BLOCK-----
23+

core/files/etc/nginx/sites-available/misp443

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
server {
2-
listen 443 ssl http2;
3-
listen [::]:443 ssl http2;
2+
listen 443 ssl;
3+
listen [::]:443 ssl;
4+
http2 on;
45

56
# disable access logs
67
access_log off;

modules/Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG DOCKER_HUB_PROXY=""
22

3-
FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
3+
FROM "${DOCKER_HUB_PROXY}ubuntu:24.04" AS python-build
44
ENV DEBIAN_FRONTEND noninteractive
55
ARG MODULES_TAG
66
ARG MODULES_COMMIT
@@ -9,6 +9,9 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
99
RUN apt-get update && apt-get install -y --no-install-recommends \
1010
cmake \
1111
git \
12+
python3-dev \
13+
python3-pip \
14+
python3-wheel \
1215
build-essential \
1316
libpoppler-cpp-dev \
1417
libfuzzy-dev \
@@ -30,8 +33,8 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
3033
EOF
3134

3235
WORKDIR /srv/misp-modules
33-
RUN pip install poetry
34-
RUN sed -i "s/^python = .*/python = \"$(python -c 'import platform; print(platform.python_version())')\"/" pyproject.toml
36+
RUN pip install --break-system-packages poetry
37+
RUN sed -i "s/^python = .*/python = \"$(python3 -c 'import platform; print(platform.python_version())')\"/" pyproject.toml
3538
RUN poetry lock
3639
RUN poetry self add poetry-plugin-export
3740
RUN poetry export --with unstable --without-hashes -f requirements.txt -o requirements.txt
@@ -60,7 +63,7 @@ EOF
6063
RUN rm -rf /srv/faup
6164

6265

63-
FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
66+
FROM "${DOCKER_HUB_PROXY}ubuntu:24.04"
6467
ENV DEBIAN_FRONTEND noninteractive
6568

6669
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -73,18 +76,19 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
7376
libxml2 \
7477
libxslt1.1 \
7578
libzbar0 \
79+
python3-pip \
7680
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
7781

7882
COPY --from=python-build /wheels /wheels
7983
COPY --from=python-build /usr/local/lib/libfaupl* /usr/local/lib/
8084
RUN ldconfig
81-
RUN pip install --no-cache-dir --use-deprecated=legacy-resolver /wheels/*.whl && rm -rf /wheels
82-
RUN pip uninstall -y pip
85+
RUN pip install --break-system-packages --no-cache-dir --use-deprecated=legacy-resolver /wheels/*.whl && rm -rf /wheels
86+
RUN apt-get remove --purge python3-pip python3-setuptools -y
8387

8488
# Since we compile faup ourselves and lua is not required anymore, we can load our own library
8589
# and skip the pre-compiled blob to improve compatibility with other architectures like ARM
8690
RUN sed -i s/LoadLibrary\(LOAD_LIB\)/LoadLibrary\(\"\\/usr\\/local\\/lib\\/libfaupl.so\"\)/ \
87-
/usr/local/lib/python3.12/site-packages/pyfaup/__init__.py
91+
/usr/local/lib/python3.12/dist-packages/pyfaup/__init__.py
8892

8993
# Disable (all) warnings raised when using 'future'
9094
RUN sed -i '/import sys/a import warnings\nwarnings.warn = lambda *args, **kwargs: None' \

0 commit comments

Comments
 (0)