Skip to content

Commit e7009d5

Browse files
committed
GPG validate hashes
* Download hashes from getmonero.org * Download and import GPG Keys from `monero-project/monero` * GPG validate hashes
1 parent 3f04b66 commit e7009d5

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

Dockerfile

+30-11
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,40 @@ WORKDIR /opt
88
RUN apt-get update && \
99
apt-get dist-upgrade -y && \
1010
apt-get install -y \
11-
wget ca-certificates bzip2
11+
wget ca-certificates bzip2 gnupg git
1212

1313
ARG MONERO_VERSION=v0.18.3.4
1414
WORKDIR /opt/monero
15-
RUN case "$(uname -m)" in \
16-
x86_64) ARCH="x64"; SHA256SUM="51ba03928d189c1c11b5379cab17dd9ae8d2230056dc05c872d0f8dba4a87f1d" ;; \
17-
aarch64* | arm64 | armv8*) ARCH="armv8"; SHA256SUM="33ca2f0055529d225b61314c56370e35606b40edad61c91c859f873ed67a1ea7" ;; \
18-
armv7*) ARCH="armv7"; SHA256SUM="354603c56446fb0551cdd6933bce5a13590b7881e05979b7ec25d89e7e59a0e2" ;; \
15+
16+
RUN git clone --filter=blob:none --sparse https://github.com/monero-project/monero -b ${MONERO_VERSION} && \
17+
cd monero && \
18+
git sparse-checkout set utils/gpg_keys && \
19+
mkdir -p /root/.gnupg && \
20+
chmod 700 /root/.gnupg && \
21+
for key in utils/gpg_keys/*.asc; do \
22+
gpg --import "$key"; \
23+
done && \
24+
cd .. && \
25+
rm -rf monero
26+
27+
RUN wget -q -O hashes.txt https://www.getmonero.org/downloads/hashes.txt && \
28+
wget -q -O hashes.txt.sig https://www.getmonero.org/downloads/hashes.txt.sig && \
29+
gpg --verify hashes.txt.sig hashes.txt && \
30+
case "$(uname -m)" in \
31+
x86_64) ARCH="x64" ;; \
32+
aarch64* | arm64 | armv8*) ARCH="armv8" ;; \
33+
armv7*) ARCH="armv7" ;; \
1934
*) echo "Unexpected architecture: $(uname -m)" && exit 1;; \
20-
esac \
21-
\
22-
&& wget https://downloads.getmonero.org/cli/monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2 \
23-
&& echo "${SHA256SUM} monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2" | sha256sum -c \
24-
&& tar -xjvf monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2 --strip-components 1 \
25-
&& rm -f monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2
35+
esac && \
36+
MONERO_HASH=$(grep "monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2" hashes.txt | cut -d' ' -f1) && \
37+
if [ -z "$MONERO_HASH" ]; then \
38+
echo "Hash not found for architecture ${ARCH} and version ${MONERO_VERSION}" && \
39+
exit 1; \
40+
fi && \
41+
wget https://downloads.getmonero.org/cli/monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2 && \
42+
echo "${MONERO_HASH} monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2" | sha256sum -c && \
43+
tar -xjf monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2 --strip-components 1 && \
44+
rm -f monero-linux-${ARCH}-${MONERO_VERSION}.tar.bz2 hashes.txt hashes.txt.sig
2645

2746
##################
2847
# --- runner --- #

0 commit comments

Comments
 (0)