Skip to content
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

Please sign and notarize macOS app #686

Closed
mfilippov opened this issue Jun 2, 2023 · 28 comments · Fixed by #842
Closed

Please sign and notarize macOS app #686

mfilippov opened this issue Jun 2, 2023 · 28 comments · Fixed by #842
Assignees
Labels

Comments

@mfilippov
Copy link
Contributor

I can't run macOS app I got message:

ASP: Security policy would not allow process: 39917, /Applications/StructuredLogViewer.app/Contents/MacOS/StructuredLogViewer.Avalonia
@KirillOsenkov
Copy link
Owner

I don’t know how to do that.

@mfilippov
Copy link
Contributor Author

mfilippov commented Jun 2, 2023

This GitHub action contains example of app sign and notarization https://github.com/marketplace/actions/xcode-notarization

@hez2010
Copy link

hez2010 commented Jun 14, 2023

To acquire the ApiKey used in app sign, developers must pay $99 per year to Apple. I don't think it is feasible for a free open-source project.
I would instead recommend you sign the app by yourself using a self-issued certificate.

@KirillOsenkov
Copy link
Owner

I did buy a Comodo code signing certificate to sign Windows .exes here:
https://comodosslstore.com/code-signing/comodo-individual-code-signing-certificate

Could I use that to sign or is that not applicable on Mac?

@KirillOsenkov
Copy link
Owner

I also have a SignPath certificate for open source projects provided by SignPath. Wondering if I can use that?

@SabotageAndi would you know?

@mfilippov
Copy link
Contributor Author

No, for macOS sign, you need Apple Developer Subscription. It is also required to publish an app to the macOS AppStore. I have this subscription. I could publish this app as a free app from my subscription if it is suitable for you.

@KirillOsenkov
Copy link
Owner

That would be nice, thanks for the offer!

@mfilippov
Copy link
Contributor Author

Cool I will try. The version v2.1.820 crashed on macOS.

@jwosty
Copy link

jwosty commented Oct 4, 2023

This is the only thing preventing distribution via Homebrew: Homebrew/homebrew-cask#156909 (comment)

In the meantime, I've put the cask in a third party repo (https://github.com/jwosty/homebrew-structuredlogviewer), so you can install it like so brew install --cask jwosty/structuredlogviewer/structuredlogviewer

@KirillOsenkov KirillOsenkov self-assigned this Sep 2, 2024
@maxkatz6
Copy link
Contributor

maxkatz6 commented Dec 14, 2024

@KirillOsenkov I can help with sign and notarize scripts for this task. But it requires some preparation from you with apple dev account.
Previously I did that for self-hosted macOS virtual machines, but it should work on public github machines too (need to deal with certificate export).

More or less comprehensive list of what needs to be prepared on macOS machine owned by you:

  1. Create Apple Developer account.
  2. Create "Developer ID Application" certificate on https://developer.apple.com/account/resources/certificates/list page.
    2.1. It will ask you to create a Certificate Signing Request, this page explains how https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request/
    2.2. Download and install created certificate.
    2.3. Note, this also will bound this certificate to your machine. We will need workaround that later.
  3. Create app identifier on https://developer.apple.com/account/resources/identifiers/list
    3.1. Right now, you have "structuredlogviewer" as an app identifier. I am not sure if it's a valid one, probably "com.MSBuildStructuredLog" will be necessary. Either way, apple dashboard should let you know if ID is invalid or not.
  4. (Optional) With certificate and id it's possible to create Provisioning Profile on the same page. It doesn't seem to be necessary now (I had signing and notarizing done successfully without it), but it likely will be soon.
  5. Export certificate from your machine and protect it with password: https://stackoverflow.com/questions/14954074/export-development-certificate-as-p12.
  6. Copy p12 certificate and provisioning profile to the git. Note: it might be a good idea to additionally encrypt p12 cert.
  7. Prepare CI secrets:
    7.1. p12 password(s)
    7.2. Your apple dev-account email and password. Password needs to be an app-specific password https://support.apple.com/en-us/102654

