Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The image is modified to include an older version of PostgreSQL, which
# allows us to upgrade the database from the old version to the new one.
ARG POSTGRES_VERSION=17
FROM postgres:${POSTGRES_VERSION}
FROM postgres:${POSTGRES_VERSION} AS base

Check warning

Code scanning / Docker Scout

CVE-2025-45582 Medium

Vulnerability : CVE-2025-45582
Severity : MEDIUM
Package : pkg:deb/debian/tar@1.34%2Bdfsg-1.2%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=1.34+dfsg-1.2+deb12u1
Fixed version : not fixed
EPSS Score : 0.000320
EPSS Percentile : 0.072210

Check warning

Code scanning / Docker Scout

CVE-2025-32989 Medium

Vulnerability : CVE-2025-32989
Severity : MEDIUM
Package : pkg:deb/debian/gnutls28@3.7.9-2%2Bdeb12u4?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=3.7.9-2+deb12u4
Fixed version : not fixed
EPSS Score : 0.000160
EPSS Percentile : 0.022390

Check warning

Code scanning / Docker Scout

CVE-2025-32988 Medium

Vulnerability : CVE-2025-32988
Severity : MEDIUM
Package : pkg:deb/debian/gnutls28@3.7.9-2%2Bdeb12u4?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=3.7.9-2+deb12u4
Fixed version : not fixed
EPSS Score : 0.000400
EPSS Percentile : 0.112020

Check warning

Code scanning / Docker Scout

CVE-2025-32990 Medium

Vulnerability : CVE-2025-32990
Severity : MEDIUM
Package : pkg:deb/debian/gnutls28@3.7.9-2%2Bdeb12u4?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=3.7.9-2+deb12u4
Fixed version : not fixed
EPSS Score : 0.000450
EPSS Percentile : 0.132930

Check warning

Code scanning / Docker Scout

CVE-2025-6395 Medium

Vulnerability : CVE-2025-6395
Severity : MEDIUM
Package : pkg:deb/debian/gnutls28@3.7.9-2%2Bdeb12u4?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=3.7.9-2+deb12u4
Fixed version : not fixed
EPSS Score : 0.000400
EPSS Percentile : 0.112400

Check failure

Code scanning / Docker Scout

CVE-2025-6020 High

Vulnerability : CVE-2025-6020
Severity : HIGH
Package : pkg:deb/debian/pam@1.5.2-6%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=1.5.2-6+deb12u1
Fixed version : not fixed
EPSS Score : 0.000230
EPSS Percentile : 0.044630

Check failure

Code scanning / Docker Scout

CVE-2025-7424 High

Vulnerability : CVE-2025-7424
Severity : HIGH
Package : pkg:deb/debian/libxslt@1.1.35-1%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=1.1.35-1+deb12u1
Fixed version : not fixed
EPSS Score : 0.000150
EPSS Percentile : 0.019550

Check failure

Code scanning / Docker Scout

CVE-2025-7425 High

Vulnerability : CVE-2025-7425
Severity : HIGH
Package : pkg:deb/debian/libxslt@1.1.35-1%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12
Affected range : >=1.1.35-1+deb12u1
Fixed version : not fixed
EPSS Score : 0.000120
EPSS Percentile : 0.011360

# we need to redeclare the ARG here, otherwise it will not
# be available in the section below the FROM statement.
Expand All @@ -13,27 +13,42 @@
ENV POSTGRES_VERSION=${POSTGRES_VERSION}
ENV POSTGRES_OLD_VERSION=${POSTGRES_OLD_VERSION}

# The old binaries will be in /usr/lib/postgresql/16/bin
ENV PGBINOLD=/usr/lib/postgresql/${POSTGRES_OLD_VERSION}/bin
ENV PGBINNEW=/usr/lib/postgresql/${POSTGRES_VERSION}/bin

# we are usually using /var/lib/postgresql/data as the data directory
# so this is why we are using it for the 'old' version instead of the
# path that is customized for the version.
ENV PGDATAOLD=/var/lib/postgresql/data
ENV PGDATANEW=/var/lib/postgresql/${POSTGRES_VERSION}/data

COPY bin/upgradeversion.sh /usr/local/bin/upgradeversion

FROM base AS install
# Enable and install old version of PostgreSQL.
RUN sed -i "s/\$/ ${POSTGRES_OLD_VERSION}/" /etc/apt/sources.list.d/pgdg.list
RUN sed -i "s/\$/ ${POSTGRES_OLD_VERSION}/" /etc/apt/sources.list.d/pgdg.list;
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
postgresql-${POSTGRES_OLD_VERSION} \
; \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*;

# The old binaries will be in /usr/lib/postgresql/16/bin
ENV PGBINOLD /usr/lib/postgresql/${POSTGRES_OLD_VERSION}/bin
ENV PGBINNEW /usr/lib/postgresql/${POSTGRES_VERSION}/bin

# we are usually using /var/lib/postgresql/data as the data directory
# so this is why we are using it for the 'old' version instead of the
# path that is customized for the version.
ENV PGDATAOLD /var/lib/postgresql/data
ENV PGDATANEW /var/lib/postgresql/${POSTGRES_VERSION}/data
FROM install AS no-gosu
RUN set -eux; \
rm -rf /usr/local/bin/gosu;

COPY bin/upgradeversion.sh /usr/local/bin/upgradeversion
FROM postgres:${POSTGRES_VERSION} AS su-exec
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends gcc libc-dev curl ca-certificates; \
rm -rf /var/lib/apt/lists/*; \
curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c; \
gcc -Wall /usr/local/bin/su-exec.c -o /usr/local/bin/su-exec;

FROM no-gosu AS runtime
COPY --from=su-exec --chown=root:root --chmod=755 /usr/local/bin/su-exec /usr/local/bin/gosu
# We decided to use our own UID range.
# INFO: https://github.com/greenbone/automatix/blob/main/README.md
# Change to user root user to run the commands.
Expand Down
Loading