-
Notifications
You must be signed in to change notification settings - Fork 37.7k
guix: Notarize MacOS app bundle and codesign all MacOS and Windows binaries #31407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31407. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
27cf5a3
to
ba67aa6
Compare
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
It's unclear to me whether the standalone binaries need to be notarized too. This is currently not implemented, but should not be that much more complicated to do. |
Are they being codesigned already? I was getting the v28 binaries from bitcoincore.org instantly killed in Sonoma 14.6.1 when trying to run them in the terminal today. Took me a while to understand what was happening because the processes are killed without a security message or anything like the "nice" gatekeeper popup. Codesigning each on my own solved the issue.
|
This PR codesigns them. |
Do you mean the binaries in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to properly test this, you would have to provide the detached signatures and staple for this PR.
Reviewers then need to download it from some website. If you obtain the file via SSH from your own guix machine, macOS tries to be smart about it (at least my Intel mac used to do that).
HOSTS="x86_64-w64-mingw32 x86_64-apple-darwin arm64-apple-darwin" ./contrib/guix/guix-build
...
find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
Guix hashes for macOS and Windows, before code-sign:
arm_64
e1d50cc856902e31e966f0e0d50ac732a6d8c7c080e9f9d50ab229d7503bd601 guix-build-ba67aa681e9b/output/arm64-apple-darwin/SHA256SUMS.part
462617a5476e946e10be8624d73b531041c8abf4628a35038d65b80534de768a guix-build-ba67aa681e9b/output/arm64-apple-darwin/bitcoin-ba67aa681e9b-arm64-apple-darwin-codesigning.tar.gz
2583965a7ecbcf48946bcb7676cf6b39a04cee44b34c6292d81cbb825f0d35df guix-build-ba67aa681e9b/output/arm64-apple-darwin/bitcoin-ba67aa681e9b-arm64-apple-darwin-unsigned.tar.gz
96f25391136c5e3f77b6dfb4e027aa1f43ccc91edf0237b9ec0c7b01a64b32f3 guix-build-ba67aa681e9b/output/arm64-apple-darwin/bitcoin-ba67aa681e9b-arm64-apple-darwin-unsigned.zip
74d95312c8a33c65a1ea55c1d8392c58d77f78251af551926d4e913f12b45cac guix-build-ba67aa681e9b/output/dist-archive/bitcoin-ba67aa681e9b.tar.gz
1f457247d24466bc7f8faeb7f8faec80cadfed66ef68354c77a36ceba1127799 guix-build-ba67aa681e9b/output/x86_64-apple-darwin/SHA256SUMS.part
eafb67c89ed27e1dd216e2d300829c5bb22fbe6999839189441e3d64080b65f5 guix-build-ba67aa681e9b/output/x86_64-apple-darwin/bitcoin-ba67aa681e9b-x86_64-apple-darwin-codesigning.tar.gz
0d9f7d7ef1f71b4c3072a0af44b374caf0a4646f4ba143f5440bbcf52c8fe614 guix-build-ba67aa681e9b/output/x86_64-apple-darwin/bitcoin-ba67aa681e9b-x86_64-apple-darwin-unsigned.tar.gz
a0337d08f8145ed4c8548086752b8c32766db1a0483573b44f95134cba9f3913 guix-build-ba67aa681e9b/output/x86_64-apple-darwin/bitcoin-ba67aa681e9b-x86_64-apple-darwin-unsigned.zip
635b1e00cd6792faae60085f4d0ec71bb010756caa40f7241b05e1e3ef6aa18a guix-build-ba67aa681e9b/output/x86_64-w64-mingw32/SHA256SUMS.part
96326f5755ee14d74b74addc740e8e89c49ee65e4f56746a018e3aba39025642 guix-build-ba67aa681e9b/output/x86_64-w64-mingw32/bitcoin-ba67aa681e9b-win64-codesigning.tar.gz
0d1f7d39c4fcee02d763d85c7f14fe28233f4fe357192e54a227cb54843a8a0b guix-build-ba67aa681e9b/output/x86_64-w64-mingw32/bitcoin-ba67aa681e9b-win64-debug.zip
b3531bbeccd65d52cb73be3edc38f3aa4b1abe6373ad4e153e4c036a78f29b18 guix-build-ba67aa681e9b/output/x86_64-w64-mingw32/bitcoin-ba67aa681e9b-win64-setup-unsigned.exe
e0a39aad96ac6fa7bf0957119bfca2a527e66f9991a71e84cc5c90864a9c833d guix-build-ba67aa681e9b/output/x86_64-w64-mingw32/bitcoin-ba67aa681e9b-win64-unsigned.zip
;; | ||
*darwin*) | ||
echo "$(outdir_for_host "$1")/${DISTNAME}-${1}-unsigned.tar.gz" | ||
echo "$(outdir_for_host "$1")/${DISTNAME}-${1}-codesigning.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
912377a: maybe call it -maintainers
to reduce confusion with -unsigned
?
A more generic term might also be handy in the future if e.g. we want to include an OTS timestamp that commits to the (pre codesigning, pgp signed?) guix hashes (with all architectures).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codesigners are not necessarily maintainers. I don't think it's useful to make this broad when it has been extremely specific for codesigning for more than a decade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that seems something to consider when and if we cross that bridge. Currently an .ots
is already generated for the final SHA256SUMS at release time, not sure to move that to another phase in the process.
@fanquake @pinheadmz Can one of you please do a build and make detached sigs for this PR for testing? |
@@ -382,6 +365,23 @@ mkdir -p "$DISTSRC" | |||
|| ( rm -f "${OUTDIR}/${DISTNAME}-win64-codesigning.tar.gz" && exit 1 ) | |||
) | |||
;; | |||
*darwin*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "build: Include all MacOS binaries for codesigning"
What is the effect of moving this code down? Will it pick up more artifacts that have been produced in between?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this makes it include the directory containing the binaries in the codesigning tarball.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hitting an error with guix-codesign
. I am just focusing on HOSTS=arm64-apple-darwin
, guix build of: ba67aa6
SHASUMS.part:
462617a5476e946e10be8624d73b531041c8abf4628a35038d65b80534de768a arm64-apple-darwin/bitcoin-ba67aa681e9b-arm64-apple-darwin-codesigning.tar.gz
2583965a7ecbcf48946bcb7676cf6b39a04cee44b34c6292d81cbb825f0d35df arm64-apple-darwin/bitcoin-ba67aa681e9b-arm64-apple-darwin-unsigned.tar.gz
96f25391136c5e3f77b6dfb4e027aa1f43ccc91edf0237b9ec0c7b01a64b32f3 arm64-apple-darwin/bitcoin-ba67aa681e9b-arm64-apple-darwin-unsigned.zip
74d95312c8a33c65a1ea55c1d8392c58d77f78251af551926d4e913f12b45cac dist-archive/bitcoin-ba67aa681e9b.tar.gz
Detached code signatures (maybe):
signature-osx-executable.tar.gz
However, attaching them is an issue:
zip@zip:~/bitcoin$ DETACHED_SIGS_REPO=../bitcoin-detached-sigs HOSTS=arm64-apple-darwin ./contrib/guix/guix-codesign
Checking that we can connect to the guix-daemon...
Hint: If this hangs, you may want to try turning your guix-daemon off and on
again.
INFO: Codesigning ba67aa681e9b for platform triple arm64-apple-darwin:
...using reference timestamp: 1733177891
...from worktree directory: '/home/zip/bitcoin'
...bind-mounted in container to: '/bitcoin'
...in build directory: '/home/zip/bitcoin/guix-build-ba67aa681e9b/distsrc-ba67aa681e9b-arm64-apple-darwin-codesigned'
...bind-mounted in container to: '/distsrc-base/distsrc-ba67aa681e9b-arm64-apple-darwin-codesigned'
...outputting in: '/home/zip/bitcoin/guix-build-ba67aa681e9b/output/arm64-apple-darwin-codesigned'
...bind-mounted in container to: '/outdir-base/arm64-apple-darwin-codesigned'
...using detached signatures in: '../bitcoin-detached-sigs'
...bind-mounted in container to: '/detached-sigs'
guix shell: error: symlink: No such file or directory: "/home/zip/bitcoin/guix-build-ba67aa681e9b/var/profiles/arm64-apple-darwin-codesigned"
Do I need to have bitcoin-detached-sigs
checked out on a branch name that matches the build version?
I got one step further by creating the directory its looking for in the last error:
this broke somewhere new...
|
ba67aa6
to
46e44a3
Compare
Pushed a fix for the wrong architecture detection. |
Guix hashes for macOS and Windows, before code-sign:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 46e44a3
Tested on arm64/macos, but did not review code or test other platforms. This updated process closes the referenced issues and successfully creates signed binaries for bitcoind
, bitcoin-cli
and all other utilities including Bitcoin-Qt.
Detached sigs (tar xf
and commit locally in bitcoin-detached-sigs
to test):
Attestations:
all.SHA256SUMS
504b22387c634bcf78846830b8f53359e54d526b2f0e976631a0bbd293f0353c bitcoin-46e44a35b858-arm64-apple-darwin.tar.gz
787fd1bd670ce5b903d174ee715a532365c8cc426278020877ef1616c8befa57 bitcoin-46e44a35b858-arm64-apple-darwin.zip
3a911d1a009222c042a84864dccd58462ce3167ea5f407830bf98d370fa356e4 bitcoin-46e44a35b858-arm64-apple-darwin-codesigning.tar.gz
2b1c4d096f27ae2a650ce3fe954304c53bb51b7ddac5dd533cabcc862a75f684 bitcoin-46e44a35b858-arm64-apple-darwin-unsigned.tar.gz
18c4fe6b004b0b9685671d1a60b146ce00bafe47591ff337ad3af08d8ea55e42 bitcoin-46e44a35b858-arm64-apple-darwin-unsigned.zip
7f92d478c82e193da4578c19e37fa7bebed7b23eb9745ace8679f1503a2d25ed bitcoin-46e44a35b858-codesignatures-001c1794ae89.tar.gz
e920044a3cf85974b337a5a7e13c35cf8633d5083cb9ab8ba46c3b0f24019a1c bitcoin-46e44a35b858.tar.gz
noncodesigned.SHA256SUMS
3a911d1a009222c042a84864dccd58462ce3167ea5f407830bf98d370fa356e4 bitcoin-46e44a35b858-arm64-apple-darwin-codesigning.tar.gz
2b1c4d096f27ae2a650ce3fe954304c53bb51b7ddac5dd533cabcc862a75f684 bitcoin-46e44a35b858-arm64-apple-darwin-unsigned.tar.gz
18c4fe6b004b0b9685671d1a60b146ce00bafe47591ff337ad3af08d8ea55e42 bitcoin-46e44a35b858-arm64-apple-darwin-unsigned.zip
e920044a3cf85974b337a5a7e13c35cf8633d5083cb9ab8ba46c3b0f24019a1c bitcoin-46e44a35b858.tar.gz
Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
ACK 46e44a35b85830a60cf622e039db19ccf1989008
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmervD4ACgkQ5+KYS2KJ
yTqW+w//XZDjfkldmMEbEOs8fpwv38eHly9Uha8hVscixHgG6L1QkTfMimomONzD
m0N3cOT13sEXJkuyp1ztnZoklQ2FfDcceKiN8Kb455esPtYsNrR5SyMDx3O+HYTF
2WxSO7ktfjU7G+ZaXgHB/+xGUrXQIWNkP4b1Z+QuHtu3Sc+3TnZS2mtjvpXc1go+
m8Rnz/hqYn1F1ePn25AMsixfdt99QUw2Z/oti3HDfiG136lHpZt0MbixCk1gDnXs
NDSloElhUgTLyosBfdU+5KLbjsB1DKz+N2dsQ8rHTpuXcau7HPm5IAdPheSIhS5Z
OC1z/h9/EhgOYSlAbyURovTYa0Cpz/faGNhWWIw6v+t6UBFX1Sn4fPt7X3S8k0d+
oya7oDFTyo2NZVyM8l9+dssZaJByUOdJKYloF00g26fRA+ELaX3PxXIB/cFWNiss
UgPc5C/pfvjq/Cr7Zwb0XdHP8U0lTbu8Aqk93xxfcKx5MVdjTnlI2JF8nbn0/eYQ
C1GjVdHCwLR/nM6aHatEFy04WFUUeK3r7pUPRY39B/fPS31N29q5UpbvvAqihZLQ
nVqHCCxCNrL2Ph+PwjqQsvXchz97gizQu6OKbX3DcRWstg6EwRQ3K2CG/k7MAvtw
NnEtOMWHeXO8qW3MQkZj4IDCjTKU/OKab+jf+F0reSkZ1Oc1E54=
=NUrf
-----END PGP SIGNATURE-----
pinheadmz's public key is on keybase
Bonus verbose code sign verification of
|
Windows code signature: It looks like I have a mismatch.
Could someone else do a codesigned build so we can compare? @pinheadmz @fanquake Could one of you also make a x86_64 MacOS codesignature? |
The tarballs used for codesigning are more than merely unsigned, they also contain scripts and other data for codesigning. Rename them to codesigning.tar.gz to distinguish from tarballs containing actually just the unsigned binaries.
The MacOS binaries are unsigned and therefore also unusable on MacOS. Indicate as such by naming the tarball "unsigned".
Followup to bitcoin#31407. Github-Pull: bitcoin#32003 Rebased-From: c873ab6
I've opened something (not-yet-fully-tested) here #32563 for |
The tarballs used for codesigning are more than merely unsigned, they also contain scripts and other data for codesigning. Rename them to codesigning.tar.gz to distinguish from tarballs containing actually just the unsigned binaries. Github-Pull: bitcoin#31407 Rebased-From: c214e52
The MacOS binaries are unsigned and therefore also unusable on MacOS. Indicate as such by naming the tarball "unsigned". Github-Pull: bitcoin#31407 Rebased-From: d9d49cd
As codesigned binaries will be published, the unsigned ones should be clearly marked as such. Github-Pull: bitcoin#31407 Rebased-From: 4e5c9ce
Github-Pull: bitcoin#31407 Rebased-From: dd4ec84
Github-Pull: bitcoin#31407 Rebased-From: e8b3c44
Github-Pull: bitcoin#31407 Rebased-From: 710d5b5
Signapple has been updated to sign individual binaries, and notarize app bundles and binaries. When codesigning, all individual binaries will be codesigned, and both the app bundle and individual binaries will be notarized. Github-Pull: bitcoin#31407 Rebased-From: 31d3254
Github-Pull: bitcoin#31407 Rebased-From: aafbd23
Github-Pull: bitcoin#31407 Rebased-From: e181bda
Followup to bitcoin#31407. Github-Pull: bitcoin#32003 Rebased-From: c873ab6
Github-Pull: bitcoin#31407 Rebased-From: dd4ec84
Github-Pull: bitcoin#31407 Rebased-From: e8b3c44
Github-Pull: bitcoin#31407 Rebased-From: 710d5b5
Signapple has been updated to sign individual binaries, and notarize app bundles and binaries. When codesigning, all individual binaries will be codesigned, and both the app bundle and individual binaries will be notarized. Github-Pull: bitcoin#31407 Rebased-From: 31d3254
Github-Pull: bitcoin#31407 Rebased-From: aafbd23
Github-Pull: bitcoin#31407 Rebased-From: e181bda
Followup to bitcoin#31407. Github-Pull: bitcoin#32003 Rebased-From: c873ab6
b1f694f doc: update release-notes.md (fanquake) 52f0963 doc: remove note about macOS self-signing (fanquake) 744b1c8 guix: Apply all codesignatures to Windows binaries (Ava Chow) 812cade guix: Apply codesignatures to all MacOS binaries (Ava Chow) c60055c contrib: Sign and notarize all MacOS binaries (Ava Chow) 0bd5cb7 guix: Update signapple (Ava Chow) 2b279a2 build: Include all Windows binaries for codesigning (Ava Chow) ac2b608 build: Include all MacOS binaries for codesigning (Ava Chow) 2c21db6 guix: Rename Windows unsigned binaries to unsigned.zip (Ava Chow) 9f0ee1c guix: Rename MacOS binaries to unsigned.tar.gz (Ava Chow) 00b401c guix: Rename unsigned.tar.gz to codesigning.tar.gz (Ava Chow) Pull request description: Backports #31407 + #32003. ACKs for top commit: pinheadmz: ACK b1f694f Tree-SHA512: f0ca9427eb367039b4eb0c8740e66c72520413ed43f66a0ffa60d44c36426f8a31f45a1b974b5e6a591b8bf9d9e125140934d9e0ce3a8f5aaaf01c12d7fd62bd
Github-Pull: bitcoin#31407 Rebased-From: 3656b82
Github-Pull: bitcoin#31407 Rebased-From: 3656b82
Since bitcoin#31407 guix builds are signed and notarized. This was backported to v28, so bump the version.
Since bitcoin#31407 guix builds are signed and notarized. This was backported to v28, so bump the version.
Since bitcoin#31407 guix builds are signed and notarized. This was backported to v28, so bump the version.
4bb4c86 test: document HOST for get_previous_releases.py (Sjors Provoost) 609203d test: stop signing previous releases >= v28.2 (Sjors Provoost) c6dc2c2 test: replace v28.0 with notarized v28.2 (Sjors Provoost) 5bd73d9 test: fix macOS detection (Sjors Provoost) Pull request description: Since #31407 macOS guix builds are signed and notarized. This was included in v29 and backported to 28.x. This PR bumps the v28.0 previous release binary to v28.2 and adjusts the test that uses it. Additionally it no longer manually code signs binaries >= v28.2. While testing on an M4 mac and redownloading all the binaries, I noticed that `platform == "arm64-apple-darwin"` doesn't actually work. This initially used `args.platform` in #26694, but that was changed to just `platform` in #32219. So the first commit switches this to use `args.host`. I manually tested on Intel macOS 13.7.6 that code-signing still isn't needed there (when downloading using a script). Also documented that you can set `HOST`. ACKs for top commit: m3dwards: ACK 4bb4c86 maflcko: review ACK 4bb4c86 🚏 Tree-SHA512: b4803d39a21cb622fd2388a0528b76d2b502956e2505385d3da201143b0afcf6f9d71c8c28937f27b70d2588fb6da677da058bdcd67b90fb53617acc3a727818
Since bitcoin#31407 guix builds are signed and notarized. This was backported to v28, so bump the version.
I have updated signapple to notarize MacOS app bundles without adding any additional dependencies. Further, it can also sign and apply detached signatures to standalone binaries.
As such, we can use signapple to perform the notarization and stapling steps so that MacOS will run the app bundle after it is installed.
detached-sig-create.sh
is updated to have a notarization step and to download the ticket which will be included in the detached signatures. The workflow is largely unchanged for the MacOS codesigners except for the additional requirement of having an App Store Connect API key and Team UUID, instructions for which can be found at https://github.com/achow101/signapple/blob/master/docs/notarization.md. For guix builders, the workflow is unchanged.Additionally, the standalone binaries packaged in the MacOS
.tar.gz
and Windows.zip
will now be codesigned.detached-sig-create.sh
was updated to handle these, so the workflow for both MacOS and Windows codesigners remains unchanged. For guix builders, the workflow is also unchanged.Because those binaries will how have codesigned and unsigned versions, the build command is modified to output
-unsigned.{tar.gz,zip}
archives containing the binaries. Since this happens to conflict with the tarball used for codesigning, the codesigning tarball was renamed to-codesigning.tar.gz
. Both MacOS and Windows codesigners will need to adjust their workflows to account for the new name.Fixes #15774 and #29749