2016-04-15 12:18:12 +02:00
|
|
|
### Verify Binaries
|
2016-08-21 21:58:29 +02:00
|
|
|
|
2021-09-17 00:33:20 +02:00
|
|
|
#### Preparation
|
2016-08-21 21:58:29 +02:00
|
|
|
|
2021-09-17 00:33:20 +02:00
|
|
|
As of Bitcoin Core v22.0, releases are signed by a number of public keys on the basis
|
|
|
|
of the [guix.sigs repository](https://github.com/bitcoin-core/guix.sigs/). When
|
|
|
|
verifying binary downloads, you (the end user) decide which of these public keys you
|
|
|
|
trust and then use that trust model to evaluate the signature on a file that contains
|
|
|
|
hashes of the release binaries. The downloaded binaries are then hashed and compared to
|
|
|
|
the signed checksum file.
|
2013-10-16 05:14:30 +02:00
|
|
|
|
2021-09-17 00:33:20 +02:00
|
|
|
First, you have to figure out which public keys to recognize. Browse the [list of frequent
|
|
|
|
builder-keys](https://github.com/bitcoin-core/guix.sigs/tree/main/builder-keys) and
|
|
|
|
decide which of these keys you would like to trust. For each key you want to trust, you
|
|
|
|
must obtain that key for your local GPG installation.
|
2013-10-22 02:00:10 +02:00
|
|
|
|
2021-09-17 00:33:20 +02:00
|
|
|
You can obtain these keys by
|
|
|
|
- through a browser using a key server (e.g. keyserver.ubuntu.com),
|
|
|
|
- manually using the `gpg --keyserver <url> --recv-keys <key>` command, or
|
2023-06-08 22:26:09 +02:00
|
|
|
- you can run the packaged `verify.py --import-keys ...` script to
|
2021-09-17 00:33:20 +02:00
|
|
|
have it automatically retrieve unrecognized keys.
|
2016-04-15 12:18:12 +02:00
|
|
|
|
2021-09-17 00:33:20 +02:00
|
|
|
#### Usage
|
2016-04-15 12:18:12 +02:00
|
|
|
|
2021-09-17 00:33:20 +02:00
|
|
|
This script attempts to download the checksum file (`SHA256SUMS`) and corresponding
|
|
|
|
signature file `SHA256SUMS.asc` from https://bitcoincore.org and https://bitcoin.org.
|
|
|
|
|
|
|
|
It first checks if the checksum file is valid based upon a plurality of signatures, and
|
|
|
|
then downloads the release files specified in the checksum file, and checks if the
|
|
|
|
hashes of the release files are as expected.
|
|
|
|
|
|
|
|
If we encounter pubkeys in the signature file that we do not recognize, the script
|
|
|
|
can prompt the user as to whether they'd like to download the pubkeys. To enable
|
|
|
|
this behavior, use the `--import-keys` flag.
|
|
|
|
|
|
|
|
The script returns 0 if everything passes the checks. It returns 1 if either the
|
|
|
|
signature check or the hash check doesn't pass. An exit code of >2 indicates an error.
|
|
|
|
|
|
|
|
See the `Config` object for various options.
|
|
|
|
|
|
|
|
#### Examples
|
|
|
|
|
|
|
|
Validate releases with default settings:
|
|
|
|
```sh
|
2023-04-09 12:38:22 +02:00
|
|
|
./contrib/verify-binaries/verify.py pub 22.0
|
2023-04-09 12:33:41 +02:00
|
|
|
./contrib/verify-binaries/verify.py pub 22.0-rc3
|
2021-09-17 00:33:20 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Get JSON output and don't prompt for user input (no auto key import):
|
|
|
|
|
|
|
|
```sh
|
2023-04-09 12:38:22 +02:00
|
|
|
./contrib/verify-binaries/verify.py --json pub 22.0-x86
|
2024-05-23 05:37:31 +02:00
|
|
|
./contrib/verify-binaries/verify.py --json pub 23.0-rc5-linux-gnu
|
2021-09-17 00:33:20 +02:00
|
|
|
```
|
|
|
|
|
2023-04-04 23:09:42 +02:00
|
|
|
Rely only on local GPG state and manually specified keys, while requiring a
|
|
|
|
threshold of at least 10 trusted signatures:
|
2016-04-15 12:18:12 +02:00
|
|
|
```sh
|
2023-04-09 12:38:22 +02:00
|
|
|
./contrib/verify-binaries/verify.py \
|
2021-09-17 00:33:20 +02:00
|
|
|
--trusted-keys 74E2DEF5D77260B98BC19438099BAD163C70FBFA,9D3CC86A72F8494342EA5FD10A41BDC3F4FAFF1C \
|
2024-05-23 05:37:31 +02:00
|
|
|
--min-good-sigs 10 pub 22.0-linux
|
2016-04-15 12:18:12 +02:00
|
|
|
```
|
2016-08-21 21:37:21 +02:00
|
|
|
|
2024-05-23 05:37:31 +02:00
|
|
|
If you only want to download the binaries for a certain architecture and/or platform, add the corresponding suffix, e.g.:
|
2017-04-25 11:40:09 +02:00
|
|
|
|
|
|
|
```sh
|
2024-05-23 05:37:31 +02:00
|
|
|
./contrib/verify-binaries/verify.py pub 25.2-x86_64-linux
|
|
|
|
./contrib/verify-binaries/verify.py pub 24.1-rc1-darwin
|
|
|
|
./contrib/verify-binaries/verify.py pub 27.0-win64-setup.exe
|
2017-04-25 11:40:09 +02:00
|
|
|
```
|
|
|
|
|
2023-04-04 23:09:42 +02:00
|
|
|
If you do not want to keep the downloaded binaries, specify the cleanup option.
|
2016-08-21 21:37:21 +02:00
|
|
|
|
|
|
|
```sh
|
2023-04-09 12:38:22 +02:00
|
|
|
./contrib/verify-binaries/verify.py pub --cleanup 22.0
|
2023-04-04 23:09:42 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Use the bin subcommand to verify all files listed in a local checksum file
|
|
|
|
|
|
|
|
```sh
|
2023-04-09 12:38:22 +02:00
|
|
|
./contrib/verify-binaries/verify.py bin SHA256SUMS
|
2023-04-04 23:09:42 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Verify only a subset of the files listed in a local checksum file
|
|
|
|
|
|
|
|
```sh
|
2023-04-09 12:38:22 +02:00
|
|
|
./contrib/verify-binaries/verify.py bin ~/Downloads/SHA256SUMS \
|
2023-04-04 23:09:42 +02:00
|
|
|
~/Downloads/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz \
|
|
|
|
~/Downloads/bitcoin-24.0.1-arm-linux-gnueabihf.tar.gz
|
2016-08-21 21:37:21 +02:00
|
|
|
```
|