Skip to content

Commit 2f64c3e

Browse files
committed
feat: Mac hardened signing on signingscript
1 parent 37634c5 commit 2f64c3e

22 files changed

+443
-48
lines changed

signingscript/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN groupadd --gid 10001 app && \
1111

1212
# Copy only required folders
1313
COPY ["signingscript", "/app/signingscript/"]
14+
COPY ["scriptworker_client", "/app/scriptworker_client/"]
1415
COPY ["configloader", "/app/configloader/"]
1516
COPY ["docker.d", "/app/docker.d/"]
1617
COPY ["vendored", "/app/vendored/"]
@@ -21,17 +22,15 @@ COPY ["version.jso[n]", "/app/"]
2122
# Change owner of /app to app:app
2223
# Install msix
2324
# Install rcodesign
24-
RUN chown -R app:app /app && \
25-
cd /app/signingscript/docker.d && \
26-
bash build_msix_packaging.sh && \
27-
cp msix-packaging/.vs/bin/makemsix /usr/bin && \
28-
cp msix-packaging/.vs/lib/libmsix.so /usr/lib && \
29-
cd .. && \
30-
rm -rf msix-packaging && \
31-
wget -qO- \
32-
https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-x86_64-unknown-linux-musl.tar.gz \
33-
| tar xvz -C /usr/bin --transform 's/.*\///g' --wildcards --no-anchored 'rcodesign' && \
34-
chmod +x /usr/bin/rcodesign
25+
RUN chown -R app:app /app \
26+
&& cd /app/scriptworker_client \
27+
&& pip install /app/scriptworker_client \
28+
&& pip install -r requirements/base.txt \
29+
&& pip install . \
30+
&& cd /app/signingscript/docker.d \
31+
&& bash build_libdmg_hfsplus.sh /usr/bin \
32+
&& bash build_rcodesign.sh /usr/bin \
33+
&& bash build_msix_packaging.sh
3534

3635
# Set user and workdir
3736
USER app
@@ -40,6 +39,7 @@ WORKDIR /app
4039
# Install signingscript + configloader + widevine
4140
RUN python -m venv /app \
4241
&& cd signingscript \
42+
&& /app/bin/pip install /app/scriptworker_client \
4343
&& /app/bin/pip install -r requirements/base.txt \
4444
&& /app/bin/pip install . \
4545
&& python -m venv /app/configloader_venv \
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
$let:
2+
scope_prefix:
3+
$match:
4+
'COT_PRODUCT == "firefox"': 'project:releng:signing:'
5+
'COT_PRODUCT == "thunderbird"': 'project:comm:thunderbird:releng:signing:'
6+
'COT_PRODUCT == "mozillavpn"': 'project:mozillavpn:releng:signing:'
7+
'COT_PRODUCT == "adhoc"': 'project:adhoc:releng:signing:'
8+
in:
9+
$merge:
10+
$match:
11+
'ENV == "prod" && scope_prefix':
12+
'${scope_prefix[0]}cert:release-apple-signing':
13+
- "app_credentials": {"$eval": "APPLE_APP_SIGNING_CREDENTIALS"}
14+
"installer_credentials": {"$eval": "APPLE_INSTALLER_SIGNING_CREDENTIALS"}
15+
"password": {"$eval": "APPLE_SIGNING_CREDS_PASSWORD"}
16+
'ENV != "prod" && scope_prefix':
17+
'${scope_prefix[0]}cert:dep-apple-signing':
18+
- "app_credentials": {"$eval": "APPLE_APP_SIGNING_DEP_CREDENTIALS"}
19+
"installer_credentials": {"$eval": "APPLE_INSTALLER_SIGNING_DEP_CREDENTIALS"}
20+
"password": {"$eval": "APPLE_SIGNING_DEP_CREDS_PASSWORD"}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -x -e -v
3+
4+
# This script is for building libdmg-hfsplus to get the `dmg` and `hfsplus`
5+
# tools for handling DMG archives on Linux.
6+
7+
DEST=$1
8+
if [ -d "$DEST" ]; then
9+
echo "Binaries will be installed to: $DEST"
10+
else
11+
echo "Destination directory doesn't exist!"
12+
exit 1
13+
fi
14+
15+
git clone --depth=1 --branch mozilla --single-branch https://github.com/mozilla/libdmg-hfsplus/ libdmg-hfsplus
16+
17+
pushd libdmg-hfsplus
18+
19+
# The openssl libraries in the sysroot cannot be linked in a PIE executable so we use -no-pie
20+
cmake \
21+
-DOPENSSL_USE_STATIC_LIBS=1 \
22+
-DCMAKE_EXE_LINKER_FLAGS=-no-pie \
23+
.
24+
25+
make VERBOSE=1 -j$(nproc)
26+
27+
# We only need the dmg and hfsplus tools.
28+
strip dmg/dmg hfs/hfsplus
29+
cp dmg/dmg hfs/hfsplus "$DEST"
30+
31+
popd
32+
rm -rf libdmg-hfsplus
33+
echo "Done."

