-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: Mac hardened signing on signingscript #872
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$let: | ||
scope_prefix: | ||
$match: | ||
'COT_PRODUCT == "firefox"': 'project:releng:signing:' | ||
'COT_PRODUCT == "thunderbird"': 'project:comm:thunderbird:releng:signing:' | ||
'COT_PRODUCT == "mozillavpn"': 'project:mozillavpn:releng:signing:' | ||
'COT_PRODUCT == "adhoc"': 'project:adhoc:releng:signing:' | ||
in: | ||
$merge: | ||
$match: | ||
'ENV == "prod" && scope_prefix': | ||
'${scope_prefix[0]}cert:release-signing': | ||
- "app_pkcs12_bundle": {"$eval": "APPLE_APP_SIGNING_PKCS12"} | ||
"installer_pkcs12_bundle": {"$eval": "APPLE_INSTALLER_SIGNING_PKCS12"} | ||
"pkcs12_password": {"$eval": "APPLE_SIGNING_PKCS12_PASSWORD"} | ||
'${scope_prefix[0]}cert:nightly-signing': | ||
- "app_pkcs12_bundle": {"$eval": "APPLE_APP_SIGNING_PKCS12"} | ||
"installer_pkcs12_bundle": {"$eval": "APPLE_INSTALLER_SIGNING_PKCS12"} | ||
"pkcs12_password": {"$eval": "APPLE_SIGNING_PKCS12_PASSWORD"} | ||
'ENV != "prod" && scope_prefix': | ||
'${scope_prefix[0]}cert:dep-signing': | ||
- "app_pkcs12_bundle": {"$eval": "APPLE_APP_SIGNING_DEP_PKCS12"} | ||
"installer_pkcs12_bundle": {"$eval": "APPLE_INSTALLER_SIGNING_DEP_PKCS12"} | ||
"pkcs12_password": {"$eval": "APPLE_SIGNING_DEP_PKCS12_PASSWORD"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -x -e -v | ||
|
||
# This script is for building libdmg-hfsplus to get the `dmg` and `hfsplus` | ||
# tools for handling DMG archives on Linux. | ||
|
||
DEST=$1 | ||
if [ -d "$DEST" ]; then | ||
echo "Binaries will be installed to: $DEST" | ||
else | ||
echo "Destination directory doesn't exist!" | ||
exit 1 | ||
fi | ||
|
||
git clone --depth=1 --branch mozilla --single-branch https://github.com/mozilla/libdmg-hfsplus/ libdmg-hfsplus | ||
|
||
pushd libdmg-hfsplus | ||
|
||
# The openssl libraries in the sysroot cannot be linked in a PIE executable so we use -no-pie | ||
cmake \ | ||
-DOPENSSL_USE_STATIC_LIBS=1 \ | ||
-DCMAKE_EXE_LINKER_FLAGS=-no-pie \ | ||
. | ||
|
||
make VERBOSE=1 -j$(nproc) | ||
|
||
# We only need the dmg and hfsplus tools. | ||
strip dmg/dmg hfs/hfsplus | ||
cp dmg/dmg hfs/hfsplus "$DEST" | ||
|
||
popd | ||
rm -rf libdmg-hfsplus | ||
echo "Done." |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,8 @@ cd msix-packaging | |
./makelinux.sh --pack | ||
|
||
cd .. | ||
|
||
cp msix-packaging/.vs/bin/makemsix /usr/bin | ||
cp msix-packaging/.vs/lib/libmsix.so /usr/lib | ||
|
||
rm -rf msix-packaging | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: thank you for cleaning up the left I mess here :) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -x -e -v | ||
|
||
DEST=$1 | ||
if [ -d "$DEST" ]; then | ||
echo "Binaries will be installed to: $DEST" | ||
else | ||
echo "Destination directory doesn't exist!" | ||
exit 1 | ||
fi | ||
|
||
|
||
wget -qO- https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.26.0/apple-codesign-0.26.0-x86_64-unknown-linux-musl.tar.gz \ | ||
| tar xvz -C "$DEST" --transform 's/.*\///g' --wildcards --no-anchored 'rcodesign' | ||
|
||
chmod +x "${DEST}/rcodesign" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "version.txt")) as f: | ||
version = f.read().rstrip() | ||
|
||
install_requires = ["arrow", "mar", "scriptworker", "taskcluster", "mohawk", "winsign", "macholib"] | ||
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "requirements", "base.in")) as f: | ||
install_requires = ["scriptworker_client"] + f.readlines() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: thank you for updating/fixing this! |
||
|
||
setup( | ||
name="signingscript", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import logging | ||
import os | ||
from shutil import copy2 | ||
|
||
from signingscript.exceptions import SigningScriptError | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
PROVISIONING_PROFILE_FILENAMES = { | ||
"firefox": "orgmozillafirefox.provisionprofile", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (non-blocking): this might be better off living in a config somewhere |
||
"devedition": "orgmozillafirefoxdeveloperedition.provisionprofile", | ||
"nightly": "orgmozillanightly.provisionprofile", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. todo: Only one of these files exists. The others should either by added, or commented out for now. (We'll get error messages about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the missing files |
||
} | ||
|
||
|
||
def copy_provisioning_profiles(bundlepath, configs): | ||
"""Copy provisioning profiles inside bundle | ||
Args: | ||
bundlepath (str): The absolute path to the app bundle | ||
configs (list): The list of configs with schema [{"profile_name": str, "target_path": str}] | ||
""" | ||
for cfg in configs: | ||
profile_name = cfg.get("profile_name") | ||
target_path = cfg.get("target_path") | ||
if not profile_name or not target_path: | ||
raise SigningScriptError(f"profile_name and target_path are required. Got: {cfg}") | ||
|
||
if profile_name not in PROVISIONING_PROFILE_FILENAMES.values(): | ||
raise SigningScriptError(f"profile_name not allowed: {profile_name}") | ||
|
||
profile_path = os.path.join(os.path.dirname(__file__), "data", profile_name) | ||
if not os.path.exists(profile_path): | ||
raise SigningScriptError(f"Provisioning profile not found: {profile_name}") | ||
|
||
# Resolve absolute destination path | ||
target_abs_path = os.path.join(bundlepath, target_path if target_path[0] != "/" else target_path[1:]) | ||
if os.path.exists(target_abs_path): | ||
log.warning("Provisioning profile at {target_path} already exists, overriding.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Do we know that overriding an existing provisioning profile is always the right thing to do? Are there even any cases where we expect one in a bundle already, or would that be indicative of a problem further up the chain? Either way, thank you for logging this explicitly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under normal scenarios it shouldn't happen. But when testing things, this makes sure the profile is always "what it should be". |
||
|
||
log.info(f"Copying {profile_name} to {target_abs_path}") | ||
copy2(profile_path, target_abs_path) |
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.
question: why are we installing scriptworker_client twice? (and its related requirements). If this is not necessary, please remove it from the above block.
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 meant to remove it from the block above since it has no effect whatsoever (root user)