Skip to content

Commit f681f84

Browse files
authored
Merge pull request #197613 from jodi-boone/signedPackageUpdates
Updating signed package docs for E2E scenarios
2 parents 23d4d58 + 5f3f042 commit f681f84

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

articles/governance/policy/how-to/guest-configuration-create-signing.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,44 @@ require code to be signed.
2020

2121
To use the Signature Validation feature, run the
2222
`Protect-GuestConfigurationPackage` cmdlet to sign the package before it's
23-
published. This cmdlet requires a 'Code Signing' certificate.
23+
published. This cmdlet requires a 'Code Signing' certificate. If you do not have a 'Code Signing' certificate, please use the script below to create a self-signed certificate for testing purposes to follow along with the example.
24+
25+
## Windows signature validation
2426

2527
```azurepowershell-interactive
26-
$Cert = Get-ChildItem -Path cert:\LocalMachine\My | Where-Object {($_.Subject-eq "CN=mycert") }
27-
Protect-GuestConfigurationPackage -Path .\package\AuditWindowsService\AuditWindowsService.zip -Certificate $Cert -Verbose
28+
# How to create a self sign cert and use it to sign Guest Configuration custom policy package
29+
30+
# Create Code signing cert
31+
$mycert = New-SelfSignedCertificate -Type CodeSigningCert -DnsName 'GCEncryptionCertificate' -HashAlgorithm SHA256
32+
33+
# Export the certificates
34+
$mypwd = ConvertTo-SecureString -String "Password1234" -Force -AsPlainText
35+
$mycert | Export-PfxCertificate -FilePath C:\demo\GCPrivateKey.pfx -Password $mypwd
36+
$mycert | Export-Certificate -FilePath "C:\demo\GCPublicKey.cer" -Force
37+
38+
# Import the certificate
39+
Import-PfxCertificate -FilePath C:\demo\GCPrivateKey.pfx -Password $mypwd -CertStoreLocation 'Cert:\LocalMachine\My'
40+
41+
42+
# Sign the policy package
43+
$certToSignThePackage = Get-ChildItem -Path cert:\LocalMachine\My | Where-Object {($_.Subject-eq "CN=GCEncryptionCertificate") }
44+
Protect-GuestConfigurationPackage -Path C:\demo\AuditWindowsService.zip -Certificate $certToSignThePackage -Verbose
45+
```
46+
47+
## Linux signature validation
48+
49+
```bash
50+
# generate gpg key
51+
gpg --gen-key
52+
53+
# export public key
54+
gpg --output public.gpg --export <email-id used to generate gpg key>
55+
# export private key
56+
gpg --output private.gpg --export-secret-key <email-id used to generate gpg key>
57+
58+
# Sign linux policy package
59+
Import-Module GuestConfiguration
60+
Protect-GuestConfigurationPackage -Path ./not_installed_application_linux.zip -PrivateGpgKeyPath ./private.gpg -PublicGpgKeyPath ./public.gpg -Verbose
2861
```
2962

3063
Parameters of the `Protect-GuestConfigurationPackage` cmdlet:
@@ -37,7 +70,7 @@ Parameters of the `Protect-GuestConfigurationPackage` cmdlet:
3770

3871
GuestConfiguration agent expects the certificate public key to be present in
3972
"Trusted Root Certificate Authorities" on Windows machines and in the path
40-
`/usr/local/share/ca-certificates/extra` on Linux machines. For the node to
73+
`/usr/local/share/ca-certificates/gc` on Linux machines. For the node to
4174
verify signed content, install the certificate public key on the machine before
4275
applying the custom policy. This process can be done using any technique inside
4376
the VM or by using Azure Policy. An example template is available

0 commit comments

Comments
 (0)