Skip to content

Commit cff1aa2

Browse files
authored
Migrate Windows code signing to Azure Trusted Signing (#2910)
## Summary Migrates Windows binary signing from Azure Key Vault (`jsign --storetype AZUREKEYVAULT`) to [Azure Trusted Signing](https://learn.microsoft.com/en-us/azure/trusted-signing/). The previous AKV code-signing cert expired, breaking the release pipeline. Trusted Signing issues short-lived Microsoft-managed certs so there's nothing to rotate. - `Makefile` / `scripts/crossbuild.mk`: bump `jsign` 6.0 → 7.4, switch `--storetype` to `TRUSTEDSIGNING`, use the `https://codesigning.azure.net` token audience, derive the keystore host from `AZURE_SIGNING_ACCOUNT_ENDPOINT`, pass account/profile via `--alias`, update the `SKIP_SIGNING` guard and error message. - `.github/workflows/{build,release,prerelease,build_provider}.yml`: replace the `AZURE_SIGNING_KEY_VAULT_URI` env passthrough with the three new `AZURE_SIGNING_ACCOUNT_*` outputs and update the `SKIP_SIGNING` expression. Companion to pulumi/ci-mgmt#2126, pulumi/pulumi-command#1200, and pulumi/pulumi-provider-boilerplate#1236. The ESC environment already exposes the new variables and the signing SP has the `Artifact Signing Certificate Profile Signer` role on the `pulumi-code-signing/pulumi-code-signing` profile. Verified end-to-end against pulumi-command, pulumi-random, and pulumi-provider-boilerplate. ## Test plan - [ ] CI release build produces a Windows binary with a valid Trusted Signing certificate chain
2 parents 855d0bd + 7e1612e commit cff1aa2

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

Makefile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,29 +206,31 @@ ref-db-report::
206206

207207
.PHONY: ensure prepare_local_workspace generate_schema generate provider build test_provider_fast verify
208208

209-
# Set these variables to enable signing of the windows binary
209+
# Set these variables to enable signing of the windows binary with Azure Trusted Signing.
210210
AZURE_SIGNING_CLIENT_ID ?=
211211
AZURE_SIGNING_CLIENT_SECRET ?=
212212
AZURE_SIGNING_TENANT_ID ?=
213-
AZURE_SIGNING_KEY_VAULT_URI ?=
213+
AZURE_SIGNING_ACCOUNT_ENDPOINT ?=
214+
AZURE_SIGNING_ACCOUNT_NAME ?=
215+
AZURE_SIGNING_CERT_PROFILE_NAME ?=
214216
SKIP_SIGNING ?=
215217

216-
bin/jsign-6.0.jar:
217-
wget https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar --output-document=bin/jsign-6.0.jar
218+
bin/jsign-7.4.jar:
219+
wget https://github.com/ebourg/jsign/releases/download/7.4/jsign-7.4.jar --output-document=bin/jsign-7.4.jar
218220

219221
sign-goreleaser-exe-amd64: GORELEASER_ARCH := amd64_v1
220222
sign-goreleaser-exe-arm64: GORELEASER_ARCH := arm64
221223

222224
# Set the shell to bash to allow for the use of bash syntax.
223225
sign-goreleaser-exe-%: SHELL:=/bin/bash
224-
sign-goreleaser-exe-%: bin/jsign-6.0.jar
226+
sign-goreleaser-exe-%: bin/jsign-7.4.jar
225227
@# Only sign windows binary if fully configured.
226228
@# Test variables set by joining with | between and looking for || showing at least one variable is empty.
227229
@# Move the binary to a temporary location and sign it there to avoid the target being up-to-date if signing fails.
228230
@set -e; \
229231
if [[ "${SKIP_SIGNING}" != "true" ]]; then \
230-
if [[ "|${AZURE_SIGNING_CLIENT_ID}|${AZURE_SIGNING_CLIENT_SECRET}|${AZURE_SIGNING_TENANT_ID}|${AZURE_SIGNING_KEY_VAULT_URI}|" == *"||"* ]]; then \
231-
echo "Can't sign windows binaries as required configuration not set: AZURE_SIGNING_CLIENT_ID, AZURE_SIGNING_CLIENT_SECRET, AZURE_SIGNING_TENANT_ID, AZURE_SIGNING_KEY_VAULT_URI"; \
232+
if [[ "|${AZURE_SIGNING_CLIENT_ID}|${AZURE_SIGNING_CLIENT_SECRET}|${AZURE_SIGNING_TENANT_ID}|${AZURE_SIGNING_ACCOUNT_ENDPOINT}|${AZURE_SIGNING_ACCOUNT_NAME}|${AZURE_SIGNING_CERT_PROFILE_NAME}|" == *"||"* ]]; then \
233+
echo "Can't sign windows binaries as required configuration not set: AZURE_SIGNING_CLIENT_ID, AZURE_SIGNING_CLIENT_SECRET, AZURE_SIGNING_TENANT_ID, AZURE_SIGNING_ACCOUNT_ENDPOINT, AZURE_SIGNING_ACCOUNT_NAME, AZURE_SIGNING_CERT_PROFILE_NAME"; \
232234
echo "To rebuild with signing delete the unsigned windows exe file and rebuild with the fixed configuration"; \
233235
if [[ "${CI}" == "true" ]]; then exit 1; fi; \
234236
else \
@@ -239,12 +241,15 @@ sign-goreleaser-exe-%: bin/jsign-6.0.jar
239241
--password "${AZURE_SIGNING_CLIENT_SECRET}" \
240242
--tenant "${AZURE_SIGNING_TENANT_ID}" \
241243
--output none; \
242-
ACCESS_TOKEN=$$(az account get-access-token --resource "https://vault.azure.net" | jq -r .accessToken); \
243-
java -jar bin/jsign-6.0.jar \
244-
--storetype AZUREKEYVAULT \
245-
--keystore "PulumiCodeSigning" \
246-
--url "${AZURE_SIGNING_KEY_VAULT_URI}" \
244+
ACCESS_TOKEN=$$(az account get-access-token --resource "https://codesigning.azure.net" | jq -r .accessToken); \
245+
ENDPOINT_HOST="$${AZURE_SIGNING_ACCOUNT_ENDPOINT#https://}"; \
246+
ENDPOINT_HOST="$${ENDPOINT_HOST#http://}"; \
247+
ENDPOINT_HOST="$${ENDPOINT_HOST%/}"; \
248+
java -jar bin/jsign-7.4.jar \
249+
--storetype TRUSTEDSIGNING \
250+
--keystore "$${ENDPOINT_HOST}" \
247251
--storepass "$${ACCESS_TOKEN}" \
252+
--alias "${AZURE_SIGNING_ACCOUNT_NAME}/${AZURE_SIGNING_CERT_PROFILE_NAME}" \
248253
$${file}.unsigned; \
249254
mv $${file}.unsigned $${file}; \
250255
az logout; \

0 commit comments

Comments
 (0)