-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a4df83
commit 4753f7d
Showing
6 changed files
with
146 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,3 +129,4 @@ test-secret-files.json | |
|
||
# cache | ||
.cache_ggshield | ||
*.msi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
DOWNLOAD_URL=https://one.digicert.com/signingmanager/api-ui/v1/releases/Keylockertools-windows-x64.msi/download | ||
KEYLOCKER_TOOLS_MSI_PATH=Keylockertools-windows-x64.msi | ||
|
||
if command -v smctl.exe > /dev/null ; then | ||
echo "Skipping installation of Keylockertools, smctl is already there" | ||
else | ||
curl \ | ||
-H "x-api-key:$SM_API_KEY" \ | ||
-o "$KEYLOCKER_TOOLS_MSI_PATH" \ | ||
--continue-at - \ | ||
"$DOWNLOAD_URL" | ||
|
||
# double '/' so that Git Bash does not turn them into paths | ||
msiexec //passive //i "$KEYLOCKER_TOOLS_MSI_PATH" | ||
fi | ||
|
||
if ! command -v smctl.exe > /dev/null ; then | ||
echo "smctl.exe not found after installation. Make sure its installation dir is in \$PATH" | ||
exit 1 | ||
fi | ||
|
||
set -x # Log commands before running them | ||
smksp_registrar list | ||
smctl keypair ls | ||
certutil.exe -csp "DigiCert Signing Manager KSP" -key -user | ||
|
||
# Synchronize certificates with Windows certificate store | ||
smctl windows certsync | ||
|
||
smctl healthcheck --tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
WINDOWS_CERT_FINGERPRINT=${WINDOWS_CERT_FINGERPRINT:-} | ||
|
||
windows_add_sign_dependencies() { | ||
REQUIREMENTS="$REQUIREMENTS smctl signtool" | ||
} | ||
|
||
windows_sign() { | ||
check_var WINDOWS_CERT_FINGERPRINT | ||
|
||
# All the SM_* vars are required by smctl | ||
check_var SM_API_KEY | ||
check_var SM_HOST | ||
check_var SM_CLIENT_CERT_FILE | ||
check_var SM_CLIENT_CERT_PASSWORD | ||
|
||
if [ ! -f "$SM_CLIENT_CERT_FILE" ] ; then | ||
die "$SM_CLIENT_CERT_FILE does not exist" | ||
fi | ||
|
||
local archive_dir="$PACKAGES_DIR/$ARCHIVE_DIR_NAME" | ||
smctl sign \ | ||
--verbose \ | ||
--fingerprint "$WINDOWS_CERT_FINGERPRINT" \ | ||
--tool signtool \ | ||
--input "$archive_dir/$INSTALL_PREFIX/ggshield.exe" | ||
} | ||
|