mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
ci(windows): sign releases with Azure Artifact Signing and OIDC
This commit is contained in:
7 files changed
+89
-3
No files matched your search
@@ -0,0 +1,24 @@
|
||||
[CmdletBinding()]
|
||||
param([Parameter(Mandatory=$true)][string[]]$Files)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
foreach ($name in @('AZURE_SIGNING_ENDPOINT', 'AZURE_SIGNING_ACCOUNT', 'AZURE_SIGNING_PROFILE', 'WINDOWS_SIGNING_PUBLISHER')) {
|
||||
if (![Environment]::GetEnvironmentVariable($name)) { throw "Missing signing configuration: $name" }
|
||||
}
|
||||
Import-Module ArtifactSigning -RequiredVersion 0.1.20
|
||||
$credentials = @{
|
||||
ExcludeEnvironmentCredential = $true
|
||||
ExcludeWorkloadIdentityCredential = $true
|
||||
ExcludeManagedIdentityCredential = $true
|
||||
ExcludeSharedTokenCacheCredential = $true
|
||||
ExcludeVisualStudioCredential = $true
|
||||
ExcludeVisualStudioCodeCredential = $true
|
||||
ExcludeAzurePowerShellCredential = $true
|
||||
ExcludeAzureDeveloperCliCredential = $true
|
||||
ExcludeInteractiveBrowserCredential = $true
|
||||
}
|
||||
# Azure CLI holds the short-lived GitHub OIDC login; no client secret is used.
|
||||
Invoke-ArtifactSigning -Endpoint $env:AZURE_SIGNING_ENDPOINT `
|
||||
-CodeSigningAccountName $env:AZURE_SIGNING_ACCOUNT -CertificateProfileName $env:AZURE_SIGNING_PROFILE `
|
||||
-Files ($Files -join ',') -FileDigest SHA256 -TimestampDigest SHA256 `
|
||||
-TimestampRfc3161 'http://timestamp.acs.microsoft.com' -Description 'GP Connect' @credentials
|
||||
& (Join-Path $PSScriptRoot 'test-windows-signature.ps1') -Files $Files -Publisher $env:WINDOWS_SIGNING_PUBLISHER
|
||||
@@ -20,6 +20,13 @@ if ($process.ExitCode -ne 0) {
|
||||
}
|
||||
$info = Get-Content (Join-Path $destination 'build-info.json') -Raw | ConvertFrom-Json
|
||||
if ($info.architecture -ne $Architecture -or [string]$info.build_version -ne $Build) { throw 'The installed package identity does not match.' }
|
||||
if ($env:WINDOWS_SIGNING_PUBLISHER) {
|
||||
$signed = @($Installer)
|
||||
foreach ($name in @('gpgui.exe', 'gpauth.exe', 'gpservice.exe', 'gp-posture.exe', 'libopenconnect-5.dll', 'uninstall.exe')) {
|
||||
$signed += Join-Path $destination $name
|
||||
}
|
||||
& (Join-Path $PSScriptRoot 'test-windows-signature.ps1') -Files $signed -Publisher $env:WINDOWS_SIGNING_PUBLISHER
|
||||
}
|
||||
$service = Get-CimInstance Win32_Service -Filter "Name='GPConnect'"
|
||||
if ($service.State -ne 'Running' -or $service.StartMode -ne 'Auto' -or $service.StartName -ne 'LocalSystem') {
|
||||
throw 'The service did not start automatically as LocalSystem.'
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string[]]$Files,
|
||||
[Parameter(Mandatory=$true)][string]$Publisher
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
foreach ($file in $Files) {
|
||||
$signature = Get-AuthenticodeSignature -LiteralPath $file
|
||||
if ($signature.Status -ne 'Valid') { throw "Invalid Authenticode signature: $file ($($signature.Status))" }
|
||||
$name = $signature.SignerCertificate.GetNameInfo([Security.Cryptography.X509Certificates.X509NameType]::SimpleName, $false)
|
||||
if ($name -ne $Publisher) { throw "Unexpected signing publisher for ${file}: $name" }
|
||||
if (!$signature.TimeStamperCertificate) { throw "Missing signature timestamp: $file" }
|
||||
Write-Host "Verified $file (publisher: $name; timestamped)"
|
||||
}
|
||||
Reference in new issue
Block a user