Debian Codegraph @

proto/attest.proto

raw
1 syntax = "proto3";
2
3 package attest;
4
5 import "proto/sevsnp.proto";
6 import "proto/tdx.proto";
7 import "tpm.proto";
8
9 option go_package = "github.com/google/go-tpm-tools/proto/attest";
10
11 // Information uniquely identifying a GCE instance. Can be used to create an
12 // instance URL, which can then be used with GCE APIs. Formatted like:
13 // https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone}/instances/{instance_name}
14 message GCEInstanceInfo {
15 string zone = 1;
16 string project_id = 2;
17 uint64 project_number = 3;
18 string instance_name = 4;
19 uint64 instance_id = 5;
20 }
21
22 message Attestation {
23 // Attestation Key (AK) Public Area, encoded as a TPMT_PUBLIC
24 bytes ak_pub = 1;
25 // Quotes over all supported PCR banks
26 repeated tpm.Quote quotes = 2;
27 // TCG Event Log, encoded in the raw binary format.
28 // Can be SHA-1 or crypto-agile.
29 bytes event_log = 3;
30 // Optional information about a GCE instance, unused outside of GCE
31 GCEInstanceInfo instance_info = 4;
32 // A COS event log using the TCG Canonical Event Log format
33 bytes canonical_event_log = 5;
34 // Attestation Key (AK) Certificate, encoded as ASN.1 DER.
35 // Optional.
36 bytes ak_cert = 6;
37 // Intermediate Certificates for verifying the AK Certificate, encoded as
38 // ASN.1 DER. Optional.
39 repeated bytes intermediate_certs = 7;
40 // Trusted execution environment attestation is a secondary platform
41 // attestation that the machine is running within a particular confidential
42 // environment.
43 oneof tee_attestation {
44 sevsnp.Attestation sev_snp_attestation = 8;
45 tdx.QuoteV4 tdx_attestation = 9;
46 }
47 }
48
49 // For VMs running SEV-SNP with an SVSM-based e-vTPM, this contains a TPM quote
50 // and all the information needed to verify it.
51 message SevSnpSvsmAttestation {
52 Attestation attestation = 1;
53 sevsnp.Attestation sev_snp_attestation = 2;
54 // vTPM service manifest is retrieved from configfs-tsm-report via manifest blob
55 // See https://github.com/torvalds/linux/blob/v6.16/Documentation/ABI/testing/configfs-tsm-report
56 // The manifest format is defined by the SVSM spec at https://www.amd.com/en/developer/sev.html
57 bytes vtpm_service_manifest = 3;
58 string vtpm_service_manifest_version = 4;
59 // This contains a launch endorsement for guest firmware that includes SVSM.
60 bytes launch_endorsement = 5;
61 }
62
63 // Type of hardware technology used to protect this instance
64 enum GCEConfidentialTechnology {
65 NONE = 0;
66 AMD_SEV = 1;
67 AMD_SEV_ES = 2;
68 INTEL_TDX = 3;
69 AMD_SEV_SNP = 4;
70 }
71
72 // The platform/firmware state for this instance
73 message PlatformState {
74 oneof firmware {
75 // Raw S-CRTM version identifier (EV_S_CRTM_VERSION)
76 bytes scrtm_version_id = 1;
77 // Virtual GCE firmware version (parsed from S-CRTM version id)
78 uint32 gce_version = 2;
79 }
80 // Set to NONE on non-GCE instances or non-Confidential Shielded GCE instances
81 GCEConfidentialTechnology technology = 3;
82 // Only set for GCE instances
83 GCEInstanceInfo instance_info = 4;
84 }
85
86 message GrubFile {
87 // The digest of the file (pulled from the raw event digest).
88 bytes digest = 1;
89 // The event data. This is not measured, so it is untrusted.
90 bytes untrusted_filename = 2;
91 }
92
93 message GrubState {
94 // All GRUB-read and measured files, including grub.cfg.
95 repeated GrubFile files = 1;
96 // A list of executed GRUB commands and command lines passed to the kernel
97 // and kernel modules.
98 repeated string commands = 2;
99 }
100
101 // The state of the Linux kernel.
102 // At the moment, parsing LinuxKernelState relies on parsing the GrubState.
103 // To do so, use ParseOpts{Loader: GRUB} when calling ParseMachineState.
104 message LinuxKernelState {
105 // The kernel command line.
106 string command_line = 1;
107 }
108
109 // A parsed event from the TCG event log
110 message Event {
111 // The Platform Control Register (PCR) this event was extended into.
112 uint32 pcr_index = 1;
113 // The type of this event. Note that this value is not verified, so it should
114 // only be used as a hint during event parsing.
115 uint32 untrusted_type = 2;
116 // The raw data associated to this event. The meaning of this data is
117 // specific to the type of the event.
118 bytes data = 3;
119 // The event digest actually extended into the TPM. This is often the hash of
120 // the data field, but in some cases it may have a type-specific calculation.
121 bytes digest = 4;
122 // This is true if hash(data) == digest.
123 bool digest_verified = 5;
124 }
125
126 // Common, publicly-listed certificates by different vendors.
127 enum WellKnownCertificate {
128 UNKNOWN = 0;
129
130 // Microsoft certs:
131 // https://go.microsoft.com/fwlink/p/?linkid=321192
132 MS_WINDOWS_PROD_PCA_2011 = 1;
133 // https://go.microsoft.com/fwlink/p/?linkid=321194
134 MS_THIRD_PARTY_UEFI_CA_2011 = 2;
135 // https://go.microsoft.com/fwlink/p/?linkid=321185
136 MS_THIRD_PARTY_KEK_CA_2011 = 3;
137
138 // GCE certs:
139 GCE_DEFAULT_PK = 4;
140 }
141
142 message Certificate {
143 // The representation of the certificate. If the certificate matches a
144 // well-known certificate above, representation should contain the value in
145 // the enum. Otherwise, it will contain the raw DER.
146 oneof representation {
147 // DER representation of the certificate.
148 bytes der = 1;
149 WellKnownCertificate well_known = 2;
150 }
151 }
152
153 // A Secure Boot database containing lists of hashes and certificates,
154 // as defined by section 32.4.1 Signature Database in the UEFI spec.
155 message Database {
156 repeated Certificate certs = 1;
157 repeated bytes hashes = 2;
158 }
159
160 // The Secure Boot state for this instance.
161 message SecureBootState {
162 // Whether Secure Boot is enabled.
163 bool enabled = 1;
164 // The Secure Boot signature (allowed) database.
165 Database db = 2;
166 // The Secure Boot revoked signature (forbidden) database.
167 Database dbx = 3;
168 // Authority events post-separator. Pre-separator authorities
169 // are currently not supported.
170 Database authority = 4;
171 // The Secure Boot Platform key, used to sign key exchange keys.
172 Database pk = 5;
173 // The Secure Boot Key Exchange Keys, used to sign db and dbx updates.
174 Database kek = 6;
175 }
176
177 // The container's restart policy.
178 // See the following Kubernetes documentation for more details:
179 // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
180 // Note that these enum variants do not conform to the standard Protocol Buffers
181 // Style Guide so that RestartPolicy_name, RestartPolicy_value, and
182 // RestartPolicy.String() match the values used by Kubernetes and others.
183 enum RestartPolicy {
184 Always = 0;
185 OnFailure = 1;
186 Never = 2;
187 }
188
189 message ContainerState {
190 string image_reference = 1;
191 // Digest of the registry's image manifest, which contains a list of the
192 // layers comprising the image.
193 string image_digest = 2;
194 RestartPolicy restart_policy = 3;
195 // Digest of the local image configuration object, containing config items
196 // such as local layer digests.
197 string image_id = 4;
198 repeated string args = 5;
199 map<string, string> env_vars = 6;
200 // Record operator input Env Vars and Args, should be subsets of the above
201 // Env Vars and Args.
202 repeated string overridden_args = 7;
203 map<string, string> overridden_env_vars = 8;
204 }
205
206 message SemanticVersion {
207 uint32 major = 1;
208 uint32 minor = 2;
209 uint32 patch = 3;
210 }
211
212 message HealthMonitoringState {
213 // Whether memory monitoring is enabled.
214 optional bool memory_enabled = 1;
215 }
216
217 // Confidential Computing mode for GPU device. Reference for these CC mode values: https://developer.nvidia.com/blog/confidential-computing-on-h100-gpus-for-secure-and-trustworthy-ai/#hardware_security_for_nvidia_h100_gpus
218 enum GPUDeviceCCMode {
219 UNSET = 0;
220 // The NVIDIA H100 hardware, firmware, and software have fully activated all the confidential computing features.
221 ON = 1;
222 // None of the confidential computing-specific features are active.
223 OFF = 2;
224 // The GPU is in a partial CC mode that will match the workflows of CC mode ON, but with security protections disabled.
225 DEVTOOLS = 3;
226 }
227
228 message GpuDeviceState {
229 // Whether Confidential Computing mode is enabled for GPU.
230 GPUDeviceCCMode cc_mode = 1;
231 }
232
233
234 message AttestedCosState {
235 ContainerState container = 1;
236 SemanticVersion cos_version = 2;
237 SemanticVersion launcher_version = 3;
238 HealthMonitoringState health_monitoring = 4;
239 GpuDeviceState gpu_device_state = 5;
240 }
241
242 message EfiApp {
243 // The PE/COFF digest of the EFI application (pulled from the raw event digest).
244 bytes digest = 1;
245 }
246
247 // The verified state of EFI Applications. Policy usage on this machine state
248 // should check the entire set of EFI App digests matches, not a subset.
249 message EfiState {
250 // UEFI's OS Loader code is required to measure attempts to load and execute
251 // UEFI applications.
252 // UEFI applications are typically bootloaders such as shim and GRUB.
253 // These run and are measured using the UEFI LoadImage() service.
254 repeated EfiApp apps = 1;
255 // The EFI drivers,
256 // obtained from https://trustedcomputinggroup.org/wp-content/uploads/TCG_EFI_Platform_1_22_Final_-v15.pdf#page=22.
257 // The EFI Boot Services Drivers from adapter or loaded bydriver in adapter.
258 repeated EfiApp boot_services_drivers = 2;
259 // The EFI Runtime Drivers from adapter or loaded bydriver in adapter.
260 repeated EfiApp runtime_services_drivers = 3;
261 }
262
263 // The verified state of a booted machine, obtained from an Attestation
264 message MachineState {
265 PlatformState platform = 1;
266
267 SecureBootState secure_boot = 2;
268
269 // The complete parsed TCG Event Log, including those events used to
270 // create the PlatformState.
271 repeated Event raw_events = 3;
272 // The hash algorithm used when verifying the Attestation. This indicates:
273 // - which PCR bank was used for for quote validation and event log replay
274 // - the hash algorithm used to calculate event digests
275 tpm.HashAlgo hash = 4;
276
277 GrubState grub = 5;
278
279 LinuxKernelState linux_kernel = 6;
280
281 AttestedCosState cos = 7;
282
283 EfiState efi = 8;
284
285 // Attestation/Quote representations from TEEs whose signatures are already
286 // verified.
287 oneof tee_attestation {
288 sevsnp.Attestation sev_snp_attestation = 9;
289 tdx.QuoteV4 tdx_attestation = 10;
290 }
291 }
292
293 // A policy dictating which values of PlatformState to allow
294 message PlatformPolicy {
295 // If PlatformState.firmware contains a scrtm_version_id, it must appear
296 // in this list. For use with a GCE VM, minimum_gce_firmware_version is
297 // often a better alternative.
298 repeated bytes allowed_scrtm_version_ids = 1;
299 // If PlatformState.firmware contains a minimum_gce_firmware_version, it must
300 // be greater than or equal to this value. Currently, the max version is 1.
301 uint32 minimum_gce_firmware_version = 2;
302 // The PlatformState's technology must be at least as secure as
303 // the specified minimum_technology (i.e. AMD_SEV_ES > AMD_SEV > NONE).
304 GCEConfidentialTechnology minimum_technology = 3;
305 }
306
307 // A policy about what parts of a RIM to compare against machine state as
308 // reflected in a quote or (verified) event log. Reference measurements for
309 // a component are expected to be addressable by the machine state's reported
310 // digest, or otherwise presented as cached collateral with the attestation
311 // itself. The method of delivery is vendor-specific.
312 message RIMPolicy {
313 // If true, the signed measurement must be available (by means that can be
314 // vendor-specific), and the target measurement must be among the listed
315 // signed measurements. If false, then only error if there is a problem
316 // verifying the signed measurements when they are available.
317 bool require_signed = 1;
318 // x.509 certificates in ASN.1 DER format.
319 repeated bytes root_certs = 2;
320 }
321
322 // Represent minimal decisions about attestation fields until necessary to
323 // add for policy reasons.
324 message SevSnpPolicy {
325 // The policy for checking the signed reference values for the UEFI at launch.
326 RIMPolicy uefi = 1;
327 }
328
329 // A policy dictating which type of MachineStates to allow
330 message Policy {
331 PlatformPolicy platform = 1;
332
333 // SecureBootPolicy secure_boot = 2;
334
335 // When the attestation is on SEV-SNP, this is the policy. Unset means no
336 // constraints.
337 SevSnpPolicy sev_snp = 3;
338 }