Skip to content

Commit 63b221e

Browse files
committed
docker: Remove libarchive as a dependency
Also remove keylime user creation from non-fedora distributions and add wget to wolfi-based dockerfile Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
1 parent fcebcd8 commit 63b221e

File tree

4 files changed

+4
-47
lines changed

4 files changed

+4
-47
lines changed

docker/fedora/keylime_rust.Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ glib2-static \
3535
gnulib \
3636
kmod \
3737
llvm llvm-devel \
38-
libarchive-devel \
3938
libselinux-python3 \
4039
libtool \
4140
libtpms \

docker/release/Dockerfile.distroless

+1-25
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,6 @@ RUN ./configure \
2020
RUN make
2121
RUN make install
2222

23-
# Install libarchive (dependency for the compress-tools crate) - we need only a minimum feature set here
24-
WORKDIR /src
25-
RUN wget https://github.com/libarchive/libarchive/releases/download/v3.6.2/libarchive-3.6.2.tar.gz
26-
RUN tar xf libarchive-3.6.2.tar.gz
27-
WORKDIR /src/libarchive-3.6.2
28-
RUN ./configure \
29-
--prefix=/usr \
30-
--with-openssl \
31-
--without-mbedtls \
32-
--without-nettle \
33-
--without-xml2 \
34-
--without-expat \
35-
--disable-static
36-
RUN make
37-
RUN make install
38-
# there is a bug in the libarchive.pc file which wrongly adds iconv
39-
RUN sed -i "s/iconv //" /usr/lib/pkgconfig/libarchive.pc
40-
4123
# build rust-keylime
4224
COPY . /src/rust-keylime/
4325
WORKDIR /src/rust-keylime
@@ -65,11 +47,8 @@ LABEL org.opencontainers.image.vendor="The Keylime Authors"
6547
# NOTE: the cc base image comes with all C runtime dependencies (libc, libm, libgcc, etc.), so no need to copy those
6648
# TODO: Unfortunately the COPY directive is following links and not preserving the link file. This slightly bloats the image.
6749

68-
# libarchive is a direct dependency for the compress-tools crate, so we must copy itself and all its dependencies
50+
# libz is a direct dependency for the zip crate
6951
COPY --from=builder \
70-
/usr/lib/libarchive.so* \
71-
/lib/x86_64-linux-gnu/liblzma.so* \
72-
/lib/x86_64-linux-gnu/libbz2.so* \
7352
/lib/x86_64-linux-gnu/libz.so* \
7453
/usr/lib/x86_64-linux-gnu/
7554
# tpm2-tss libraries are a dependency (probably not all of them, but we just copy all)
@@ -95,8 +74,5 @@ LABEL install="podman volume create keylime-agent"
9574
LABEL uninstall="podman volume rm keylime-agent"
9675
LABEL run="podman run --read-only --name keylime-agent --rm --device /dev/tpm0 --device /dev/tpmrm0 -v keylime-agent:/var/lib/keylime -v /etc/keylime:/etc/keylime:ro --tmpfs /var/lib/keylime/secure:rw,size=1m,mode=0700 -dt IMAGE"
9776

98-
# Create a system user 'keylime' to allow dropping privileges
99-
RUN useradd -s /sbin/nologin -r -G tss keylime
100-
10177
# run as root by default
10278
USER 0:0

docker/release/Dockerfile.fedora

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ RUN microdnf install -y \
99
clang-devel \
1010
dnf-plugins-core \
1111
git \
12-
libarchive-devel \
1312
make \
1413
openssl-devel \
1514
rust \
@@ -43,7 +42,7 @@ LABEL vendor="The Keylime Authors"
4342
# Install all agent runtime dependencies from the builder image
4443
# NOTE: the fedora base image is "fat" and comes with basically all dependencies that we need out of the box with a few exceptions
4544
RUN microdnf makecache && \
46-
microdnf -y install tpm2-tss libarchive openssl util-linux-core && \
45+
microdnf -y install tpm2-tss openssl util-linux-core && \
4746
microdnf clean all && \
4847
rm -rf /var/cache/dnf/*
4948

docker/release/Dockerfile.wolfi

+2-19
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,10 @@ RUN apk update
1010
# - install rust
1111
# - install gcc and others to compile tpm2-tss
1212
# - we are using the "generate-bindings" feature for the tss-esapi crate which requires clang/llvm
13-
# - Install libarchive (dependency for the compress-tools crate)
1413
RUN apk add --no-cache --update-cache \
1514
rust \
1615
make pkgconf gcc glibc glibc-dev openssl openssl-dev posix-libc-utils \
17-
clang-15 llvm15 \
18-
libarchive libarchive-dev
19-
20-
# there is a bug in the libarchive.pc file which wrongly adds iconv
21-
RUN sed -i "s/iconv //" /usr/lib/pkgconfig/libarchive.pc
16+
clang-15 llvm15 wget
2217

2318
# Install tpm2-tss (dependency for the tss-esapi crate)
2419
WORKDIR /src
@@ -69,19 +64,10 @@ COPY --from=builder \
6964
/usr/lib/libssl.so* \
7065
/usr/lib/
7166

72-
# libarchive is a direct dependency for the compress-tools crate, so we must copy itself and all its dependencies
67+
# libz is a direct dependency for the zip crate
7368
COPY --from=builder \
74-
/lib/libacl.so* \
75-
/lib/libattr.so* \
7669
/lib/libz.so* \
7770
/lib/
78-
COPY --from=builder \
79-
/usr/lib/libarchive.so* \
80-
/usr/lib/libexpat.so* \
81-
/usr/lib/liblzma.so* \
82-
/usr/lib/libzstd.so* \
83-
/usr/lib/libbz2.so* \
84-
/usr/lib/
8571

8672
# tpm2-tss libraries are a dependency (probably not all of them, but we just copy all)
8773
# because we are using the tss-esapi crate which is essentially just a wrapper around those (unfortunately)
@@ -106,8 +92,5 @@ LABEL install="podman volume create keylime-agent"
10692
LABEL uninstall="podman volume rm keylime-agent"
10793
LABEL run="podman run --read-only --name keylime-agent --rm --device /dev/tpm0 --device /dev/tpmrm0 -v keylime-agent:/var/lib/keylime -v /etc/keylime:/etc/keylime:ro --tmpfs /var/lib/keylime/secure:rw,size=1m,mode=0700 -dt IMAGE"
10894

109-
# Create a system user 'keylime' to allow dropping privileges
110-
RUN useradd -s /sbin/nologin -r -G tss keylime
111-
11295
# run as root by default
11396
USER 0:0

0 commit comments

Comments
 (0)