Skip to content

Commit 151a011

Browse files
stefanbergereverzakov
authored andcommitted
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/lib/runc/myvtpm1", "vtpmVersion": "2", "createCerts": false, "runAs": "tss", "pcrBanks": "sha1,sha512" } ] Signed-off-by: Stefan Berger <[email protected]>
1 parent bfdffd5 commit 151a011

File tree

6 files changed

+122
-2
lines changed

6 files changed

+122
-2
lines changed

config-linux.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,36 @@ The following parameters can be specified to set up the controller:
585585
}
586586
```
587587

588+
### <a name="configLinuxVTPMs" />vTPMs
589+
590+
**`vtpms`** (array of objects, OPTIONAL) lists a number of emulated TPMs that will be made available to the container.
591+
592+
Each entry has the following structure:
593+
594+
* **`statePath`** *(string, REQUIRED)* - Unique path where vTPM writes its state into.
595+
* **`statePathIsManaged`** *(string, OPTIONAL)* - Whether runc is allowed to delete the TPM's state path upon destroying the TPM, defaults to false.
596+
* **`vtpmVersion`** *(string, OPTIONAL)* - The version of TPM to emulate, either 1.2 or 2, defaults to 1.2.
597+
* **`createCerts`** *(boolean, OPTIONAL)* - If true then create certificates for the vTPM, defaults to false.
598+
* **`runAs`** *(string, OPTIONAL)* - Under which user to run the vTPM, e.g. 'tss'.
599+
* **`pcrBanks`** *(string, OPTIONAL)* - Comma-separated list of PCR banks to activate, default depends on `swtpm`.
600+
* **`encryptionPassword`** *(string, OPTIONAL)* - Write state encrypted with a key derived from the password, defaults to not encrypted.
601+
602+
#### Example
603+
604+
```json
605+
"vtpms": [
606+
{
607+
"statePath": "/var/lib/runc/myvtpm1",
608+
"statePathIsManaged": false,
609+
"vtpmVersion": "2",
610+
"createCerts": false,
611+
"runAs": "tss",
612+
"pcrBanks": "sha1,sha512",
613+
"encryptionPassword": "mysecret"
614+
}
615+
]
616+
```
617+
588618
### <a name="configLinuxHugePageLimits" />Huge page limits
589619

590620
**`hugepageLimits`** (array of objects, OPTIONAL) represents the `hugetlb` controller which allows to limit the HugeTLB reservations (if supported) or usage (page fault).

config.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,16 @@ Here is a full example `config.json` for reference.
10761076
"rate": 300
10771077
}
10781078
]
1079-
}
1079+
},
1080+
"vtpms": [
1081+
{
1082+
"statePath": "/var/lib/runc/myvtpm1",
1083+
"vtpmVersion": "2",
1084+
"createCerts": false,
1085+
"runAs": "tss",
1086+
"pcrBanks": "sha1,sha512"
1087+
}
1088+
]
10801089
},
10811090
"rootfsPropagation": "slave",
10821091
"seccomp": {

schema/config-linux.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
"$ref": "defs-linux.json#/definitions/DeviceCgroup"
5050
}
5151
},
52+
"vtpms" : {
53+
"type": "array",
54+
"items": {
55+
"$ref": "defs-linux.json#/definitions/VTPM"
56+
}
57+
},
5258
"pids": {
5359
"type": "object",
5460
"properties": {

schema/defs-linux.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@
148148
"description": "minor device number",
149149
"$ref": "defs.json#/definitions/int64"
150150
},
151+
"TPMVersion": {
152+
"description": "The TPM version",
153+
"type": "string",
154+
"enum": [
155+
"1.2",
156+
"2"
157+
]
158+
},
151159
"FileMode": {
152160
"description": "File permissions mode (typically an octal value)",
153161
"type": "integer",
@@ -249,6 +257,35 @@
249257
}
250258
]
251259
},
260+
"VTPM" : {
261+
"type": "object",
262+
"properties" : {
263+
"statePath": {
264+
"type": "string"
265+
},
266+
"statePathIsManaged": {
267+
"type": "boolean"
268+
},
269+
"vtpmVersion": {
270+
"$ref": "#/definitions/TPMVersion"
271+
},
272+
"createCerts": {
273+
"type": "boolean"
274+
},
275+
"runAs": {
276+
"type": "string"
277+
},
278+
"pcrBanks": {
279+
"type": "string"
280+
},
281+
"encryptionPassword": {
282+
"type": "string"
283+
}
284+
},
285+
"required": [
286+
"statePath"
287+
]
288+
},
252289
"DeviceCgroup": {
253290
"type": "object",
254291
"properties": {

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,25 @@
345345
"rate": 300
346346
}
347347
]
348-
}
348+
},
349+
"vtpms": [
350+
{
351+
"statePath": "/var/lib/runc/myvtpm1",
352+
"vtpmVersion": "2",
353+
"createCerts": false,
354+
"runAs": "tss",
355+
"pcrBanks": "sha1,sha512"
356+
},
357+
{
358+
"statePath": "/var/lib/runc/myvtpm2",
359+
"statePathIsManaged": true,
360+
"vtpmVersion": "1.2",
361+
"createCerts": true,
362+
"runAs": "root",
363+
"pcrBanks": "sha1,sha512",
364+
"encryptionPassword": "mysecret"
365+
}
366+
]
349367
},
350368
"rootfsPropagation": "slave",
351369
"seccomp": {

specs-go/config.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,24 @@ type LinuxRdma struct {
453453
HcaObjects *uint32 `json:"hcaObjects,omitempty"`
454454
}
455455

456+
// LinuxVTPM for vTPM definition
457+
type LinuxVTPM struct {
458+
// Path on host where vTPM writes state to
459+
StatePath string `json:"statePath,omitempty"`
460+
// Whether runc is allowed to delete the 'Statepath' once the TPM is destroyed
461+
StatePathIsManaged bool `json:"statePathIsManaged,omitempty"`
462+
// Version of the TPM that is emulated
463+
TPMVersion string `json:"vtpmVersion,omitempty"`
464+
// Whether to create certificates upon first start of vTPM
465+
CreateCertificates bool `json:"createCerts,omitempty"`
466+
// The PCR banks to enable
467+
PcrBanks string `json:"pcrBanks,omitempty"`
468+
// Under what user to run the vTPM process
469+
RunAs string `json:"runAs,omitempty"`
470+
// The password to derive the encryption key from
471+
EncryptionPassword string `json:"encryptionPassword,omitempty"`
472+
}
473+
456474
// LinuxResources has container runtime resource constraints
457475
type LinuxResources struct {
458476
// Devices configures the device allowlist.
@@ -475,6 +493,8 @@ type LinuxResources struct {
475493
Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
476494
// Unified resources.
477495
Unified map[string]string `json:"unified,omitempty"`
496+
// VTPM configuration
497+
VTPMs []LinuxVTPM `json:"vtpms,omitempty"`
478498
}
479499

480500
// LinuxDevice represents the mknod information for a Linux special device file

0 commit comments

Comments
 (0)