And changes to the build script that needs to be made (can be done by anybody, as it doesn't require apple dev account access at this point). All of these steps below can be automated in the script for each build:

  1. Install p12 certificate using certificate file and secrets.
  2. Include provisioning profile with app bundle.
  3. Sign binaries with Apple cert and proper identity.
  4. Zip bundle, upload it for notarization, wait (can be couple of minutes, but can be days, especially for the first run and JIT apps).
  5. Done. Creating a "dmg" file would be a nice addition.

Hopefully I am not missing anything.

@KirillOsenkov
Copy link
Owner

OK I'll try to find time for this soon, thanks!

@KirillOsenkov
Copy link
Owner

LOL I heard Apple hates developers, this sure looks like a good start:

image

Apparently I need to enroll from the web?

@KirillOsenkov
Copy link
Owner

I am now on Step 6: Copy p12 certificate and provisioning profile to the git. Note: it might be a good idea to additionally encrypt p12 cert.

I have the .p12 file and it's protected with a password. Where do I put it now? How do I encrypt it? I assume I can't make this file public, right?

@jwosty
Copy link

jwosty commented Dec 15, 2024

@KirillOsenkov I think a GitHub action secret?

@KirillOsenkov
Copy link
Owner

OK, I created three Repository secrets under Actions. Where do I put the p12 file and how do I additionally encrypt it?

@KirillOsenkov
Copy link
Owner

I used com.msbuildlog.viewer for the App ID

@maxkatz6
Copy link
Contributor

Yeah, storing p12 file as a base64 secret should be good.

@KirillOsenkov
Copy link
Owner

OK, I made the following 4 secrets:

APPLE_ID_EMAIL
APPLE_ID_PASSWORD
P12_BASE64
P12_PASSWORD

@KirillOsenkov
Copy link
Owner

Some helpful info in the two issues I linked above ^^

@maxkatz6
Copy link
Contributor

@KirillOsenkov started PR here #842

I also think TeamID might be necessary in the signing and notarizing. You can include that in the secrets too: https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/

And to be safe, let's add certificate name to the secrets too.
In the PR, I used "Developer ID Application" for now, but full name would be safer, such as "Developer ID Application: KirillOsenkov (TeamID)" (you can find it in the keychain).

@maxkatz6 maxkatz6 mentioned this issue Dec 15, 2024
7 tasks
@KirillOsenkov
Copy link
Owner

OK I added the APPLE_TEAM_ID secret.

I'm not at my Mac right now, so I can't lookup the exact certificate name in the Keychain. On the web it says:

image

@KirillOsenkov
Copy link
Owner

I added APPLE_CERT_NAME with the value Developer ID Application: Kirill Osenkov (XXXXXXXXXX) where XXXXXXXXXX is the Team ID. Note the space between my first and last name. When I get to my Mac I'll double check and edit if necessary.

@maxkatz6
Copy link
Contributor

maxkatz6 commented Dec 15, 2024

@KirillOsenkov that should be enough, thanks. Now need to figure out how to access these secrets from appveyor.
Or did you add these to github secrets instead? I don't mind switching to GitHub CI, just need to know your preference here.

@KirillOsenkov
Copy link
Owner

Oh, I added them to GitHub Actions, I can add to AppVeyor too. Sorry it wasn't clear. Will have to be a bit later though.

@KirillOsenkov
Copy link
Owner

Oh, and to clarify, I'm fine with either AppVeyor or GitHub Actions for the Mac signing+notarization. I'd like to keep the existing logic in AppVeyor (because of the SignPath integration and I'm used to it), but for Mac we can do either, whatever works for you.

@maxkatz6
Copy link
Contributor

@KirillOsenkov I don't have issues with AppVeyor. But you probably would need to push encrypted secrets into YAML file.
Either as https://ci.appveyor.com/tools/encrypt (variable) or https://www.appveyor.com/docs/how-to/secure-files/ (files).

@KirillOsenkov
Copy link
Owner

OK here you go:

environment:
  APPLE_ID_EMAIL:
    secure: RKmcmSlBIe+qymOfMJR9U9Q2axndE5FnQWJrHIm/ZJM=
  APPLE_ID_PASSWORD:
    secure: Xqa3m49/axGFkH9nr8zZRLgMbFzY3rUUsRCXRxPt4B8=
  P12_BASE64:
    secure: /hGeW9O9NZcjS2lTp85JwPeEIrABJ05BOa4VXp8HwYh0FOWuk8wjc4ahloCtBUWfa5QorE04xUvKtdpq9/RCQy9WIQnpHBGeFvoYGKF/4vEfqf3bU7epKwV2tFWqhKDNPGoG/pNL0pxBiabTxbom6zMzVIoLk6ZwDyYdD4+956896Ai/OdLWrrC4ga1HzuSZnu4fEW3iADnYkLtot3VGCkPZQvaswcGie510abmuy3mq/fdFxkCXoE6hD4Zqw1QArHL+1iH9R7mHChA88BDaKc12uacxmPRrwfb5aouq7xtqHAVZa/S330rULQ3QTKwHCpLfdUOJpOHIWK35Uj6zHmiU98pXUsgEVw79Qk0USHTz4B6undSadM7ajgM7h/6aWAbyuSu8O6upuBWfA1Ql7xVUyQDEd1ueTZhAMB8qDd0OME70b/vb8vKnNKkAHnQ819Hz1iYbzNMU5VK4JdI59yKf3ZEC1P42mRVCwlzKfhjrtvhB+gHUzvtwdcyFbf/4CDFp6kidoboCY/A7ffURm0rsKlZ1khsx6AGlbTpIOhZMqQw0zJ7oV0YnFFjbhV0sZRO+96lUB9JTBe9dnIGO8UjiSG1nAvB99k6ruz/IvUWWM1Oqp4zvi8MpNPrYeHRV2QUHjoCjLb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uOt7iomu44k+AxLRreObJKqjQG2rH39lsg/uu3TQSv4fDJNas0vn9lcmVz6LyErPyJzEr1w37X5oXQyD316jebvF8U7mUOsOqmsRZs8s2GERxYKzdxEWzkkHkugz8VnV9lWvpeJGZq0K3l1wwC1rtZ0pviXNyWmdZEJcVOvsZcOJ+pcI4SOzJNT8kPIbnHtgQ1gImmkzITopLByR+DLFbU/vQekLXo5D4iVDWFVti7AA/8rPybPpwJzGyIlAAstnk804lQrL3DbWEw/+5ATJOSHc9DMRy/V+/gzW6uANZWYtJNRmFd9EgzDDn49WNyLsSjNoDj8UIpNZE3CgTr9L7Ndbt57aWRoYCJBucZytENIs8+bS8Tx+xxRZ6FgjsxxlQKY8xKvnSaAJ6bBjAxqS2JoE49vQ6AQ0MT82VuwXQVwCxmlNcU41fMj9YhyaoDTfcRwFeX832ehMKEwdQU7tJLiI5O186FdKgVMcM6cqP5QC22YJ0Ll5yutMFpaIml++KFdYXlcSG6p77gNuw4skYPvGc+MlpgtzrCqQx+raYVS97uMhp5Ogn7PilBkROz3Yku36m7OFr7muX8I8hN2kpCapy+JJPVHsGuGap284ulRdCRByUTL5z1Alk7zICs1FhI3XLMAgellQIZnIOBw3xgtRd6uTbPUFW2y71ncAwyb1yHAUlEXETR0tignKTahxYrz6Gk8CNEmSggHSSjegtnwH0A763SU6OT124MbBms/F6cjvtduhozh0YMx/1hJ2efv/3Kk+FXnveHgKV7trtZ0g5cw5JzPoFuLTS1aZzDeohjTPMamXymFpCiIoUs9RwdfjWPFmSwsWUhLqigE1LoM40=
  P12_PASSWORD:
    secure: g9nZcXsjCU8Ogsic6sO45hYJI1sMG/Psw4bes9yknMo=
  APPLE_TEAM_ID:
    secure: AnEDLgBUDM9+UAdcIOrMLQ==
  APPLE_CERT_NAME:
    secure: QWdxOY0xIK4XR50AYb77TKCmMd2k00iEBfrYYxzhwM+pDyvSjQXO6Oqg1epfe0KRpZNc+a9cGwCJ8qMyCEQxsA==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants