Create Pull Request
| Date | Scan | Status | Result |
|---|---|---|---|
| 2025-07-12 23:44 | #41 | cancelled |
Biased
|
| 2025-07-12 00:58 | #8 | cancelled |
Clean
|
| 2025-07-10 05:06 | #7 | processing |
Clean
|
# How to create a self sign cert and use it to sign Machine Configuration
# custom policy package
# Create Code signing cert
$codeSigningParams = @{
Type = 'CodeSigningCert'
DnsName = 'GCEncryptionCertificate'
HashAlgorithm = 'SHA256'
}
$certificate = New-SelfSignedCertificate @codeSigningParams
# Export the certificates
$privateKey = @{
Cert = $certificate
Password = Read-Host "Enter password for private key" -AsSecureString
FilePath = '<full-path-to-export-private-key-pfx-file>'
}
$publicKey = @{
Cert = $certificate
FilePath = '<full-path-to-export-public-key-cer-file>'
Force = $true
}
Export-PfxCertificate @privateKey
Export-Certificate @publicKey
# Import the certificate
$importParams = @{
FilePath = $privateKey.FilePath
Password = $privateKey.Password
CertStoreLocation = 'Cert:\LocalMachine\My'
}
Import-PfxCertificate @importParams
# Sign the policy package
$certToSignThePackage = Get-ChildItem -Path Cert:\LocalMachine\My |
Where-Object { $_.Subject -eq "CN=GCEncryptionCertificate" }
$protectParams = @{
Path = '<path-to-package-to-sign>'
Certificate = $certToSignThePackage
Verbose = $true
}
Protect-GuestConfigurationPackage @protectParams
# generate gpg key
gpg --gen-key
$emailAddress = '<email-id-used-to-generate-gpg-key>'
$publicGpgKeyPath = '<full-path-to-export-public-key-gpg-file>'
$privateGpgKeyPath = '<full-path-to-export-private-key-gpg-file>'
# export public key
gpg --output $publicGpgKeyPath --export $emailAddress
# export private key
gpg --output $privateGpgKeyPath --export-secret-key $emailAddress
# Sign linux policy package
Import-Module GuestConfiguration
$protectParams = @{
Path = '<path-to-package-to-sign>'
PrivateGpgKeyPath = $privateGpgKeyPath
PublicGpgKeyPath = $publicGpgKeyPath
Verbose = $true
}
Protect-GuestConfigurationPackage