signingscript/docker.d/build_msix_packaging.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ cd msix-packaging
88
./makelinux.sh --pack
99

1010
cd ..
11+
12+
cp msix-packaging/.vs/bin/makemsix /usr/bin
13+
cp msix-packaging/.vs/lib/libmsix.so /usr/lib
14+
15+
rm -rf msix-packaging
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -x -e -v
3+
4+
DEST=$1
5+
if [ -d "$DEST" ]; then
6+
echo "Binaries will be installed to: $DEST"
7+
else
8+
echo "Destination directory doesn't exist!"
9+
exit 1
10+
fi
11+
12+
13+
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 \
14+
| tar xvz -C "$DEST" --transform 's/.*\///g' --wildcards --no-anchored 'rcodesign'
15+
16+
chmod +x "${DEST}/rcodesign"

signingscript/docker.d/init_worker.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ test_var_set 'PROJECT_NAME'
2121
test_var_set 'PUBLIC_IP'
2222
test_var_set 'TEMPLATE_DIR'
2323

24-
export DMG_PATH=$APP_DIR/signingscript/files/dmg
25-
export HFSPLUS_PATH=$APP_DIR/signingscript/files/hfsplus
24+
export DMG_PATH=/usr/bin/dmg
25+
export HFSPLUS_PATH=/usr/bin/hfsplus
2626

2727
export PASSWORDS_PATH=$CONFIG_DIR/passwords.json
2828
export APPLE_NOTARIZATION_CREDS_PATH=$CONFIG_DIR/apple_notarization_creds.json
29+
export APPLE_SIGNING_CONFIG_PATH=$CONFIG_DIR/apple_signing_config.json
2930
export GPG_PUBKEY_PATH=$APP_DIR/signingscript/src/signingscript/data/gpg_pubkey_dep.asc
3031
export WIDEVINE_CERT_PATH=$CONFIG_DIR/widevine.crt
3132
export AUTHENTICODE_TIMESTAMP_STYLE=old
@@ -260,3 +261,4 @@ esac
260261

261262
$CONFIG_LOADER $TEMPLATE_DIR/passwords.yml $PASSWORDS_PATH
262263
$CONFIG_LOADER $TEMPLATE_DIR/apple_notarization_creds.yml $APPLE_NOTARIZATION_CREDS_PATH
264+
$CONFIG_LOADER $TEMPLATE_DIR/apple_signing_creds.yml $APPLE_SIGNING_CONFIG_PATH

signingscript/docker.d/worker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ verbose: { "$eval": "VERBOSE == 'true'" }
44
my_ip: { "$eval": "PUBLIC_IP" }
55
autograph_configs: { "$eval": "PASSWORDS_PATH" }
66
apple_notarization_configs: { "$eval": "APPLE_NOTARIZATION_CREDS_PATH" }
7+
apple_signing_configs: { "$eval": "APPLE_SIGNING_CONFIG_PATH" }
78
taskcluster_scope_prefixes:
89
$flatten:
910
$match:

signingscript/files/README

Lines changed: 0 additions & 3 deletions
This file was deleted.

signingscript/files/dmg

-153 KB
Binary file not shown.

signingscript/files/hfsplus

-104 KB
Binary file not shown.

0 commit comments

Comments
 (0)