Skip to content

Commit d40bf9e

Browse files
authored
Various update: log4shell removal, testing-tools uid/gid (#1192)
* Various update: log4shell removal, testing-tools uid/gid * address review feedback
1 parent e93d8f3 commit d40bf9e

File tree

9 files changed

+81
-215
lines changed

9 files changed

+81
-215
lines changed

druid/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ COPY --chown=${STACKABLE_USER_UID}:0 druid/stackable/patches/${PRODUCT} /stackab
4141

4242
COPY --from=hadoop-builder --chown=${STACKABLE_USER_UID}:0 /stackable/patched-libs /stackable/patched-libs
4343
# Cache mounts are owned by root by default
44-
# We need to explicitly give the uid to use which is hardcoded to "1000" in stackable-base
44+
# We need to explicitly give the uid to use.
4545
# The cache id has to include the product version that we are building because otherwise
4646
# docker encounters race conditions when building multiple versions in parallel, as all
4747
# builder containers will share the same cache and the `rm -rf` commands will fail

java-devel/Dockerfile

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,40 @@ gpgcheck=1
2323
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
2424
EOF
2525

26-
RUN microdnf update && \
27-
microdnf install -y \
28-
cmake \
29-
cyrus-sasl-devel \
30-
# diff is required by maven during the build of hbase \
31-
# Cannot run program "diff" (in directory "/stackable/hbase-2.4.12-src/hbase-shaded/hbase-shaded-check-invariants"
32-
diffutils \
33-
fuse-devel \
34-
gcc \
35-
gcc-c++ \
36-
# The GNU gettext utilities contain the envsubst program which
37-
# substitutes the values of environment variables.
38-
gettext \
39-
# For the apply_patches.sh script
40-
git \
41-
# Needed by the maven ant run plugin for the "set-hostname-property" step in zookeeper
42-
hostname \
43-
# Needed for compiling Java projects
44-
"temurin-${PRODUCT}-jdk" \
45-
krb5-devel \
46-
libcurl-devel \
47-
make \
48-
maven \
49-
openssl-devel \
50-
# Required to unpack Omid tarball
51-
tar \
52-
wget \
53-
which \
54-
xz \
55-
zlib-devel \
56-
# Required for log4shell.sh
57-
unzip zip && \
58-
microdnf clean all && \
59-
rm -rf /var/cache/yum
26+
RUN <<EOF
27+
microdnf update
28+
microdnf install \
29+
cmake \
30+
cyrus-sasl-devel \
31+
`# diff is required by maven during the build of hbase` \
32+
`# Cannot run program "diff" (in directory "/stackable/hbase-2.4.12-src/hbase-shaded/hbase-shaded-check-invariants"` \
33+
diffutils \
34+
fuse-devel \
35+
gcc \
36+
gcc-c++ \
37+
`# The GNU gettext utilities contain the envsubst program which` \
38+
`# substitutes the values of environment variables.` \
39+
gettext \
40+
`# For the apply_patches.sh script`\
41+
git \
42+
`# Needed by the maven ant run plugin for the "set-hostname-property" step in zookeeper` \
43+
hostname \
44+
`# Needed for compiling Java projects` \
45+
"temurin-${PRODUCT}-jdk" \
46+
krb5-devel \
47+
libcurl-devel \
48+
make \
49+
maven \
50+
openssl-devel \
51+
`# Required to unpack Omid tarball` \
52+
tar \
53+
wget \
54+
which \
55+
xz \
56+
zlib-devel
57+
microdnf clean all
58+
rm -rf /var/cache/yum
59+
EOF
6060

6161
ENV JAVA_HOME="/usr/lib/jvm/temurin-${PRODUCT}-jdk"
6262

omid/Dockerfile

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,6 @@ if [ "${DELETE_CACHES}" = "true" ] ; then
4949
fi
5050
EOF
5151

52-
# ===
53-
# For earlier versions this script removes the .class file that contains the
54-
# vulnerable code.
55-
# TODO: This can be restricted to target only versions which do not honor the environment
56-
# varible that has been set above but this has not currently been implemented
57-
COPY shared/log4shell.sh /bin
58-
RUN /bin/log4shell.sh /stackable/omid-tso-server-${PRODUCT}-stackable${RELEASE}
59-
60-
# Ensure no vulnerable files are left over
61-
# This will currently report vulnerable files being present, as it also alerts on
62-
# SocketNode.class, which we do not remove with our scripts.
63-
# Further investigation will be needed whether this should also be removed.
64-
COPY shared/log4shell_1.6.1-log4shell_Linux_x86_64 /bin/log4shell_scanner_x86_64
65-
COPY shared/log4shell_1.6.1-log4shell_Linux_aarch64 /bin/log4shell_scanner_aarch64
66-
COPY shared/log4shell_scanner /bin/log4shell_scanner
67-
RUN /bin/log4shell_scanner s /stackable/omid-tso-server-${PRODUCT}-stackable${RELEASE}
68-
# ===
69-
7052
FROM stackable/image/java-base
7153

7254
ARG PRODUCT

shared/log4j.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

shared/log4shell.sh

Lines changed: 0 additions & 119 deletions
This file was deleted.
-10.2 MB
Binary file not shown.
-10.3 MB
Binary file not shown.

shared/log4shell_scanner

Lines changed: 0 additions & 3 deletions
This file was deleted.

testing-tools/Dockerfile

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ FROM python:3.12-slim-bullseye@sha256:229b2897e6b5c630d83a721e42dd1c96e3ec996323
1010
ARG PRODUCT
1111
ARG RELEASE
1212
ARG KEYCLOAK_VERSION
13+
ARG STACKABLE_USER_UID
14+
ARG STACKABLE_USER_GID
15+
ARG STACKABLE_USER_NAME
1316

1417
LABEL name="Stackable Testing Tools" \
1518
maintainer="info@stackable.tech" \
@@ -25,49 +28,55 @@ SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
2528
# This is needed so that krb5-user installs without prompting for a realm.
2629
ENV DEBIAN_FRONTEND=noninteractive
2730

28-
# krb5-user/libkrb5-dev are needed for Kerberos support.
29-
RUN apt-get update && \
30-
apt-get install -y --no-install-recommends \
31-
build-essential \
32-
ca-certificates \
33-
curl \
34-
gzip \
35-
jq \
36-
krb5-user \
37-
kubernetes-client \
38-
libkrb5-dev \
39-
libssl-dev \
40-
libxml2-dev \
41-
libxslt1-dev \
42-
pkg-config \
43-
python3-certifi \
44-
python3-idna \
45-
python3-semver \
46-
python3-thrift \
47-
python3-toml \
48-
python3-urllib3 \
49-
tar \
50-
zip \
51-
unzip \
52-
# Java 11 seems like the best middle-ground for all tools
53-
openjdk-11-jdk-headless && \
54-
apt-get clean && \
55-
rm -rf /var/lib/apt/lists/*
5631

5732
COPY testing-tools/python /stackable/python
5833
COPY testing-tools/licenses /licenses
5934

60-
ENV PATH=/stackable/keycloak/bin:$PATH
61-
RUN curl --fail -L https://repo.stackable.tech/repository/packages/keycloak/keycloak-${KEYCLOAK_VERSION}.tar.gz | tar -xzC /stackable && \
62-
ln -s /stackable/keycloak-${KEYCLOAK_VERSION} /stackable/keycloak
6335

64-
RUN pip install --no-cache-dir --upgrade pip && \
65-
pip install --no-cache-dir -r /stackable/python/requirements.txt && \
66-
groupadd -r stackable --gid=1000 && \
67-
useradd -r -g stackable --uid=1000 stackable && \
68-
chown -R stackable:stackable /stackable
36+
RUN <<EOF
37+
apt-get update
38+
apt-get install -y --no-install-recommends \
39+
build-essential \
40+
ca-certificates \
41+
curl \
42+
gzip \
43+
jq \
44+
`# krb5-user/libkrb5-dev are needed for Kerberos support. ` \
45+
krb5-user \
46+
libkrb5-dev \
47+
kubernetes-client \
48+
libssl-dev \
49+
libxml2-dev \
50+
libxslt1-dev \
51+
pkg-config \
52+
python3-certifi \
53+
python3-idna \
54+
python3-semver \
55+
python3-thrift \
56+
python3-toml \
57+
python3-urllib3 \
58+
tar \
59+
zip \
60+
unzip \
61+
`# Java 11 seems like the best middle-ground for all tools` \
62+
openjdk-11-jdk-headless
63+
64+
apt-get clean
65+
rm -rf /var/lib/apt/lists/*
66+
67+
curl --fail -L https://repo.stackable.tech/repository/packages/keycloak/keycloak-${KEYCLOAK_VERSION}.tar.gz | tar -xzC /stackable
68+
ln -s /stackable/keycloak-${KEYCLOAK_VERSION} /stackable/keycloak
69+
70+
pip install --no-cache-dir --upgrade pip
71+
pip install --no-cache-dir -r /stackable/python/requirements.txt
72+
groupadd -r ${STACKABLE_USER_NAME} --gid=${STACKABLE_USER_GID}
73+
useradd -r -g ${STACKABLE_USER_NAME} --uid=${STACKABLE_USER_UID} ${STACKABLE_USER_NAME}
74+
chown -R ${STACKABLE_USER_UID}:0 /stackable
75+
EOF
76+
77+
ENV PATH=/stackable/keycloak/bin:$PATH
6978

70-
USER stackable
79+
USER ${STACKABLE_USER_UID}
7180

7281
ENV STACKABLE_PRODUCT_VERSION=${PRODUCT}
7382

0 commit comments

Comments
 (0)