Skip to content

Add notarization step in the CI #11

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

Merged
merged 6 commits into from
May 13, 2022
Merged

Add notarization step in the CI #11

merged 6 commits into from
May 13, 2022

Conversation

umbynos
Copy link
Contributor

@umbynos umbynos commented May 10, 2022

At the beginning we thought to integrate the key generation inside the arduino-cli, the use of imgtool as a standalone tool was not a requirement. It was later decided to write a guide on how to properly use imgtool in its standalone form. Since the CI does not run notarization for MacOS binaries, the tool is marked with the com.apple.quarantine Xattr on Mac. This can be mitigated by adding The notarization step to the CI.

umbynos added 2 commits May 10, 2022 16:40
…-code the path_name in `gon.config.hcl` file later for notarization
@umbynos umbynos added the topic: infrastructure Related to project infrastructure label May 10, 2022
@umbynos umbynos requested review from ubidefeo and per1234 May 10, 2022 15:34
@umbynos umbynos self-assigned this May 10, 2022
@umbynos
Copy link
Contributor Author

umbynos commented May 10, 2022

Test release here
image

@umbynos umbynos force-pushed the umbynos/notarize branch 3 times, most recently from df0ea94 to 4067470 Compare May 12, 2022 13:22
@umbynos umbynos force-pushed the umbynos/notarize branch 2 times, most recently from 0a3a819 to d6cf82e Compare May 12, 2022 14:21
@umbynos
Copy link
Contributor Author

umbynos commented May 12, 2022

@ubidefeo tested the rc6 and it's working:
image

@umbynos
Copy link
Contributor Author

umbynos commented May 12, 2022

Note for future self:
It was not easy to notarize this binary, mainly because pyinstaller does generate a binary, but actually in a peculiar way: it bundles inside a self extracting archive a stripped version of the python interpreter along with the libs used. The problem with notarization is that every piece needs to be notarized and macOS is particularly picky about it. Another important thing was the entitlements: an Apple way to grant an executable permission to use a service or technology. Thanks to pyinstaller/pyinstaller#4629 I found the correct ones. Without com.apple.security.cs.disable-library-validation The notarized binary was not even starting and was outputting:

[39491] Error loading Python lib '/var/folders/l_/cjj77tdd0g73w_yr33wytwxr0000gn/T/_MEIcDhDer/libpython3.7m.dylib': dlopen: dlopen(/var/folders/l_/cjj77tdd0g73w_yr33wytwxr0000gn/T/_MEIcDhDer/libpython3.7m.dylib, 0x000A): tried: '/var/folders/l_/cjj77tdd0g73w_yr33wytwxr0000gn/T/_MEIcDhDer/libpython3.7m.dylib' (code signature in <8715BA88-05FF-3F36-A118-EF866DA00ED3> '/private/var/folders/l_/cjj77tdd0g73w_yr33wytwxr0000gn/T/_MEIcDhDer/libpython3.7m.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/private/var/folders/l_/cjj77tdd0g73w_yr33wytwxr0000gn/T/_MEIcDhDer/libpython3.7m.dylib' (code signature in <8715BA88-05FF-3F36-A118-EF866DA00ED3> '/private/var/folders/l_/cjj77tdd0g73w_yr33wytwxr0000gn/T/_MEIcDhDer/libpython3.7m.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?))

I tried different things:

  • use -deep notarization (did not work because there is not an .app folder but a single binary)
  • remove the signature from python (because of this)
  • pin python version to 3.7.6 because of this

@per1234
Copy link
Contributor

per1234 commented May 13, 2022

If it hasn't been done already, would one of the team members with a Mac mind double checking the notarization by running this command on the test build? Unfortunately I wasn't able to access a macOS machine to do it myself.

spctl -a -vvv -t install imgtool

@cmaglie
Copy link
Member

cmaglie commented May 13, 2022

👍 LGTM (macOS Monterey 12.3.1 MacBook Air M1 2020)

% ls
LICENSE.txt	imgtool
% spctl -a -vvv -t install imgtool
imgtool: accepted
source=Notarized Developer ID
origin=Developer ID Application: ARDUINO SA (7KT7ZWMCJT)
% ./imgtool 
Usage: imgtool [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  create   Create a signed or unsigned image
  exit     Exit imgtool
  getpriv  Dump private key from keypair
  getpub   Dump public key from keypair
  keygen   Generate pub/private keypair
  sign     Create a signed or unsigned image
  verify   Check that signed image can be verified by given key
  version  Print imgtool version information
% md5 ../imgtool_1.8.0-rc6_macOS_64bit.tar.gz 
MD5 (../imgtool_1.8.0-rc6_macOS_64bit.tar.gz) = e0337e93c8126e401cd4b7aff8cb317e
%

@umbynos umbynos merged commit 4eeba93 into main May 13, 2022
@umbynos umbynos deleted the umbynos/notarize branch May 13, 2022 08:56
@per1234 per1234 added the os: macos Specific to macOS operating system label May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: macos Specific to macOS operating system topic: infrastructure Related to project infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants