You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/Advanced/partition_encryption.md
+43-43Lines changed: 43 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,25 +5,25 @@ weight: 5
5
5
description: This section describes how to encrypt partition with LUKS in Kairos.
6
6
---
7
7
8
-
Kairos offers the ability to encrypt user data partitions with `LUKS`. User-data partitions are dedicated to persist data for a running system, stored separately from the OS images. This encryption mechanism can also be used to encrypt additional partitions created during the installation process.
8
+
Kairos offers the ability to encrypt user data partitions with `LUKS`. User-data partitions are dedicated to persist data for a running system, stored separately from the OS images. This encryption mechanism can also be used to encrypt additional partitions created during the installation process.
9
9
10
-
Kairos supports the following encryption scenarios:
10
+
Kairos supports the following encryption scenarios:
11
11
12
-
1.**Offline mode** - Encryption key for partitions is stored on the machine inside the TPM chip.
12
+
1.**Offline mode** - Encryption key for partitions is stored on the machine inside the TPM chip.
13
13
1.**Online mode (Automated)** - Keypair used to encrypt the partition passphrase is stored on the TPM chip, and an external server is used to store the encrypted passphrases.
14
14
1.**Online mode (Manually configured)** - Plaintext passphrase is stored in the KMS server and returned to the node after TPM challenging.
Kairos uses the TPM chip to encrypt partition passphrases, and for offline encryption, it stores the passphrase in the non-volatile registries of the chip.
19
-
To enable encryption, you will need to specify the labels of the partitions you want to encrypt, a minimum configuration for offline encryption can be seen below:
18
+
Kairos uses the TPM chip to encrypt partition passphrases, and for offline encryption, it stores the passphrase in the non-volatile registries of the chip.
19
+
To enable encryption, you will need to specify the labels of the partitions you want to encrypt, a minimum configuration for offline encryption can be seen below:
20
20
21
21
```yaml
22
22
#cloud-config
23
23
24
24
install:
25
25
# Label of partitions to encrypt
26
-
# COS_PERSISTENT is the OS partition
26
+
# COS_PERSISTENT is the OS partition
27
27
# dedicated to user-persistent data.
28
28
encrypted_partitions:
29
29
- COS_PERSISTENT
@@ -37,7 +37,7 @@ Please note that for online mode, you will also need to specify the key manageme
37
37
# Install block
38
38
install:
39
39
# Label of partitions to encrypt
40
-
# COS_PERSISTENT is the OS partition
40
+
# COS_PERSISTENT is the OS partition
41
41
# dedicated to user-persistent data.
42
42
encrypted_partitions:
43
43
- COS_PERSISTENT
@@ -47,42 +47,42 @@ kcrypt:
47
47
challenger:
48
48
# External KMS Server address. This must be reachable by the node
49
49
challenger_server: "http://192.168.68.109:30000"
50
-
# (optional) Custom Non-Volatile index to use to store encoded blobs
51
-
nv_index: ""
52
-
# (optional) Custom Index for the RSA Key pair
53
-
c_index: ""
54
-
# (optional) Custom TPM device
55
-
tpm_device: ""
56
50
# (optional) Instructs the client to lookup the KMS using mdns
57
51
mdns: false
52
+
# (optional) Custom Non-Volatile index to use to store encoded blobs
53
+
nv_index: ""
54
+
# (optional) Custom Index for the RSA Key pair
55
+
c_index: ""
56
+
# (optional) Custom TPM device
57
+
tpm_device: ""
58
58
```
59
59
60
60
| Option | Description |
61
61
| --- | --- |
62
62
| `install.encrypted_partitions` | Label of partitions to encrypt |
63
63
| `kcrypt.challenger.challenger_server` | External KMS Server address |
64
-
| `kcrypt.challenger.nv_index` | Custom Non-Volatile index to use to store encoded blobs |
65
-
| `kcrypt.challenger.c_index` | Custom Index for the RSA Key pair |
| `kcrypt.challenger.mdns` | Discover KMS using mdns. Defaults to `false` |
65
+
| `kcrypt.nv_index` | Custom Non-Volatile index to use to store encoded blobs |
66
+
| `kcrypt.c_index` | Custom Index for the RSA Key pair |
67
+
| `kcrypt.tpm_device` | Custom TPM device |
68
68
69
69
## Requirements
70
70
71
71
The host machine must have a TPM chip version 2.0 or higher to use encryption with Kairos. A list of TPM chips/HW can be found [in the list of certified products](https://trustedcomputinggroup.org/membership/certification/tpm-certified-products/), however, any modern machine has a TPM 2.0 chip.
72
72
73
-
## Components
73
+
## Components
74
74
75
-
The Kairos encryption design involves three components to manage partitions encryption and decryption lifecycle:
75
+
The Kairos encryption design involves three components to manage partitions encryption and decryption lifecycle:
76
76
77
-
- [kcrypt](https://github.com/kairos-io/kcrypt) runs on the machine and attempts to unlock partitions by using plugins to delegate encryption/decryption business logic.
78
-
- [kcrypt-discovery-challenger](https://github.com/kairos-io/kcrypt-challenger) runs on the machine, it is called by `kcrypt` and uses the TPM chip to retrieve the passphrase as described below.
77
+
- [kcrypt](https://github.com/kairos-io/kcrypt) runs on the machine and attempts to unlock partitions by using plugins to delegate encryption/decryption business logic.
78
+
- [kcrypt-discovery-challenger](https://github.com/kairos-io/kcrypt-challenger) runs on the machine, it is called by `kcrypt` and uses the TPM chip to retrieve the passphrase as described below.
79
79
- [kcrypt-challenger](https://github.com/kairos-io/kcrypt-challenger) is the KMS (Key Management Server) component, deployed in Kubernetes, which manages secrets and partitions of the nodes.
80
80
81
-
## Offline mode
81
+
## Offline mode
82
82
83
83
This scenario covers encryption of data at rest without any third party or KMS server. The keys used to encrypt the partitions are stored in the TPM chip.
84
84
85
-
### Scenario: Offline encryption
85
+
### Scenario: Offline encryption
86
86
87
87
A high level overview of the interaction between the components can be observed here:
88
88
@@ -111,21 +111,21 @@ users:
111
111
112
112
Note, we define a list of partition labels that we want to encrypt. In the example above we set `COS_PERSISTENT` to be encrypted, which in turns will encrypt all the user-data of the machine (this includes, for instance, Kubernetes pulled images, or any runtime persisting data on the machine).
113
113
114
-
## Online mode
114
+
## Online mode
115
115
116
116
Online mode involves an external service (the Key Management Server, **KMS**) to boot the machines. The KMS role is to enable machine to boot by providing the encrypted secrets, or passphrases to unlock the encrypted drive. Authentication with the KMS is done via TPM challenging.
117
117
118
118
In this scenario, we need to first deploy the KMS server to an existing Kubernetes cluster, and associate the TPM hash of the nodes that we want to manage. During deployment, we specify the KMS server inside the cloud-config of the nodes to be provisioned.
119
119
120
120
### Requirements
121
121
122
-
- A Kubernetes cluster
123
-
- Kcrypt-challenger reachable by the nodes attempting to boot
122
+
- A Kubernetes cluster
123
+
- Kcrypt-challenger reachable by the nodes attempting to boot
124
124
125
125
### Install the KMS (`kcrypt-challenger`)
126
126
127
-
To install the KMS (`kcrypt-challenger`), you will first need to make sure that certificate manager is installed. You can do this by running the following command:
128
-
127
+
To install the KMS (`kcrypt-challenger`), you will first need to make sure that certificate manager is installed. You can do this by running the following command:
In order to register a node on the KMS, the TPM hash of the node needs to be retrieved first. The TPM hash is a SHA256 sum of the EK public key, which is part of the EK key pair that is present on the TPM from the manufacturer. The EK private key cannot be changed and is unique to the TPM and therefore, the EK public key can be used to uniquely challenge the device. During the challenge, the node will send its public key to the challenger, which will generate a SHA256 checksum and compare it to a local database of checksums. In order to build this database, the checksum needs to be registered with the challenger.
161
161
162
162
You can get a node TPM hash by running `/system/discovery/kcrypt-discovery-challenger` as root from the LiveCD:
In this scenario the Kubernetes administrator knows the passphrase of the nodes, and sets explicitly during configuration the passphrase for each partitions of the nodes. This scenario is suitable for cases when the passphrase needs to be carried over, and not to be tied specifically to the TPM chip.
234
-
The TPM chip is still used for authentication a machine. The discovery-challenger needs still to know the TPM hash of each of the nodes before installation.
233
+
In this scenario the Kubernetes administrator knows the passphrase of the nodes, and sets explicitly during configuration the passphrase for each partitions of the nodes. This scenario is suitable for cases when the passphrase needs to be carried over, and not to be tied specifically to the TPM chip.
234
+
The TPM chip is still used for authentication a machine. The discovery-challenger needs still to know the TPM hash of each of the nodes before installation.
235
235
To register a node to kubernetes, replace the `TPMHash` in the following example with the TPM hash retrieved before, and specify a passphrase with a secret reference for the partition:
236
236
237
237
```bash
@@ -244,7 +244,7 @@ metadata:
244
244
type: Opaque
245
245
stringData:
246
246
pass: "awesome-plaintext-passphrase"
247
-
---
247
+
---
248
248
apiVersion: keyserver.kairos.io/v1alpha1
249
249
kind: SealedVolume
250
250
metadata:
@@ -262,7 +262,7 @@ EOF
262
262
```
263
263
264
264
The node doesn't need any specific configuration beside the kcrypt challenger, so for instance:
265
-
265
+
266
266
```yaml
267
267
#cloud-config
268
268
@@ -275,9 +275,9 @@ install:
275
275
kcrypt:
276
276
challenger:
277
277
challenger_server: "http://192.168.68.109:30000"
278
-
nv_index: ""
279
-
c_index: ""
280
-
tpm_device: ""
278
+
nv_index: ""
279
+
c_index: ""
280
+
tpm_device: ""
281
281
282
282
hostname: metal-{{ trunc 4 .MachineID }}
283
283
users:
@@ -312,7 +312,7 @@ utility that does exactly that: https://github.com/kairos-io/simple-mdns-server/
312
312
The process to deploy the KMS is similar to the [Online mode](#online-mode).
313
313
An example on how to test this feature locally, can be found [in this document](https://github.com/kairos-io/kcrypt-challenger/blob/main/mdns-notes.md).
314
314
315
-
## Troubleshooting
315
+
## Troubleshooting
316
316
- Invoking `/system/discovery/kcrypt-discovery-challenger` without arguments returns the TPM pubhash.
317
317
- Invoking `kcrypt-discovery-challenger` with 'discovery.password' triggers the logic to retrieve the passphrase, for instance can be used as such:
0 commit comments