Skip to content

Commit 3bd6071

Browse files
committed
Add vTPM specification
Add the vTPM specification to the documentation, config.go, and schema description. The following is an example of a vTPM description that is found under the path /linux/resources/vtpms: "vtpms": [ { "statePath": "/var/run/runc/ubuntu/tpm12_1", "vtpmVersion": "1.2", "createCerts": false } ] Signed-off-by: Stefan Berger <[email protected]>
1 parent a89dd9d commit 3bd6071

File tree

6 files changed

+84
-2
lines changed

6 files changed

+84
-2
lines changed

config-linux.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,30 @@ The following parameters can be specified to set up the controller:
384384
}
385385
```
386386

387+
### <a name="configLinuxVTPMs" />vTPMs
388+
389+
**`vtpms`** (array of objects, OPTIONAL) lists a number of emulated TPMs that will be made available to the container.
390+
391+
Each entry has the following structure:
392+
393+
* **`statePath`** *(string, REQUIRED)* - a directory for persisting vTPM state. This value MUST be an absolute path.
394+
* **`vtpmVersion`** *(string, OPTIONAL)* - The version of TPM to emulate, either 1.2 or 2; default is 1.2.
395+
* **`createCerts`** *(boolean, OPTIONAL)* - If true then create certificates for the vTPM, defaults to false.
396+
397+
The `statePath` MUST be unique per container. If the `vtpms` array contains duplicate entries with the same `statePath`, the runtime MUST generate an error.
398+
399+
#### Example
400+
401+
```json
402+
"vtpms": [
403+
{
404+
"statePath": "/var/run/runc/ubuntu/tpm12_1",
405+
"vtpmVersion": "1.2",
406+
"createCerts": false
407+
}
408+
]
409+
```
410+
387411
### <a name="configLinuxHugePageLimits" />Huge page limits
388412

389413
**`hugepageLimits`** (array of objects, OPTIONAL) represents the `hugetlb` controller which allows to limit the

config.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,14 @@ Here is a full example `config.json` for reference.
772772
"rate": 300
773773
}
774774
]
775-
}
775+
},
776+
"vtpms": [
777+
{
778+
"statePath": "/var/run/runc/ubuntu/tpm12_1",
779+
"vtpmVersion": "1.2",
780+
"createCerts": false
781+
}
782+
]
776783
},
777784
"rootfsPropagation": "slave",
778785
"seccomp": {

schema/config-linux.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
"$ref": "defs-linux.json#/definitions/DeviceCgroup"
4848
}
4949
},
50+
"vtpms" : {
51+
"id": "https://opencontainers.org/schema/bundle/linux/resources/vtpms",
52+
"type": "array",
53+
"items": {
54+
"$ref": "defs-linux.json#/definitions/VTPM"
55+
}
56+
},
5057
"pids": {
5158
"id": "https://opencontainers.org/schema/bundle/linux/resources/pids",
5259
"type": "object",

schema/defs-linux.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@
109109
"description": "minor device number",
110110
"$ref": "defs.json#/definitions/int64"
111111
},
112+
"TPMVersion": {
113+
"description": "The TPM version",
114+
"type": "string",
115+
"enum": [
116+
"1.2",
117+
"2"
118+
]
119+
},
112120
"FileMode": {
113121
"description": "File permissions mode (typically an octal value)",
114122
"type": "integer",
@@ -202,6 +210,23 @@
202210
}
203211
]
204212
},
213+
"VTPM" : {
214+
"type": "object",
215+
"properties" : {
216+
"statePath": {
217+
"type": "string"
218+
},
219+
"vtpmVersion": {
220+
"$ref": "#/definitions/TPMVersion"
221+
},
222+
"createCerts": {
223+
"type": "boolean"
224+
}
225+
},
226+
"required": [
227+
"statePath"
228+
]
229+
},
205230
"DeviceCgroup": {
206231
"type": "object",
207232
"properties": {

schema/test/config/good/spec-example.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,14 @@
303303
"rate": 300
304304
}
305305
]
306-
}
306+
},
307+
"vtpms": [
308+
{
309+
"statePath": "/var/run/runc/ubuntu/tpm12_1",
310+
"vtpmVersion": "1.2",
311+
"createCerts": false
312+
}
313+
]
307314
},
308315
"rootfsPropagation": "slave",
309316
"seccomp": {

specs-go/config.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ type Linux struct {
161161
// IntelRdt contains Intel Resource Director Technology (RDT) information
162162
// for handling resource constraints (e.g., L3 cache) for the container
163163
IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"`
164+
// VTPM configuration
165+
VTPMS []LinuxVTPM `json:"vtpms"`
164166
}
165167

166168
// LinuxNamespace is the configuration for a Linux namespace
@@ -568,3 +570,13 @@ type LinuxIntelRdt struct {
568570
// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."
569571
L3CacheSchema string `json:"l3CacheSchema,omitempty"`
570572
}
573+
574+
// VTPM is used to hold the configuration state of a VTPM
575+
type LinuxVTPM struct {
576+
// The directory where the TPM emulator writes the TPM state to
577+
StatePath string `json:"statePath"`
578+
// Whether to create a certificate for the VTPM
579+
CreateCerts bool `json:"createCerts,omitempty"`
580+
// Version of the TPM
581+
VTPMversion string `json:"vtpmVersion,omitempty"`
582+
}

0 commit comments

Comments
 (0)