Skip to content

Commit 32f2dc9

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/lib/runc/myvtpm1", "vtpmVersion": "2", "createCerts": false, "runAs": "tss", "pcrBanks": "sha1,sha512" } ] Signed-off-by: Stefan Berger <[email protected]>
1 parent 09fc3b4 commit 32f2dc9

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
@@ -387,6 +387,36 @@ The following parameters can be specified to set up the controller:
387387
}
388388
```
389389

390+
### <a name="configLinuxVTPMs" />vTPMs
391+
392+
**`vtpms`** (array of objects, OPTIONAL) lists a number of emulated TPMs that will be made available to the container.
393+
394+
Each entry has the following structure:
395+
396+
* **`statePath`** *(string, REQUIRED)* - Unique path where vTPM writes its state into.
397+
* **`statePathIsManaged`** *(string, OPTIONAL)* - Whether runc is allowed to delete the TPM's state path upon destroying the TPM, defaults to false.
398+
* **`vtpmVersion`** *(string, OPTIONAL)* - The version of TPM to emulate, either 1.2 or 2, defaults to 1.2.
399+
* **`createCerts`** *(boolean, OPTIONAL)* - If true then create certificates for the vTPM, defaults to false.
400+
* **`runAs`** *(string, OPTIONAL)* - Under which user to run the vTPM, e.g. 'tss'.
401+
* **`pcrBanks`** *(string, OPTIONAL)* - Comma-separated list of PCR banks to activate, default depends on `swtpm`.
402+
* **`encryptionPassword`** *(string, OPTIONAL)* - Write state encrypted with a key derived from the password, defaults to not encrypted.
403+
404+
#### Example
405+
406+
```json
407+
"vtpms": [
408+
{
409+
"statePath": "/var/lib/runc/myvtpm1",
410+
"statePathIsManaged": false,
411+
"vtpmVersion": "2",
412+
"createCerts": false,
413+
"runAs": "tss",
414+
"pcrBanks": "sha1,sha512",
415+
"encryptionPassword": "mysecret"
416+
}
417+
]
418+
```
419+
390420
### <a name="configLinuxHugePageLimits" />Huge page limits
391421

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

config.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,16 @@ Here is a full example `config.json` for reference.
886886
"rate": 300
887887
}
888888
]
889-
}
889+
},
890+
"vtpms": [
891+
{
892+
"statePath": "/var/lib/runc/myvtpm1",
893+
"vtpmVersion": "2",
894+
"createCerts": false,
895+
"runAs": "tss",
896+
"pcrBanks": "sha1,sha512"
897+
}
898+
]
890899
},
891900
"rootfsPropagation": "slave",
892901
"seccomp": {

schema/config-linux.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"$ref": "defs-linux.json#/definitions/DeviceCgroup"
4141
}
4242
},
43+
"vtpms" : {
44+
"type": "array",
45+
"items": {
46+
"$ref": "defs-linux.json#/definitions/VTPM"
47+
}
48+
},
4349
"pids": {
4450
"type": "object",
4551
"properties": {

schema/defs-linux.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@
140140
"description": "minor device number",
141141
"$ref": "defs.json#/definitions/int64"
142142
},
143+
"TPMVersion": {
144+
"description": "The TPM version",
145+
"type": "string",
146+
"enum": [
147+
"1.2",
148+
"2"
149+
]
150+
},
143151
"FileMode": {
144152
"description": "File permissions mode (typically an octal value)",
145153
"type": "integer",
@@ -233,6 +241,35 @@
233241
}
234242
]
235243
},
244+
"VTPM" : {
245+
"type": "object",
246+
"properties" : {
247+
"statePath": {
248+
"type": "string"
249+
},
250+
"statePathIsManaged": {
251+
"type": "boolean"
252+
},
253+
"vtpmVersion": {
254+
"$ref": "#/definitions/TPMVersion"
255+
},
256+
"createCerts": {
257+
"type": "boolean"
258+
},
259+
"runAs": {
260+
"type": "string"
261+
},
262+
"pcrBanks": {
263+
"type": "string"
264+
},
265+
"encryptionPassword": {
266+
"type": "string"
267+
}
268+
},
269+
"required": [
270+
"statePath"
271+
]
272+
},
236273
"DeviceCgroup": {
237274
"type": "object",
238275
"properties": {

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,25 @@
330330
"rate": 300
331331
}
332332
]
333-
}
333+
},
334+
"vtpms": [
335+
{
336+
"statePath": "/var/lib/runc/myvtpm1",
337+
"vtpmVersion": "2",
338+
"createCerts": false,
339+
"runAs": "tss",
340+
"pcrBanks": "sha1,sha512"
341+
},
342+
{
343+
"statePath": "/var/lib/runc/myvtpm2",
344+
"statePathIsManaged": true,
345+
"vtpmVersion": "1.2",
346+
"createCerts": true,
347+
"runAs": "root",
348+
"pcrBanks": "sha1,sha512",
349+
"encryptionPassword": "mysecret"
350+
}
351+
]
334352
},
335353
"rootfsPropagation": "slave",
336354
"seccomp": {

specs-go/config.go

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

355+
// LinuxVTPM for vTPM definition
356+
type LinuxVTPM struct {
357+
// Path on host where vTPM writes state to
358+
StatePath string `json:"statePath,omitempty"`
359+
// Whether runc is allowed to delete the 'Statepath' once the TPM is destroyed
360+
StatePathIsManaged bool `json:"statePathIsManaged,omitempty"`
361+
// Version of the TPM that is emulated
362+
TPMVersion string `json:"vtpmVersion,omitempty"`
363+
// Whether to create certificates upon first start of vTPM
364+
CreateCertificates bool `json:"createCerts,omitempty"`
365+
// The PCR banks to enable
366+
PcrBanks string `json:"pcrBanks,omitempty"`
367+
// Under what user to run the vTPM process
368+
RunAs string `json:"runAs,omitempty"`
369+
// The password to derive the encryption key from
370+
EncryptionPassword string `json:"encryptionPassword,omitempty"`
371+
}
372+
355373
// LinuxResources has container runtime resource constraints
356374
type LinuxResources struct {
357375
// Devices configures the device whitelist.
@@ -372,6 +390,8 @@ type LinuxResources struct {
372390
// Limits are a set of key value pairs that define RDMA resource limits,
373391
// where the key is device name and value is resource limits.
374392
Rdma map[string]LinuxRdma `json:"rdma,omitempty"`
393+
// VTPM configuration
394+
VTPMs []LinuxVTPM `json:"vtpms,omitempty"`
375395
}
376396

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

0 commit comments

Comments
 (0)