Skip to content

Commit 13f377a

Browse files
committed
Move the non-challenger related keys one level up
because that's where they are now looked up: https://github.com/kairos-io/kairos-sdk/blob/285e706739717fd7a2e49753111704a7e64e5cca/kcrypt/config.go#L93-L102 Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
1 parent 778c403 commit 13f377a

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

content/en/docs/Advanced/partition_encryption.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ weight: 5
55
description: This section describes how to encrypt partition with LUKS in Kairos.
66
---
77

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.
99

10-
Kairos supports the following encryption scenarios:
10+
Kairos supports the following encryption scenarios:
1111

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.
1313
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.
1414
1. **Online mode (Manually configured)** - Plaintext passphrase is stored in the KMS server and returned to the node after TPM challenging.
1515

1616
![encryption1_1674470732563_0](https://user-images.githubusercontent.com/2420543/214405291-97a30f2d-d70a-45ba-b842-5282c722c79e.png)
1717

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:
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:
2020

2121
```yaml
2222
#cloud-config
2323

2424
install:
2525
# Label of partitions to encrypt
26-
# COS_PERSISTENT is the OS partition
26+
# COS_PERSISTENT is the OS partition
2727
# dedicated to user-persistent data.
2828
encrypted_partitions:
2929
- COS_PERSISTENT
@@ -37,7 +37,7 @@ Please note that for online mode, you will also need to specify the key manageme
3737
# Install block
3838
install:
3939
# Label of partitions to encrypt
40-
# COS_PERSISTENT is the OS partition
40+
# COS_PERSISTENT is the OS partition
4141
# dedicated to user-persistent data.
4242
encrypted_partitions:
4343
- COS_PERSISTENT
@@ -47,42 +47,42 @@ kcrypt:
4747
challenger:
4848
# External KMS Server address. This must be reachable by the node
4949
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: ""
5650
# (optional) Instructs the client to lookup the KMS using mdns
5751
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: ""
5858
```
5959
6060
| Option | Description |
6161
| --- | --- |
6262
| `install.encrypted_partitions` | Label of partitions to encrypt |
6363
| `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 |
66-
| `kcrypt.challenger.tpm_device` | Custom TPM device |
6764
| `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 |
6868

6969
## Requirements
7070

7171
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.
7272

73-
## Components
73+
## Components
7474

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:
7676

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.
7979
- [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.
8080

81-
## Offline mode
81+
## Offline mode
8282

8383
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.
8484

85-
### Scenario: Offline encryption
85+
### Scenario: Offline encryption
8686

8787
A high level overview of the interaction between the components can be observed here:
8888

@@ -111,21 +111,21 @@ users:
111111

112112
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).
113113

114-
## Online mode
114+
## Online mode
115115

116116
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.
117117

118118
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.
119119

120120
### Requirements
121121

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
124124

125125
### Install the KMS (`kcrypt-challenger`)
126126

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:
128+
129129
```
130130
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml
131131
kubectl wait --for=condition=Available deployment --timeout=2m -n cert-manager --all
@@ -143,7 +143,7 @@ helm install kairos-crd kairos/kairos-crds
143143
144144
# Deploy the KMS challenger
145145
helm install kairos-challenger kairos/kairos-challenger --set service.challenger.type="NodePort"
146-
146+
147147
# we can also set up a specific port and a version:
148148
# helm install kairos-challenger kairos/kairos-challenger --set image.tag="v0.2.2" --set service.challenger.type="NodePort" --set service.challenger.nodePort=30000
149149
```
@@ -160,7 +160,7 @@ export PORT=$(kubectl get svc kairos-challenger-escrow-service -o json | jq '.sp
160160
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.
161161

162162
You can get a node TPM hash by running `/system/discovery/kcrypt-discovery-challenger` as root from the LiveCD:
163-
163+
164164
```
165165
kairos@localhost:~> ID=$(sudo /system/discovery/kcrypt-discovery-challenger)
166166
kairos@localhost:~> echo $ID
@@ -178,7 +178,7 @@ Deployment using this method, will store the encrypted key used to boot into the
178178

179179
To register a node to kubernetes, use the TPM hash retrieved before (see section ["Register a node"](#register-a-node))
180180
and replace it in this example command:
181-
181+
182182
```bash
183183
cat <<EOF | kubectl apply -f -
184184
apiVersion: keyserver.kairos.io/v1alpha1
@@ -197,7 +197,7 @@ EOF
197197
This command will register the node on the KMS.
198198

199199
A node can use the following during deployment, specifying the address of the challenger server:
200-
200+
201201
``` yaml
202202
#cloud-config
203203
@@ -210,9 +210,9 @@ install:
210210
kcrypt:
211211
challenger:
212212
challenger_server: "http://192.168.68.109:30000"
213-
nv_index: ""
214-
c_index: ""
215-
tpm_device: ""
213+
nv_index: ""
214+
c_index: ""
215+
tpm_device: ""
216216
217217
hostname: metal-{{ trunc 4 .MachineID }}
218218
users:
@@ -226,12 +226,12 @@ users:
226226
# - github:mudler
227227
```
228228

229-
### Scenario: Static keys
229+
### Scenario: Static keys
230230

231231
![encryption4_1674472306435_0](https://user-images.githubusercontent.com/2420543/214405316-63882311-ca27-4b6e-9465-70d702ab6dc1.png)
232232

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.
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.
235235
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:
236236

237237
```bash
@@ -244,7 +244,7 @@ metadata:
244244
type: Opaque
245245
stringData:
246246
pass: "awesome-plaintext-passphrase"
247-
---
247+
---
248248
apiVersion: keyserver.kairos.io/v1alpha1
249249
kind: SealedVolume
250250
metadata:
@@ -262,7 +262,7 @@ EOF
262262
```
263263

264264
The node doesn't need any specific configuration beside the kcrypt challenger, so for instance:
265-
265+
266266
```yaml
267267
#cloud-config
268268
@@ -275,9 +275,9 @@ install:
275275
kcrypt:
276276
challenger:
277277
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: ""
281281
282282
hostname: metal-{{ trunc 4 .MachineID }}
283283
users:
@@ -312,7 +312,7 @@ utility that does exactly that: https://github.com/kairos-io/simple-mdns-server/
312312
The process to deploy the KMS is similar to the [Online mode](#online-mode).
313313
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).
314314

315-
## Troubleshooting
315+
## Troubleshooting
316316
- Invoking `/system/discovery/kcrypt-discovery-challenger` without arguments returns the TPM pubhash.
317317
- Invoking `kcrypt-discovery-challenger` with 'discovery.password' triggers the logic to retrieve the passphrase, for instance can be used as such:
318318
```bash

0 commit comments

Comments
 (0)