Skip to content

Commit e8213b4

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": "/tmp/tpm12_1_ubuntu", "VTPMVersion": "1.2", "CreateCertificates" : false } ] Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
1 parent a89dd9d commit e8213b4

File tree

6 files changed

+85
-2
lines changed

6 files changed

+85
-2
lines changed

config-linux.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,31 @@ 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
390+
will be made available to the container.
391+
392+
Each entry has the following structure:
393+
394+
* **`Statepath`** *(string, REQUIRED)* - full path to a directory where the vTPM is to write its persistent state into
395+
* **`VTPMVersion`** *(string, OPTIONAL)* - The version of TPM to emulate; either 1.2 or 2; default is 1.2
396+
* **`CreateCertificates`** *(boolean, OPTIONAL)* - Whether to create certificates for the vTPM
397+
398+
The `Statepath` MUST be unique per container.
399+
400+
### Example
401+
402+
```json
403+
"vtpms": [
404+
{
405+
"Statepath": "/var/run/runc/ubuntu/tpm12_1",
406+
"VTPMVersion": "1.2",
407+
"CreateCertificates": false
408+
}
409+
]
410+
```
411+
387412
### <a name="configLinuxHugePageLimits" />Huge page limits
388413

389414
**`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+
"CreateCertificates": 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+
"CreateCertificates": {
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+
"CreateCertificates": 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 []*VTPM `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 VTPM 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"`
580+
// Version of the TPM
581+
Vtpmversion string `json:"vtpmversion"`
582+
}

0 commit comments

Comments
 (0)