@@ -4,7 +4,7 @@ metadata:
44 name : attestation-policy
55 namespace : trustee-operator-system
66data :
7- default .rego : |
7+ default_cpu .rego : |
88 package policy
99
1010 import rego.v1
@@ -50,12 +50,25 @@ data:
5050 # supported.
5151 hardware := 2 if {
5252 input.sample.svn in data.reference.svn
53+ input.sample.platform_version.major == data.reference.major_version
54+ input.sample.platform_version.minor >= data.reference.minimum_minor_version
55+ }
56+
57+ # For the 'configuration' trust claim 2 stands for
58+ # "The configuration is a known and approved config."
59+ #
60+ # In this case, check that debug mode isn't turned on.
61+ # The sample platform is just an example.
62+ # For the sample platform, the debug claim is always false.
63+ # The sample platform should only be used for testing.
64+ configuration := 2 if {
65+ input.sample.debug == false
5366 }
5467
5568 ##### SNP
5669 executables := 3 if {
5770 # In the future, we might calculate this measurement here various components
58- input.snp.launch_measurement in data.reference.snp_launch_measurement
71+ input.snp.measurement in data.reference.snp_launch_measurement
5972 }
6073
6174 hardware := 2 if {
@@ -71,14 +84,14 @@ data:
7184 #
7285 # For this, we compare all the configuration fields.
7386 configuration := 2 if {
74- input.snp.policy_debug_allowed == 0
75- input.snp.policy_migrate_ma == 0
76- input.snp.platform_smt_enabled in data.reference.snp_smt_enabled
77- input.snp.platform_tsme_enabled in data.reference.snp_tsme_enabled
78- input.snp.policy_abi_major in data.reference.snp_guest_abi_major
79- input.snp.policy_abi_minor in data.reference.snp_guest_abi_minor
80- input.snp.policy_single_socket in data.reference.snp_single_socket
81- input.snp.policy_smt_allowed in data.reference.snp_smt_allowed
87+ input.snp.policy_debug_allowed == false
88+ input.snp.policy_migrate_ma == false
89+ input.snp.platform_smt_enabled == data.reference.snp_smt_enabled
90+ input.snp.platform_tsme_enabled == data.reference.snp_tsme_enabled
91+ input.snp.policy_abi_major == data.reference.snp_guest_abi_major
92+ input.snp.policy_abi_minor == data.reference.snp_guest_abi_minor
93+ input.snp.policy_single_socket == data.reference.snp_single_socket
94+ input.snp.policy_smt_allowed == data.reference.snp_smt_allowed
8295 }
8396
8497 # For the `configuration` trust claim 3 stands for
@@ -89,12 +102,122 @@ data:
89102 # configuration value, but we make sure that some key
90103 # configurations (like debug_allowed) are set correctly.
91104 else := 3 if {
92- input.snp.policy_debug_allowed == 0
93- input.snp.policy_migrate_ma == 0
105+ input.snp.policy_debug_allowed == false
106+ input.snp.policy_migrate_ma == false
107+ }
108+
109+ ##### TDX
110+ executables := 3 if {
111+ # Check the kernel, initrd, and cmdline (including dmverity parameters) measurements
112+ input.tdx.quote.body.rtmr_1 in data.reference.rtmr_1
113+ input.tdx.quote.body.rtmr_2 in data.reference.rtmr_2
114+ tdx_uefi_event_tdvfkernel_ok
115+ tdx_uefi_event_tdvfkernelparams_ok
116+ }
117+
118+ # Support for Grub boot used by GKE
119+ else := 4 if {
120+ # Check the kernel, initrd, and cmdline (including dmverity parameters) measurements
121+ input.tdx.quote.body.rtmr_1 in data.reference.rtmr_1
122+ input.tdx.quote.body.rtmr_2 in data.reference.rtmr_2
123+ }
124+
125+ hardware := 2 if {
126+ # Check the quote is a TDX quote signed by Intel SGX Quoting Enclave
127+ input.tdx.quote.header.tee_type == "81000000"
128+ input.tdx.quote.header.vendor_id == "939a7233f79c4ca9940a0db3957f0607"
129+
130+ # Check TDX Module version and its hash. Also check OVMF code hash.
131+ input.tdx.quote.body.mr_seam in data.reference.mr_seam
132+ input.tdx.quote.body.tcb_svn in data.reference.tcb_svn
133+ input.tdx.quote.body.mr_td in data.reference.mr_td
134+
135+ # Check TCB status
136+ input.tdx.tcb_status == "UpToDate"
137+
138+ # Check collateral expiration status
139+ input.tdx.collateral_expiration_status == "0"
140+ # Check against allowed advisory ids
141+ # allowed_advisory_ids := {"INTEL-SA-00837"}
142+ # attester_advisory_ids := {id | id := input.attester_advisory_ids[_]}
143+ # object.subset(allowed_advisory_ids, attester_advisory_ids)
144+
145+ # Check against disallowed advisory ids
146+ # disallowed_advisory_ids := {"INTEL-SA-00837"}
147+ # attester_advisory_ids := {id | id := input.tdx.advisory_ids[_]} # convert array to set
148+ # intersection := attester_advisory_ids & disallowed_advisory_ids
149+ # count(intersection) == 0
150+ }
151+
152+ configuration := 2 if {
153+ # Check the TD has the expected attributes (e.g., debug not enabled) and features.
154+ input.tdx.td_attributes.debug == false
155+ input.tdx.quote.body.xfam in data.reference.xfam
156+ }
157+
158+ tdx_uefi_event_tdvfkernel_ok if {
159+ event := input.tdx.uefi_event_logs[_]
160+ event.type_name == "EV_EFI_BOOT_SERVICES_APPLICATION"
161+ "File(kernel)" in event.details.device_paths
162+
163+ digest := event.digests[_]
164+ digest.digest == data.reference.tdvfkernel
165+ }
166+
167+ tdx_uefi_event_tdvfkernelparams_ok if {
168+ event := input.tdx.uefi_event_logs[_]
169+ event.type_name == "EV_EVENT_TAG"
170+ event.details.string == "LOADED_IMAGE::LoadOptions"
171+
172+ digest := event.digests[_]
173+ digest.digest == data.reference.tdvfkernelparams
174+ }
175+
176+ ##### Azure vTPM SNP
177+ executables := 3 if {
178+ input.azsnpvtpm.measurement in data.reference.measurement
179+ input.azsnpvtpm.tpm.pcr11 in data.reference.snp_pcr11
180+ }
181+
182+ hardware := 2 if {
183+ # Check the reported TCB to validate the ASP FW
184+ input.azsnpvtpm.reported_tcb_bootloader in data.reference.tcb_bootloader
185+ input.azsnpvtpm.reported_tcb_microcode in data.reference.tcb_microcode
186+ input.azsnpvtpm.reported_tcb_snp in data.reference.tcb_snp
187+ input.azsnpvtpm.reported_tcb_tee in data.reference.tcb_tee
188+ }
189+
190+ # For the 'configuration' trust claim 2 stands for
191+ # "The configuration is a known and approved config."
192+ #
193+ # For this, we compare all the configuration fields.
194+ configuration := 2 if {
195+ input.azsnpvtpm.platform_smt_enabled in data.reference.smt_enabled
196+ input.azsnpvtpm.platform_tsme_enabled in data.reference.tsme_enabled
197+ input.azsnpvtpm.policy_abi_major in data.reference.abi_major
198+ input.azsnpvtpm.policy_abi_minor in data.reference.abi_minor
199+ input.azsnpvtpm.policy_single_socket in data.reference.single_socket
200+ input.azsnpvtpm.policy_smt_allowed in data.reference.smt_allowed
201+ }
202+
203+ ##### Azure vTPM TDX
204+ executables := 3 if {
205+ input.aztdxvtpm.tpm.pcr11 in data.reference.tdx_pcr11
206+ }
207+
208+ hardware := 2 if {
209+ # Check the quote is a TDX quote signed by Intel SGX Quoting Enclave
210+ input.aztdxvtpm.quote.header.tee_type == "81000000"
211+ input.aztdxvtpm.quote.header.vendor_id == "939a7233f79c4ca9940a0db3957f0607"
212+
213+ # Check TDX Module version and its hash. Also check OVMF code hash.
214+ input.aztdxvtpm.quote.body.mr_seam in data.reference.mr_seam
215+ input.aztdxvtpm.quote.body.tcb_svn in data.reference.tcb_svn
216+ input.aztdxvtpm.quote.body.mr_td in data.reference.mr_td
217+ }
218+
219+ configuration := 2 if {
220+ input.aztdxvtpm.quote.body.xfam in data.reference.xfam
94221 }
95222
96- ##### TDX TODO
97- ##### AZ SNP TODO
98- ##### AZ TDX TODO
99223 ##### SE TODO
100-
0 commit comments