Skip to content

Commit 41fc4b1

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 7ec0116 + 3e57ca8 commit 41fc4b1

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

mac/build-dmg.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ fi
5959

6060
# Sign the app
6161
function sign_mac_version() {
62-
# This function expects that following environment varialbes are available:
62+
# This function expects that following environment variables are available:
6363
# - PHARO_CERT_PASSWORD
6464
# - PHARO_SIGN_IDENTITY
65-
local key_chain=macos-build.keychain
65+
local keychain_name=macos-ci-build.keychain
66+
local keychain_password=ci
6667
local app_dir=$1
6768
local cert_pass=${PHARO_CERT_PASSWORD}
6869
local pharo_sign_password=${PHARO_CERT_PASSWORD}
@@ -79,23 +80,30 @@ function sign_mac_version() {
7980

8081
echo "Signing app bundle..."
8182
# Set up keychain
82-
security delete-keychain "${key_chain}" || true
83-
security create-keychain -p ci "${key_chain}"
84-
security default-keychain -s "${key_chain}"
85-
security unlock-keychain -p ci "${key_chain}"
86-
security set-keychain-settings -t 3600 -u "${key_chain}"
87-
security import "${path_cer}" -k ~/Library/Keychains/"${key_chain}" -T /usr/bin/codesign
88-
security import "${path_p12}" -k ~/Library/Keychains/"${key_chain}" -P "${cert_pass}" -T /usr/bin/codesign
83+
security delete-keychain "${keychain_name}" || true
84+
security create-keychain -p ${keychain_password} "${keychain_name}"
85+
# add keychain to the search list
86+
security list-keychains -d user -s "${keychain_name}"
87+
security default-keychain -s "${keychain_name}"
88+
security unlock-keychain -p ${keychain_password} "${keychain_name}"
89+
security set-keychain-settings -t 3600 -u "${keychain_name}"
90+
# Importing certificate
91+
security import "${path_cer}" -k ~/Library/Keychains/"${keychain_name}" -T /usr/bin/codesign
92+
# Importing identity
93+
security import "${path_p12}" -k ~/Library/Keychains/"${keychain_name}" -P "${cert_pass}" -T /usr/bin/codesign
94+
# Set ACL on keychain. To avoid to get codesign to yield an errSecInternalComponent you need to get the partition list (ACLs) correct.
95+
# See https://code-examples.net/en/q/1344e6a
96+
security set-key-partition-list -S apple-tool:,apple: -s -k ${keychain_password} "${keychain_name}"
8997
# debug
9098
echo ${sign_identity} >> "id.txt"
9199
# Invoke codesign
92100
if [[ -d "${app_dir}/Contents/MacOS/Plugins" ]]; then # Pharo.app does not (yet) have its plugins in Resources dir
93-
codesign -s "${sign_identity}" --keychain "${key_chain}" --force --deep "${app_dir}/Contents/MacOS/Plugins/"*
101+
codesign -s "${sign_identity}" --keychain "${keychain_name}" --force --deep "${app_dir}/Contents/MacOS/Plugins/"*
94102
fi
95-
codesign -s "${sign_identity}" --keychain "${key_chain}" --force --deep "${app_dir}"
103+
codesign -s "${sign_identity}" --keychain "${keychain_name}" --force --deep "${app_dir}"
96104
# Remove sensitive files again
97105
rm -rf "${path_cer}" "${path_p12}"
98-
security delete-keychain "${key_chain}"
106+
security delete-keychain "${keychain_name}"
99107
}
100108

101109
if [ "$SHOULD_SIGN" = true ] ; then

signing/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ openssl aes-256-cbc -k "${pharo_sign_password}" -in pharo-windows-certificate.p1
4747
The password needed to decrypt them will be stored in an environment variable (secured) on the CI tool (travis or Jenkins).
4848
4949
# How to sign on OS X?
50+
Some links:
51+
- [macOS Code Signing In Depth](https://developer.apple.com/library/archive/technotes/tn2206/_index.html)
52+
- [Distribute outside the Mac App Store (macOS)](https://help.apple.com/xcode/mac/current/#/dev033e997ca)
53+
- [Troubleshooting Failed Signature Verification](https://developer.apple.com/library/archive/technotes/tn2318/_index.html#//apple_ref/doc/uid/DTS40013777-CH1-TNTAG2)
54+
- [security / codesign in Sierra: Keychain ignores access control settings and UI-prompts for permission](https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p/41220140#41220140)
55+
56+
5057
You need to use codesign (shipped with Xcode):
5158
```
5259
codesign -s "${sign_identity}" --keychain "${key_chain}" --force --deep "${app_dir}/Contents/MacOS/Plugins/"*

0 commit comments

Comments
 (0)