Skip to content

Commit f99b5dd

Browse files
committed
Replace Debian with Ubuntu 24.04 LTS
1 parent 130a6ba commit f99b5dd

File tree

6 files changed

+115
-32
lines changed

6 files changed

+115
-32
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,28 @@ 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`
3341
- Customize `.env` based on your needs (optional step)
3442

3543
### Run
3644

37-
- `docker-compose pull` if you want to use pre-built images or `docker-compose build` if you want to build your own (see the `Troubleshooting` section in case of errors)
38-
- `docker-compose up`
45+
- `docker compose pull` if you want to use pre-built images or `docker compose build` if you want to build your own (see the `Troubleshooting` section in case of errors)
46+
- `docker compose up`
3947
- Login to `https://localhost`
4048
4149
- Password: `admin`
4250

43-
Keeping the image up-to-date with upstream should be as simple as running `docker-compose pull`.
51+
Keeping the image up-to-date with upstream should be as simple as running `docker compose pull`.
4452

4553
### Configuration
4654

@@ -64,21 +72,21 @@ New options are added on a regular basis.
6472

6573
#### Environment variable behaviour
6674

67-
Set environment variables in .env to configure settings instead of in docker-compose.yml where possible. Setting the variables in .env will allow you to pull updates from Github without issues caused by a modified docker-compose.yml file, should there be an update for it.
75+
Set environment variables in .env to configure settings instead of in `docker-compose.yml` where possible. Setting the variables in `.env` will allow you to pull updates from Github without issues caused by a modified `docker-compose.yml` file, should there be an update for it.
6876

6977
Environment variable driven settings are enforced every time the misp-core container starts. This means that if you change the config.php file or database for a setting that has a set environment variable, it will be changed to the environment variable value upon next container start. Empty environment variables may have a safe default which is enforced instead.
7078

71-
If you push a change to add or remove an environment variable, please look in "core/files/etc/misp-docker/" for json files with "envars" in the name and adjust there.
79+
If you push a change to add or remove an environment variable, please look in `core/files/etc/misp-docker/` for json files with "envars" in the name and adjust there.
7280

7381
#### Unset safe default settings behaviour
7482

75-
The misp-core container has definitions for minimum safe default settings which are set if needed each time the container starts. They will only be set if there is no existing entry in the config.php file or database for these settings. If you specify a custom value for any of these settings it will be respected. See the definitions of these in "core/files/etc/misp-docker" where the filenames contain the word "defaults".
83+
The misp-core container has definitions for minimum safe default settings which are set if needed each time the container starts. They will only be set if there is no existing entry in the `config.php` file or database for these settings. If you specify a custom value for any of these settings it will be respected. See the definitions of these in `core/files/etc/misp-docker` where the filenames contain the word "defaults".
7684

7785
#### Storing system settings in the DB
7886

79-
This container includes the "ENABLE_DB_SETTINGS" environment variable, which can be used to set "MISP.system_setting_db" to true or false. This changes the behaviour of where MISP chooses to store operator made settings changes; in config.php or in the system_settings database table. By default this is set to false.
87+
This container includes the `ENABLE_DB_SETTINGS` environment variable, which can be used to set `MISP.system_setting_db` to true or false. This changes the behaviour of where MISP chooses to store operator made settings changes; in `config.php` or in the system_settings database table. By default this is set to false.
8088

81-
If a setting is not defined in the DB, but is defined in config.php, it will be read out of config.php and used. This can sometimes lead to operator confusion, so please check both locations for values when troubleshooting.
89+
If a setting is not defined in the DB, but is defined in `config.php`, it will be read out of `config.php` and used. This can sometimes lead to operator confusion, so please check both locations for values when troubleshooting.
8290

8391
If you change this setting from false to true, settings are not migrated from config.php to the database, but rather the above behaviour is relied upon.
8492

@@ -88,7 +96,7 @@ While storing system settings in the DB works as expected most of the time, you
8896

8997
If you are trying to accomplish something and the above behaviours get in the way, please let us know as this is not intended.
9098

91-
To override these behaviours edit the docker-compose.yml file's misp-core volume definitions to enable the "customize_misp.sh" behaviour (see the bottom of the Production section for details). The "customize_misp.sh" script triggers after the above behaviours complete and is an appropriate place to override a setting. It is suggested that you use the "/var/www/MISP/app/cake Admin setSetting" command to override a setting, as this tool is config.php file and database setting aware.
99+
To override these behaviours edit the `docker-compose.yml` file's misp-core volume definitions to enable the `customize_misp.sh` behaviour (see the bottom of the Production section for details). The `customize_misp.sh` script triggers after the above behaviours complete and is an appropriate place to override a setting. It is suggested that you use the `/var/www/MISP/app/cake Admin setSetting` command to override a setting, as this tool is `config.php` file and database setting aware.
92100

93101
#### Adding a new setting and unsure what files to edit?
94102

