Commit 8f2ce3e9ae
8f2ce3e9aea5e545a257dab3e7600f258daab10b
parent: b50ce164c2
Verified · cmc
cmc <hello@cleberg.net> · 2026-11-26 15:48 UTC
Embed the Developer ID provisioning profile with a Keychain access group
Changed files (2)
scripts/build-app.sh
+17 −1 · view
| @@ -5,6 +5,8 @@ |
| 5 | 5 | # ORGSTAR_SIGN signing identity; ad hoc ("-") for local use by default. Any other |
| 6 | 6 | # identity also turns on the hardened runtime and a secure timestamp. |
| 7 | 7 | # ORGSTAR_ARCHS architectures, e.g. "arm64 x86_64" for a universal app; this Mac's by default. |
| 8 | # ORGSTAR_PROFILE a Developer ID provisioning profile to embed, with its Keychain access group, |
| 9 | # so passphrases can be kept in the data protection keychain. Needs ORGSTAR_SIGN. |
| 8 | 10 | set -eu |
| 9 | 11 | |
| 10 | 12 | cd "$(dirname "$0")/.." |
| @@ -248,13 +250,27 @@ for item in "$fw/XPCServices/Installer.xpc" "$fw/XPCServices/Downloader.xpc" "$f |
| 248 | 250 | done |
| 249 | 251 | |
| 250 | 252 | # The hardened runtime needs Calendar access declared for the agenda's events. |
| 253 | keychain="" |
| 254 | if [ -n "${ORGSTAR_PROFILE:-}" ]; then |
| 255 | [ "$sign" != "-" ] || { echo "ORGSTAR_PROFILE needs ORGSTAR_SIGN." >&2; exit 1; } |
| 256 | cp "$ORGSTAR_PROFILE" "$app/Contents/embedded.provisionprofile" |
| 257 | security cms -D -i "$ORGSTAR_PROFILE" -o "$work/profile.plist" |
| 258 | team="$(/usr/libexec/PlistBuddy -c 'Print :Entitlements:com.apple.developer.team-identifier' "$work/profile.plist")" |
| 259 | keychain=" |
| 260 | <key>com.apple.application-identifier</key> |
| 261 | <string>$team.sh.krz.orgstar</string> |
| 262 | <key>com.apple.developer.team-identifier</key> |
| 263 | <string>$team</string> |
| 264 | <key>keychain-access-groups</key> |
| 265 | <array><string>$team.sh.krz.orgstar</string></array>" |
| 266 | fi |
| 251 | 267 | cat > "$work/app.entitlements" <<PLIST |
| 252 | 268 | <?xml version="1.0" encoding="UTF-8"?> |
| 253 | 269 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 254 | 270 | <plist version="1.0"> |
| 255 | 271 | <dict> |
| 256 | 272 | <key>com.apple.security.personal-information.calendars</key> |
| 257 | | <true/> |
| 273 | <true/>$keychain |
| 258 | 274 | </dict> |
| 259 | 275 | </plist> |
| 260 | 276 | PLIST |
scripts/release-mac.sh
+3 −1 · view
| @@ -28,6 +28,8 @@ files="${ORGSTAR_FILES:-homelab:/var/www/files/orgstar}" |
| 28 | 28 | publish="${ORGSTAR_PUBLISH:-1}" |
| 29 | 29 | sign="${ORGSTAR_SIGN:-$(security find-identity -v -p codesigning | sed -n 's/.*"\(Developer ID Application: .*\)"/\1/p' | head -1)}" |
| 30 | 30 | [ -n "$sign" ] || { echo "No Developer ID Application identity in the keychain." >&2; exit 1; } |
| 31 | profile="${ORGSTAR_PROFILE:-$HOME/Library/MobileDevice/Provisioning Profiles/orgstar_dev_id.provisionprofile}" |
| 32 | [ -f "$profile" ] || { echo "No Developer ID provisioning profile at $profile." >&2; exit 1; } |
| 31 | 33 | ! grep -q 'publicKey = .*// placeholder' Sources/OrgApp/LicenseKey.swift || |
| 32 | 34 | { echo "Run packaging/license-issuer/keygen.sh first: the license public key is a placeholder." >&2; exit 1; } |
| 33 | 35 | # The Sparkle public key; its private half is in the release Mac's login keychain (generate_keys). |
| @@ -46,7 +48,7 @@ ORGSTAR_GATES=1 swift test -c release --filter GateTests || { echo "A performanc |
| 46 | 48 | |
| 47 | 49 | # The build number counts commits, so each release's is higher than the last's. |
| 48 | 50 | build="$(git rev-list --count HEAD)" |
| 49 | | ORGSTAR_SIGN="$sign" ORGSTAR_ARCHS="arm64 x86_64" sh scripts/build-app.sh "$version" "$build" > /dev/null |
| 51 | ORGSTAR_SIGN="$sign" ORGSTAR_PROFILE="$profile" ORGSTAR_ARCHS="arm64 x86_64" sh scripts/build-app.sh "$version" "$build" > /dev/null |
| 50 | 52 | app=".build/app/orgstar.app" |
| 51 | 53 | codesign --verify --strict --deep "$app" |
| 52 | 54 | |