Skip to content

Commit 549ec0e

Browse files
authored
fix(rvps): read Azure pcr-stash values as flat, TEE-prefixed keys (#41)
* fix(rvps): read Azure pcr-stash values as flat, TEE-prefixed keys The Azure RVPS section read $secretData.measurements.sha256.pcr03 (and pcr09/11/12), a nested structure that only the old, now-removed get-pcr.sh script (and a since-superseded manual bare-metal PCR collection doc) ever produced. The current collection tool (veritas, via coco-pattern's collect-firmware-refvals.sh --platform azure) outputs a flat, already TEE-prefixed structure instead (tdx_pcr03/snp_pcr03/etc, per veritas's own RVPS reference_value format) -- so the nested lookup has been resolving to nil since Azure collection switched to veritas, silently producing broken/empty snp_pcr03/tdx_pcr03 reference values. Confirmed via git archaeology: the nested lookup was introduced in the very first commit of this file (4b0a717) and was never migrated when 3eb756e later moved the analogous bare-metal firmware-reference-values handling from multi-key to flat single-blob format -- only the bare-metal path was updated at the time. Fix: read snp_pcr03/tdx_pcr03/snp_pcr09/tdx_pcr09/snp_pcr11/tdx_pcr11/ snp_pcr12/tdx_pcr12 directly as flat, existence-guarded keys, mirroring the confirmed-working bare-metal firmwareData pattern (if $firmwareData.mr_td, etc.) exactly instead of computing one value and manually duplicating it into both prefixes. This means each prefix is only populated when veritas actually collected it -- compatible with both single-TEE and the new default dual-TEE (--tee both) collection. Also moved the snp_pcr08/tdx_pcr08 block (sourced from the initdata ConfigMap, unrelated to pcr-stash) outside the 'if $pcrStash' guard, since it was previously skipped whenever pcr-stash didn't exist yet even though its actual data source is independent. Verified with 'helm lint' and 'helm template --show-only' (both clean, rendered object-templates-raw text confirmed structurally identical in style to the working bare-metal block). The 'lookup' function only resolves against a live cluster, so end-to-end verification of the rendered RVPS ConfigMap needs a live Azure cluster -- no existing helm-unittest test suite exists in this chart to extend, and neither helm-unittest nor podman are available in this environment to add one. * fix: promote to main Signed-off-by: Chris Butler <chris.butler@redhat.com> --------- Signed-off-by: Chris Butler <chris.butler@redhat.com>
1 parent 4ece12a commit 549ec0e

3 files changed

Lines changed: 30 additions & 18 deletions

File tree

‎Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ keywords:
66
- confidential-computing
77
- confidential-containers
88
name: trustee
9-
version: 0.10.0
9+
version: 0.10.1

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# trustee
22

3-
![Version: 0.10.0](https://img.shields.io/badge/Version-0.10.0-informational?style=flat-square)
3+
![Version: 0.10.1](https://img.shields.io/badge/Version-0.10.1-informational?style=flat-square)
44

55
A Helm chart to provide an opinionated deployment of Trustee in a validated pattern
66

‎templates/rvps-values-policies.yaml‎

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,46 @@ spec:
2828
{{`{{- $referenceValues := dict -}}`}}
2929
{{`{{- $entry := dict "version" "0.1.0" "name" "init_data" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr8Hash $debugPcr8Hash $rawHash $debugRawHash $rawHashPadded $debugRawHashPadded) -}}`}}
3030
{{`{{- $referenceValues = set $referenceValues "init_data" (toJson $entry | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
31+
{{`{{- $e := dict "version" "0.1.0" "name" "snp_pcr08" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr8Hash $debugPcr8Hash) -}}`}}
32+
{{`{{- $referenceValues = set $referenceValues "snp_pcr08" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
33+
{{`{{- $e = dict "version" "0.1.0" "name" "tdx_pcr08" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr8Hash $debugPcr8Hash) -}}`}}
34+
{{`{{- $referenceValues = set $referenceValues "tdx_pcr08" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
3135
{{`{{- $pcrStash := (lookup "v1" "Secret" "trustee-operator-system" "pcr-stash") -}}`}}
3236
{{`{{- if $pcrStash -}}`}}
3337
{{`{{- $secretData := $pcrStash.data.json | base64dec | fromJson -}}`}}
34-
{{`{{- $pcr03 := $secretData.measurements.sha256.pcr03 -}}`}}
35-
{{`{{- $pcr09 := $secretData.measurements.sha256.pcr09 -}}`}}
36-
{{`{{- $pcr11 := $secretData.measurements.sha256.pcr11 -}}`}}
37-
{{`{{- $pcr12 := $secretData.measurements.sha256.pcr12 -}}`}}
38-
{{`{{- $e := dict "version" "0.1.0" "name" "snp_pcr03" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr03) -}}`}}
38+
{{`{{- if $secretData.snp_pcr03 -}}`}}
39+
{{`{{- $e := dict "version" "0.1.0" "name" "snp_pcr03" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.snp_pcr03 -}}`}}
3940
{{`{{- $referenceValues = set $referenceValues "snp_pcr03" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
40-
{{`{{- $e = dict "version" "0.1.0" "name" "tdx_pcr03" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr03) -}}`}}
41+
{{`{{- end -}}`}}
42+
{{`{{- if $secretData.tdx_pcr03 -}}`}}
43+
{{`{{- $e := dict "version" "0.1.0" "name" "tdx_pcr03" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.tdx_pcr03 -}}`}}
4144
{{`{{- $referenceValues = set $referenceValues "tdx_pcr03" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
42-
{{`{{- $e = dict "version" "0.1.0" "name" "snp_pcr08" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr8Hash $debugPcr8Hash) -}}`}}
43-
{{`{{- $referenceValues = set $referenceValues "snp_pcr08" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
44-
{{`{{- $e = dict "version" "0.1.0" "name" "tdx_pcr08" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr8Hash $debugPcr8Hash) -}}`}}
45-
{{`{{- $referenceValues = set $referenceValues "tdx_pcr08" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
46-
{{`{{- $e = dict "version" "0.1.0" "name" "snp_pcr09" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr09) -}}`}}
45+
{{`{{- end -}}`}}
46+
{{`{{- if $secretData.snp_pcr09 -}}`}}
47+
{{`{{- $e := dict "version" "0.1.0" "name" "snp_pcr09" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.snp_pcr09 -}}`}}
4748
{{`{{- $referenceValues = set $referenceValues "snp_pcr09" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
48-
{{`{{- $e = dict "version" "0.1.0" "name" "tdx_pcr09" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr09) -}}`}}
49+
{{`{{- end -}}`}}
50+
{{`{{- if $secretData.tdx_pcr09 -}}`}}
51+
{{`{{- $e := dict "version" "0.1.0" "name" "tdx_pcr09" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.tdx_pcr09 -}}`}}
4952
{{`{{- $referenceValues = set $referenceValues "tdx_pcr09" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
50-
{{`{{- $e = dict "version" "0.1.0" "name" "snp_pcr11" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr11) -}}`}}
53+
{{`{{- end -}}`}}
54+
{{`{{- if $secretData.snp_pcr11 -}}`}}
55+
{{`{{- $e := dict "version" "0.1.0" "name" "snp_pcr11" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.snp_pcr11 -}}`}}
5156
{{`{{- $referenceValues = set $referenceValues "snp_pcr11" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
52-
{{`{{- $e = dict "version" "0.1.0" "name" "tdx_pcr11" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr11) -}}`}}
57+
{{`{{- end -}}`}}
58+
{{`{{- if $secretData.tdx_pcr11 -}}`}}
59+
{{`{{- $e := dict "version" "0.1.0" "name" "tdx_pcr11" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.tdx_pcr11 -}}`}}
5360
{{`{{- $referenceValues = set $referenceValues "tdx_pcr11" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
54-
{{`{{- $e = dict "version" "0.1.0" "name" "snp_pcr12" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr12) -}}`}}
61+
{{`{{- end -}}`}}
62+
{{`{{- if $secretData.snp_pcr12 -}}`}}
63+
{{`{{- $e := dict "version" "0.1.0" "name" "snp_pcr12" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.snp_pcr12 -}}`}}
5564
{{`{{- $referenceValues = set $referenceValues "snp_pcr12" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
56-
{{`{{- $e = dict "version" "0.1.0" "name" "tdx_pcr12" "expiration" "2027-12-12T00:00:00Z" "value" (list $pcr12) -}}`}}
65+
{{`{{- end -}}`}}
66+
{{`{{- if $secretData.tdx_pcr12 -}}`}}
67+
{{`{{- $e := dict "version" "0.1.0" "name" "tdx_pcr12" "expiration" "2027-12-12T00:00:00Z" "value" $secretData.tdx_pcr12 -}}`}}
5768
{{`{{- $referenceValues = set $referenceValues "tdx_pcr12" (toJson $e | base64enc | replace "+" "-" | replace "/" "_") -}}`}}
5869
{{`{{- end -}}`}}
70+
{{`{{- end -}}`}}
5971
{{`{{- $firmwareStash := (lookup "v1" "Secret" "trustee-operator-system" "firmware-reference-values") -}}`}}
6072
{{`{{- if $firmwareStash -}}`}}
6173
{{`{{- $firmwareData := $firmwareStash.data.json | base64dec | fromJson -}}`}}

0 commit comments

Comments
 (0)