Signing and trusting packages
Every package Orchestrator exports is signed. Recipe 2.3 looked after the certificate that does the signing, and recipe 6.2 clicked through the import dialog that shows it. Neither asked the question that matters when a package arrives from somewhere else: should you let it in?
A signature answers two smaller questions. Was the package changed after it was signed? And which certificate signed it? It can’t tell you whether that certificate belongs to someone you trust. That part is yours. In this recipe you record the fingerprint of vco01.vmw.lab’s signing certificate, check a package against it from a script before importing it into the Orchestrator embedded in VCF Automation, trust vco01 as a publisher, and then break a package on purpose to see how the check reacts.
Getting ready
- The package
com.vcfguide.chapter6onvco01.vmw.lab, exported once ascom.vcfguide.chapter6.package(recipe 6.2). - A Linux or macOS shell with
curl,jq,zip, andunzip, and the lab’s CA certificate saved asvmw-lab-ca.pem. - The service account
svc-vcfguide@vsphere.localonvco01, and a bearer token for the embedded Orchestrator atauto.vmw.lab. Recipe 7.1 shows how to get both kinds of credential. - A package signing certificate on
vco01with a name you recognise, such asVMW Lab Orchestrator(recipe 2.3).
How to do it
Record the publisher’s fingerprint
- On
vco01, go to Administration > Inventory, expand Configuration > Keystores > Dunes, and select the signing certificate. Note its common name and its expiry date. - Ask
vco01itself what it sees in its own package. The packages service has a call,POST /vco/api/packages/import-details, that reads a package file and reports on it without importing anything:
curl --silent --show-error --cacert vmw-lab-ca.pem \ -u 'svc-vcfguide@vsphere.local' \ -F "file=@com.vcfguide.chapter6.package" \ https://vco01.vmw.lab/vco/api/packages/import-details \ | jq '{packageName, contentVerified, certificateInfo}'- Enter the password when
curlasks. The answer names the package, says whether its content matches its signature, and describes the signing certificate:
{ "packageName": "com.vcfguide.chapter6", "contentVerified": true, "certificateInfo": { "commonName": "VMW Lab Orchestrator", "validUntilDate": "…", "fingerprintSHA1": "…", "serialNumber": "…" }}- Save the fingerprint in a file next to your release scripts, as upper case without colons. This is the value every package from
vco01must carry:
echo 'paste-the-fingerprintSHA1-value-here' | tr -d ':' | tr 'a-f' 'A-F' > vco01-signing.sha1Terminal: the curl … /vco/api/packages/import-details | jq command against vco01.vmw.lab and its output, with contentVerified = true and certificateInfo showing common name VMW Lab Orchestrator, validity dates, and the SHA-1 fingerprint (partly blurred).
fingerprintSHA1 (with or without colons, upper or lower case) and of the dates, and whether the call needs any form field besides file. The field names come from the API reference’s ImportPackageDetails structure.Check a package before you import it
- Save this script as
check-package.sh. It asks the target server the same question, and refuses the package unless its content is intact and it was signed by the certificate invco01-signing.sha1:
#!/usr/bin/env bash# Checks a package against the target Orchestrator before import.# Usage: DST_TOKEN=... bash check-package.sh com.vcfguide.chapter6.packageset -euo pipefail
FILE="$1"DST="https://auto.vmw.lab/vco/api"CACERT="vmw-lab-ca.pem"EXPECTED="$(cat vco01-signing.sha1)"
DETAILS="$(curl --fail --silent --show-error --cacert "$CACERT" \ -H "Authorization: Bearer $DST_TOKEN" \ -F "file=@$FILE" \ "$DST/packages/import-details")"
VERIFIED="$(jq -r '.contentVerified' <<< "$DETAILS")"TRUSTED="$(jq -r '.certificateTrusted' <<< "$DETAILS")"SIGNER="$(jq -r '.certificateInfo.commonName' <<< "$DETAILS")"FINGERPRINT="$(jq -r '.certificateInfo.fingerprintSHA1' <<< "$DETAILS" \ | tr -d ':' | tr 'a-f' 'A-F')"
echo "Package: $(jq -r '.packageName' <<< "$DETAILS")"echo "Signed by: $SIGNER"echo "Fingerprint: $FINGERPRINT"echo "Intact: $VERIFIED"echo "Trusted here: $TRUSTED"
if [ "$VERIFIED" != "true" ]; then echo "REFUSED: the content doesn't match its signature." >&2 exit 1fiif [ "$FINGERPRINT" != "$EXPECTED" ]; then echo "REFUSED: signed by an unexpected certificate." >&2 exit 1fi
echo "Elements and what an import would do:"jq -r '.importElementDetails[] | " \(.type) \(.fileObjectName) \(.fileObjectVersion) server: \(.serverObjectVersion // "none") \(.versionComparison)"' \ <<< "$DETAILS"echo "OK to import."- Run it against the package from recipe 6.2:
export DST_TOKEN='…'bash check-package.sh com.vcfguide.chapter6.package- Read the output. Intact is
trueand the fingerprint matches, so the script lists the three elements, with the version in the package beside the version already onauto.vmw.lab, and ends with OK to import. Trusted here isfalseifauto.vmw.labhas never been told to trustvco01’s certificate.
Terminal running bash check-package.sh com.vcfguide.chapter6.package: Signed by: VMW Lab Orchestrator, the fingerprint, Intact: true, Trusted here: false, the three elements with package and server versions, and OK to import.
Trust the publisher once
- In VCF Automation, open the Provider Consumption organization’s Orchestrate tab, go to Assets > Packages, and click Import. Choose
com.vcfguide.chapter6.package. - On the General tab, compare the certificate’s fingerprint with the value in
vco01-signing.sha1. They match, so accept the certificate as trusted, then import as in recipe 6.2. - Run
check-package.shagain. Trusted here is nowtrue.
certificateTrusted changes to true after the first trusted import, and where the trusted certificate is kept on the target: a keystore under Administration > Inventory > Configuration > Keystores, or somewhere else.See what tampering looks like
- Make a copy of the package and change one file inside it. A package is a ZIP archive, so any ZIP tool will do:
mkdir tamper && cd tampercp ../com.vcfguide.chapter6.package tampered.packageunzip -l tampered.package # list what's insideunzip tampered.package 'elements/*' -d x- Pick one of the element files that
unzipextracted underx/elements/, change a single character in it with a text editor, and put it back:
cd x && zip ../tampered.package elements/<the-file-you-changed> && cd ..cd .. && bash check-package.sh tamper/tampered.package- The script stops with REFUSED: the content doesn’t match its signature. Intact is
false, although the signer and fingerprint are the same as before. The signature still namesvco01, but it no longer matches what’s in the file.
elements/ folder and file names used in steps 11 and 12 are an assumption; adjust the steps to what unzip -l shows), and that a changed element gives contentVerified = false rather than an error. Record what the client’s import dialog shows for the same file.Terminal running bash check-package.sh tamper/tampered.package: Signed by: VMW Lab Orchestrator, the same fingerprint as Figure 6.18, Intact: false, and REFUSED: the content doesn't match its signature.
How it works
What gets signed. When Orchestrator exports a package, it signs each element with the private key of its package signing certificate, kept in the Dunes keystore in its database (recipe 2.3), and puts the certificate into the package next to the elements. Anyone who receives the file can recompute the signatures with the public key in that certificate. If a single byte of an element changed after export, the signature no longer matches, and the target reports the content as not verified.
What a signature proves, and what it doesn’t. A matching signature proves that the content is exactly what the holder of that private key exported. It doesn’t prove who that holder is. The signing certificate that Orchestrator generates is self-signed: nobody but the server itself vouches for the name in it. Anyone can run Generate Package Signing Certificate with the common name VMW Lab Orchestrator. What they can’t do is produce a certificate with the same fingerprint, because the fingerprint is a hash of the certificate itself, and the certificate holds vco01’s public key. That’s why this recipe checks the fingerprint, not the name.
The four answers that import-details gives about the signature are worth telling apart:
| Field | Question it answers |
|---|---|
contentVerified |
Does the content still match its signature? |
certificateValid |
Is the signing certificate within its validity dates? |
certificateUnknown |
Has this server never seen the certificate before? |
certificateTrusted |
Has someone on this server chosen to trust it? |
certificateValid with a package signed by an expired certificate, and certificateUnknown before and after the first trusted import.Trust is per server. Trusting vco01’s certificate on auto.vmw.lab is a decision made on auto.vmw.lab, and it’s remembered there. It says nothing to a third server, and it doesn’t change how vco01 signs. When you add a production cluster or a test server, each one has to be told once. Do that with the fingerprint in hand, not by clicking through.
A safe check. import-details changes nothing on the target. It reads the file, compares each element with what’s on the server, and answers. That makes it safe to call from a pipeline before every import, and a natural place for the rule “only packages from this certificate go into production”.
POST /vco/api/packages/import-details.There's more
When the publisher’s certificate changes. Regenerating the signing certificate on vco01 (recipe 2.3) gives it a new key and a new fingerprint. Packages exported from then on fail check-package.sh until you update vco01-signing.sha1, and every target sees an unknown certificate on the next import. That’s the system working. Plan a certificate change like any other: publish the new fingerprint to the people who import your packages first, then regenerate.
More than one publisher. If production accepts packages from two teams, keep one fingerprint per line in the file and replace the comparison in the script with grep -qx "$FINGERPRINT" vco01-signing.sha1. Keep the file in the same Git repository as the script, so a new publisher is a reviewed change.
Packages from vendors. Plug-in vendors and community projects also ship .package files. Check them the same way: ask the publisher for the fingerprint through a channel other than the one the file came from, such as their website or a signed release note, and import into a test server first.
Git doesn’t sign anything. Content that reaches a server through Git (recipe 6.3) isn’t a package and carries no Orchestrator signature. There, the trust lives in the repository: who can push to the branch, and who must review a pull request (recipe 6.4). If your security team needs a signed artifact per release, use the package route for the last step into production.
Don’t share the secret on export. Signing protects a package from being changed. It doesn’t hide what’s in it. Anyone who has the file can unzip it and read every script. That’s another reason to leave Add configuration SecureString attribute values to package cleared (recipe 6.2).
SecureString values stores them encrypted, and with which key, or readable in the ZIP archive.See also
- 2.3 Managing the package signing certificate, for the certificate that signs your packages.
- 6.2 Packages: create, export, import, for the import dialog this recipe uses.
- 6.4 Promoting content from development to production, where
check-package.shfits between export and import. - 7.1 The Orchestrator REST API, for credentials and tokens.
- Broadcom developer documentation: Get Import Package Details and the VCF Operations Orchestrator API 9.1 Packages service.
- Broadcom KB 442343: regenerating certificates in the Dunes keystore.
- VMware Docs (Aria Automation Orchestrator 8.14): Managing certificates, on how package signatures let a receiver decide whether to trust a package.
