diff --git a/build/tor/Dockerfile b/build/tor/Dockerfile index 1901d30064..0b7f4f6fc5 100644 --- a/build/tor/Dockerfile +++ b/build/tor/Dockerfile @@ -1,10 +1,11 @@ -# Pinned to a named minor version by digest (#135, #373). The digest is authoritative; the tag -# names the Alpine minor line (3.24) so Dependabot's patch-update policy has a real version to track. FROM alpine:3.24@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf -ARG TOR_VERSION=0.4.9.17-r0 -RUN apk add --no-cache --upgrade libcrypto3 libssl3 musl musl-utils "tor=${TOR_VERSION}" netcat-openbsd \ - && tor --version | grep -F "Tor version ${TOR_VERSION%-r*}." +ARG TOR_VERSION=0.4.9.18-r0 +RUN addgroup -S -g 101 tor \ + && adduser -S -D -H -h /var/lib/tor -s /sbin/nologin -u 100 -G tor -g tor tor \ + && apk add --no-cache --upgrade busybox busybox-binsh ssl_client libcrypto3 libssl3 musl musl-utils "tor=${TOR_VERSION}" netcat-openbsd \ + && tor --version | grep -F "Tor version ${TOR_VERSION%-r*}." \ + && [ "$(id -u tor):$(id -g tor)" = 100:101 ] COPY torrc.template /etc/tor/torrc.template COPY entrypoint.sh /usr/local/bin/tor-entrypoint.sh diff --git a/tests/integration/tor-client/Dockerfile b/tests/integration/tor-client/Dockerfile index 339aedce29..10acda38a6 100644 --- a/tests/integration/tor-client/Dockerfile +++ b/tests/integration/tor-client/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.24@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf -RUN apk add --no-cache --upgrade libcrypto3 libssl3 musl musl-utils tor curl ca-certificates +RUN apk add --no-cache --upgrade busybox busybox-binsh ssl_client libcrypto3 libssl3 musl musl-utils tor curl ca-certificates COPY probe.sh /usr/local/bin/probe.sh RUN chmod 0755 /usr/local/bin/probe.sh diff --git a/tests/netwatch/Dockerfile b/tests/netwatch/Dockerfile index d24afa1c6c..e2a5e1281a 100644 --- a/tests/netwatch/Dockerfile +++ b/tests/netwatch/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:3.24@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf -RUN apk add --no-cache --upgrade libcrypto3 libssl3 musl musl-utils zlib conntrack-tools tcpdump +RUN apk add --no-cache --upgrade busybox busybox-binsh ssl_client libcrypto3 libssl3 musl musl-utils zlib conntrack-tools tcpdump ENTRYPOINT ["/usr/sbin/conntrack"] diff --git a/tests/stack/test-harness-tooling.sh b/tests/stack/test-harness-tooling.sh index 20bd4d8016..95d0ec6718 100644 --- a/tests/stack/test-harness-tooling.sh +++ b/tests/stack/test-harness-tooling.sh @@ -158,9 +158,12 @@ assert_rc "every real healthcheck script exists where its own Dockerfile promise echo "== unit: image builds retry apt update (#1802) ==" for image in monero p2pool xmrig-proxy; do assert_contains "image build retries apt update with delayed, bounded backoff (#1802)" "$(cat "$ROOT/build/$image/Dockerfile")" 'for attempt in 1 2 3; do apt-get update && break || { [ "$attempt" = 3 ] && exit 1; sleep "$((attempt * 5))"; }; done'; done echo "== unit: image builds pull base security fixes past the digest pin (#3923, #3929) ==" -for alpine_image in build/tor tests/integration/tor-client tests/netwatch; do assert_contains "alpine image build pulls the base's musl past the digest pin with the openssl libs (#3929)" "$(cat "$ROOT/$alpine_image/Dockerfile")" 'apk add --no-cache --upgrade libcrypto3 libssl3 musl musl-utils'; done +for alpine_image in build/tor tests/integration/tor-client tests/netwatch; do assert_contains "alpine image build pulls the base's busybox and musl past the digest pin with the openssl libs (#3929, #4676)" "$(cat "$ROOT/$alpine_image/Dockerfile")" 'apk add --no-cache --upgrade busybox busybox-binsh ssl_client libcrypto3 libssl3 musl musl-utils'; done assert_contains "tor image pins the apk tor package to an explicit version (#4125)" "$(cat "$ROOT/build/tor/Dockerfile")" '"tor=${TOR_VERSION}"' assert_contains "tor image build fails unless the installed tor reports the pinned version (#4125)" "$(cat "$ROOT/build/tor/Dockerfile")" 'tor --version | grep -F "Tor version ${TOR_VERSION%-r*}."' +assert_contains "tor image creates tor as 100:101 before apk can hand those ids to another package" "$(cat "$ROOT/build/tor/Dockerfile")" $'RUN addgroup -S -g 101 tor \\\n && adduser -S -D -H -h /var/lib/tor -s /sbin/nologin -u 100 -G tor -g tor tor \\\n && apk add ' +assert_contains "tor image build fails unless tor is 100:101, the owner pithead gives the tor data folder" "$(cat "$ROOT/build/tor/Dockerfile")" '[ "$(id -u tor):$(id -g tor)" = 100:101 ]' +assert_contains "pithead hands the tor data folder to the same 100:101" "$(cat "$ROOT/lib/pithead/29-preserved-state-and-dirs.sh")" 'chown -R 100:101 "$TOR_DATA_DIR"' assert_contains "netwatch build pulls the base's zlib with the rest (#3929)" "$(cat "$ROOT/tests/netwatch/Dockerfile")" 'musl musl-utils zlib' for debian_image in dashboard os/rootfs; do assert_contains "debian image build lists zlib1g to pull its security build (#3923)" "$(cat "$ROOT/$debian_image/Dockerfile")" 'zlib1g'; done echo "== unit: patch-coverage overlap self-test (#1000) =="