@@ -133,7 +141,6 @@ Custom root CA certificates can be mounted under `/usr/local/share/ca-certificat
133141
## Troubleshooting
134142
135143
- Make sure you run a fairly recent version of Docker and Docker Compose (if in doubt, update following the steps outlined in https://docs.docker.com/engine/install/ubuntu/)
136-
- Some Linux distributions provide a recent version of Docker but a legacy version of Docker Compose, so you can try running `docker compose` instead of `docker-compose`
137144
- Make sure you are not running an old image or container; when in doubt run `docker system prune --volumes` and clone this repository into an empty directory
138145

139146
## Versioning

core/Dockerfile

Lines changed: 37 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,26 @@ 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: https://github.com/curl/curl/issues/14154
53+
RUN <<-EOF
54+
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then
55+
cp /usr/bin/composer /composer.phar
56+
mkdir /out/
57+
php -r '$phar = new Phar("/composer.phar"); $phar->extractTo("/out/");'
58+
sed -i "/'verify_peer_name' =>.*/a 'verify_peer_status' => CURLOPT_SSL_VERIFYSTATUS," /out/src/Composer/Util/Http/CurlDownloader.php
59+
sed -i "/\$options = StreamContextFactory.*/a \$options['ssl']['verify_peer'] = false;" /out/src/Composer/Util/Http/CurlDownloader.php
60+
sed -i "/\$options = StreamContextFactory.*/a \$options['ssl']['verify_peer_name'] = false;" /out/src/Composer/Util/Http/CurlDownloader.php
61+
sed -i "/\$options = StreamContextFactory.*/a \$options['ssl']['verify_peer_status'] = false;" /out/src/Composer/Util/Http/CurlDownloader.php
62+
rm /usr/bin/composer
63+
ln -s /out/bin/composer /usr/bin/composer
64+
fi
65+
EOF
66+
67+
RUN php /usr/bin/composer config --no-interaction allow-plugins.composer/installers true
68+
RUN php /usr/bin/composer install
69+
RUN php /usr/bin/composer require --with-all-dependencies --no-interaction \
4970
supervisorphp/supervisor:^4.0 \
5071
guzzlehttp/guzzle:^7.4.5 \
5172
lstrojny/fxmlrpc \
@@ -105,6 +126,7 @@ FROM php-base AS python-build
105126

106127
RUN apt-get install -y --no-install-recommends \
107128
git \
129+
python3-pip \
108130
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
109131

110132
# Download MISP using git in the /var/www/ directory. Remove unnecessary items.
@@ -177,6 +199,7 @@ FROM php-base
177199
gpg-agent \
178200
mariadb-client \
179201
rsync \
202+
python3-pip \
180203
# PHP Requirements
181204
php7.4 \
182205
php7.4-apcu \
@@ -195,7 +218,7 @@ FROM php-base
195218
libldap-common \
196219
librdkafka1 \
197220
libbrotli1 \
198-
libsimdjson14 \
221+
libsimdjson19 \
199222
libzstd1 \
200223
ssdeep \
201224
libfuzzy2 \
@@ -209,8 +232,8 @@ FROM php-base
209232

210233
# Install python modules
211234
COPY --from=python-build /wheels /wheels
212-
RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels
213-
RUN pip uninstall -y pip
235+
RUN pip install --break-system-packages --no-cache-dir /wheels/*.whl && rm -rf /wheels
236+
RUN apt-get remove --purge python3-pip python3-setuptools -y
214237

215238
# PHP: install prebuilt libraries, then install the app's PHP deps
216239
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}/"]
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
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
5+
56
ARG MODULES_TAG
67
ARG MODULES_COMMIT
78
ARG LIBFAUP_COMMIT
89

910
RUN apt-get update && apt-get install -y --no-install-recommends \
1011
cmake \
1112
git \
13+
python3-dev \
14+
python3-pip \
15+
python3-wheel \
16+
pipenv \
1217
build-essential \
1318
libpoppler-cpp-dev \
1419
libfuzzy-dev \
@@ -30,7 +35,6 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
3035
EOF
3136

3237
WORKDIR /srv/misp-modules
33-
RUN pip install pipenv
3438
RUN pipenv requirements > requirements.txt
3539
RUN pip wheel -r requirements.txt --no-cache-dir -w /wheels/
3640

@@ -56,7 +60,7 @@ EOF
5660
RUN rm -rf /srv/faup
5761

5862

59-
FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
63+
FROM "${DOCKER_HUB_PROXY}ubuntu:24.04"
6064
ENV DEBIAN_FRONTEND noninteractive
6165

6266
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -69,18 +73,19 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
6973
libxml2 \
7074
libxslt1.1 \
7175
libzbar0 \
76+
python3-pip \
7277
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
7378

7479
COPY --from=python-build /wheels /wheels
7580
COPY --from=python-build /usr/local/lib/libfaupl* /usr/local/lib/
7681
RUN ldconfig
77-
RUN pip install --no-cache-dir --use-deprecated=legacy-resolver /wheels/*.whl && rm -rf /wheels
78-
RUN pip uninstall -y pip
82+
RUN pip install --break-system-packages --no-cache-dir --use-deprecated=legacy-resolver /wheels/*.whl && rm -rf /wheels
83+
RUN apt-get remove --purge python3-pip python3-setuptools -y
7984

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

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

0 commit comments

Comments
 (0)