|
1 | 1 | ### Verify Binaries
|
2 | 2 |
|
3 |
| -#### Usage: |
| 3 | +#### Preparation |
4 | 4 |
|
5 |
| -This script attempts to download the signature file `SHA256SUMS.asc` from https://bitcoin.org. |
| 5 | +As of Bitcoin Core v22.0, releases are signed by a number of public keys on the basis |
| 6 | +of the [guix.sigs repository](https://github.com/bitcoin-core/guix.sigs/). When |
| 7 | +verifying binary downloads, you (the end user) decide which of these public keys you |
| 8 | +trust and then use that trust model to evaluate the signature on a file that contains |
| 9 | +hashes of the release binaries. The downloaded binaries are then hashed and compared to |
| 10 | +the signed checksum file. |
6 | 11 |
|
7 |
| -It first checks if the signature passes, and then downloads the files specified in the file, and checks if the hashes of these files match those that are specified in the signature file. |
| 12 | +First, you have to figure out which public keys to recognize. Browse the [list of frequent |
| 13 | +builder-keys](https://github.com/bitcoin-core/guix.sigs/tree/main/builder-keys) and |
| 14 | +decide which of these keys you would like to trust. For each key you want to trust, you |
| 15 | +must obtain that key for your local GPG installation. |
8 | 16 |
|
9 |
| -The script returns 0 if everything passes the checks. It returns 1 if either the signature check or the hash check doesn't pass. If an error occurs the return value is 2. |
| 17 | +You can obtain these keys by |
| 18 | + - through a browser using a key server (e.g. keyserver.ubuntu.com), |
| 19 | + - manually using the `gpg --keyserver <url> --recv-keys <key>` command, or |
| 20 | + - you can run the packaged `verify.py ... --import-keys` script to |
| 21 | + have it automatically retrieve unrecognized keys. |
10 | 22 |
|
| 23 | +#### Usage |
11 | 24 |
|
| 25 | +This script attempts to download the checksum file (`SHA256SUMS`) and corresponding |
| 26 | +signature file `SHA256SUMS.asc` from https://bitcoincore.org and https://bitcoin.org. |
| 27 | + |
| 28 | +It first checks if the checksum file is valid based upon a plurality of signatures, and |
| 29 | +then downloads the release files specified in the checksum file, and checks if the |
| 30 | +hashes of the release files are as expected. |
| 31 | + |
| 32 | +If we encounter pubkeys in the signature file that we do not recognize, the script |
| 33 | +can prompt the user as to whether they'd like to download the pubkeys. To enable |
| 34 | +this behavior, use the `--import-keys` flag. |
| 35 | + |
| 36 | +The script returns 0 if everything passes the checks. It returns 1 if either the |
| 37 | +signature check or the hash check doesn't pass. An exit code of >2 indicates an error. |
| 38 | + |
| 39 | +See the `Config` object for various options. |
| 40 | + |
| 41 | +#### Examples |
| 42 | + |
| 43 | +Validate releases with default settings: |
12 | 44 | ```sh
|
13 |
| -./verify.py bitcoin-core-0.11.2 |
14 |
| -./verify.py bitcoin-core-0.12.0 |
15 |
| -./verify.py bitcoin-core-0.13.0-rc3 |
| 45 | +./contrib/verifybinaries/verify.py pub 22.0 |
| 46 | +./contrib/verifybinaries/verify.py pub 22.0-rc2 |
| 47 | +``` |
| 48 | + |
| 49 | +Get JSON output and don't prompt for user input (no auto key import): |
| 50 | + |
| 51 | +```sh |
| 52 | +./contrib/verifybinaries/verify.py --json pub 22.0-x86 |
| 53 | +``` |
| 54 | + |
| 55 | +Rely only on local GPG state and manually specified keys, while requiring a |
| 56 | +threshold of at least 10 trusted signatures: |
| 57 | +```sh |
| 58 | +./contrib/verifybinaries/verify.py \ |
| 59 | + --trusted-keys 74E2DEF5D77260B98BC19438099BAD163C70FBFA,9D3CC86A72F8494342EA5FD10A41BDC3F4FAFF1C \ |
| 60 | + --min-good-sigs 10 pub 22.0-x86 |
16 | 61 | ```
|
17 | 62 |
|
18 | 63 | If you only want to download the binaries of certain platform, add the corresponding suffix, e.g.:
|
19 | 64 |
|
20 | 65 | ```sh
|
21 |
| -./verify.py bitcoin-core-0.11.2-osx |
22 |
| -./verify.py 0.12.0-linux |
23 |
| -./verify.py bitcoin-core-0.13.0-rc3-win64 |
| 66 | +./contrib/verifybinaries/verify.py pub 22.0-osx |
| 67 | +./contrib/verifybinaries/verify.py pub 22.0-rc2-win64 |
| 68 | +``` |
| 69 | + |
| 70 | +If you do not want to keep the downloaded binaries, specify the cleanup option. |
| 71 | + |
| 72 | +```sh |
| 73 | +./contrib/verifybinaries/verify.py pub --cleanup 22.0 |
| 74 | +``` |
| 75 | + |
| 76 | +Use the bin subcommand to verify all files listed in a local checksum file |
| 77 | + |
| 78 | +```sh |
| 79 | +./contrib/verifybinaries/verify.py bin SHA256SUMS |
24 | 80 | ```
|
25 | 81 |
|
26 |
| -If you do not want to keep the downloaded binaries, specify anything as the second parameter. |
| 82 | +Verify only a subset of the files listed in a local checksum file |
27 | 83 |
|
28 | 84 | ```sh
|
29 |
| -./verify.py bitcoin-core-0.13.0 delete |
| 85 | +./contrib/verifybinaries/verify.py bin ~/Downloads/SHA256SUMS \ |
| 86 | + ~/Downloads/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz \ |
| 87 | + ~/Downloads/bitcoin-24.0.1-arm-linux-gnueabihf.tar.gz |
30 | 88 | ```
|
0 commit comments