Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Security Manifest for jre (channels/8/edge) #579

Merged
merged 2 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions jre/Dockerfile.22.04
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ RUN tar -xvf chisel.tar.gz -C /usr/bin/
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates \
ca-certificates-java \
zstd \
jq \
media-types \
openjdk-8-jre-headless \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /rootfs \
Expand All @@ -41,6 +45,11 @@ RUN install -d -m 0755 -o $UID -g $GID /rootfs/home/$USER \
&& echo -e "root:x:0:0:root:/root:/noshell\n$USER:x:$UID:$GID::/home/$USER:/noshell" >/rootfs/etc/passwd
RUN cp /etc/ssl/certs/java/cacerts /rootfs/etc/ssl/certs/java/cacerts

# Create security manifest
COPY print-dpkg-query.awk /
COPY create-manifest.sh /
RUN /bin/bash /create-manifest.sh /rootfs ${TARGETARCH}

FROM scratch
ARG USER
ARG UID
Expand Down
26 changes: 26 additions & 0 deletions jre/create-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -ex
INSTALL=$1
TARGETARCH=$2

mkdir -p $INSTALL/usr/share/rocks/
FIELDS=(
'${db:Status-Abbrev}'
'${binary:Package}'
'${Version}'
'${source:Package}'
'${Source:Version}\n'
)
zstd -d -f -q $INSTALL/var/lib/chisel/manifest.wall \
-o /manifest

# add openjdk-21 package
(
IFS="," && \
echo "# os-release" && cat /etc/os-release && echo "# dpkg-query"
) > $INSTALL/usr/share/rocks/dpkg.query
# add rest of the packages
jq -r 'select(.kind == "package") | "\(.name) \(.version)"' \
/manifest | \
awk -v arch=${TARGETARCH} -F' ' -f print-dpkg-query.awk \
>> $INSTALL/usr/share/rocks/dpkg.query
11 changes: 11 additions & 0 deletions jre/print-dpkg-query.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
binary=$1
version=$2
cmd = "dpkg-query -W -f='${source:Package}\n' " binary "| head -n 1"
if ((cmd | getline source) > 0) {
print "ii,"binary":"arch","version","source","version
} else {
exit 1
}
close(cmd)
}