mirror of
https://github.com/Such-Software/xmrcheckout.git
synced 2026-12-01 12:14:11 +01:00
fix(docker): verify the Monero release tarball before installing it
The wallet-rpc image installed monerod and monero-wallet-rpc from the v0.18.4.6 CLI download without checking it. Pin each architecture's SHA-256 from binaryFate's GPG-signed hashes.txt and refuse the build on a mismatch or on a version with no pinned hash. The version stays at 0.18.4.6.
This commit is contained in:
@@ -6,6 +6,11 @@ RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl bzip2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Each tarball's SHA-256 comes from binaryFate's GPG-signed hashes.txt
|
||||
# (getmonero.org/downloads/hashes.txt; for older releases, its history in
|
||||
# monero-project/monero-site). Verify that signature against
|
||||
# utils/gpg_keys/binaryfate.asc in monero-project/monero before adding a version.
|
||||
# A version without an entry here refuses to build.
|
||||
RUN set -eux; \
|
||||
arch="$(dpkg --print-architecture)"; \
|
||||
if [ "$arch" = "amd64" ]; then \
|
||||
@@ -16,8 +21,19 @@ RUN set -eux; \
|
||||
echo "Unsupported architecture: $arch" >&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
tarball="monero-linux-${monero_arch}-v${MONERO_VERSION}.tar.bz2"; \
|
||||
case "$tarball" in \
|
||||
monero-linux-x64-v0.18.4.6.tar.bz2) \
|
||||
monero_sha256="60cfc32d39c6fe6c19b23513d02017fe9055d2e412ee4cbc30fa40ba811fe052" ;; \
|
||||
monero-linux-armv8-v0.18.4.6.tar.bz2) \
|
||||
monero_sha256="d38c9ef8ee1a5d2de32f67d2f46c767c0c5cc3bb23ba7e3dfa9cbb19ceb2c84c" ;; \
|
||||
*) \
|
||||
echo "No pinned SHA-256 for $tarball; add it to docker/monero/Dockerfile from the signed hashes.txt" >&2; \
|
||||
exit 1 ;; \
|
||||
esac; \
|
||||
curl -fsSL -o /tmp/monero.tar.bz2 \
|
||||
"https://downloads.getmonero.org/cli/monero-linux-${monero_arch}-v${MONERO_VERSION}.tar.bz2"; \
|
||||
"https://downloads.getmonero.org/cli/${tarball}"; \
|
||||
echo "${monero_sha256} /tmp/monero.tar.bz2" | sha256sum -c -; \
|
||||
tar -xjf /tmp/monero.tar.bz2 -C /tmp; \
|
||||
cp /tmp/monero-*/monerod /usr/local/bin/; \
|
||||
cp /tmp/monero-*/monero-wallet-rpc /usr/local/bin/; \
|
||||
|
||||
Reference in New Issue
Block a user