updates to ephemeral encryption keys - #1024
Conversation
8856f70 to
6956570
Compare
| %package crypt-luks | ||
| Summary: Bottlerocket release, with LUKS block-device encryption | ||
| Requires: (%{_cross_os}image-feature(encrypted-storage) and %{name}-crypt) | ||
| Conflicts: %{_cross_os}image-feature(ephemeral-encryption-keys) |
There was a problem hiding this comment.
Should this conflict with ephemeral-crypt?
99b8a83 to
fd8cdf9
Compare
|
Force push removes the requirement of a |
2148f81 to
ab6597b
Compare
Signed-off-by: Piyush Jena <jepiyush@amazon.com>
Signed-off-by: Piyush Jena <jepiyush@amazon.com>
Signed-off-by: Piyush Jena <jepiyush@amazon.com>
Signed-off-by: Piyush Jena <jepiyush@amazon.com>
ab6597b to
53d5f9e
Compare
| - The `bottlerocket-data`, `bottlerocket-private`, and ephemeral-storage keys are generated, used, and deleted within a single service (an `ExecStartPost=rottweiler delete-key` removes each one) | ||
| - Keys live in the `/run/rottweiler` tmpfs keystore, never on `/.bottlerocket` and never on a persistent disk | ||
| - Data does not survive a reboot: the next boot generates a new key, so prior contents are unreadable and the filesystem is recreated |
There was a problem hiding this comment.
The above is enough, you can remove this.
| the key. Opening the mapper before growing the partition avoids waiting on the by-partlabel | ||
| device node to be recreated. |
There was a problem hiding this comment.
| the key. Opening the mapper before growing the partition avoids waiting on the by-partlabel | |
| device node to be recreated. | |
| the key. |
| - Mounts `/dev/mapper/BOTTLEROCKET-PRIVATE` instead of the raw partition | ||
| - Requires `prepare-private-fs.service` | ||
|
|
||
| `repart-local.service` gets a `10-ephemeral.conf` drop-in in this mode that masks the base unit's `ExecStart` (the `systemd-repart` grow), because the partition grow and mapper resize are performed inside `encrypt-unlock-local-fs.service` so the key can be generated and deleted within that single service. The base unit's `systemd-growfs /local` still runs to grow the filesystem to fill the resized mapper. |
There was a problem hiding this comment.
Why not following the convention already established for all other services?
| // Without `--key-file=-`, cryptsetup treats stdin as an interactive *passphrase* and stops | ||
| // reading at the first newline; `--keyfile-size` is what makes it read exactly the key even | ||
| // from stdin. Together they are the only reason the mapper gets all of the key bytes: a | ||
| // 0x0A anywhere in a random 64-byte key would otherwise silently truncate it (and a leading | ||
| // 0x0A would yield an all-zero key, accepted as-is on a non-FIPS kernel and rejected by | ||
| // xts_verify_key() as -EINVAL on a FIPS one). |
There was a problem hiding this comment.
Document this in the function, not here. And less verbose: prefer key-file over stdin for reasons...
| /// The key is 64 raw bytes from /dev/random handed to cryptsetup on stdin. Without | ||
| /// `--key-file=-` cryptsetup reads stdin as an interactive passphrase and stops at the first | ||
| /// newline, and `--hash plain` then zero-pads whatever it got to `--key-size`. Observed live on | ||
| /// aws-mantle-1{,-fips} x86_64: a key whose first byte was 0x0A produced an all-zero dm-crypt | ||
| /// key, silently accepted on the non-FIPS kernel and rejected on the FIPS kernel as | ||
| /// `crypt: Error decoding and setting key (-EINVAL)`, which failed | ||
| /// `encrypt-unlock-local-fs.service` and took `preconfigured.target` with it. |
There was a problem hiding this comment.
| /// The key is 64 raw bytes from /dev/random handed to cryptsetup on stdin. Without | |
| /// `--key-file=-` cryptsetup reads stdin as an interactive passphrase and stops at the first | |
| /// newline, and `--hash plain` then zero-pads whatever it got to `--key-size`. Observed live on | |
| /// aws-mantle-1{,-fips} x86_64: a key whose first byte was 0x0A produced an all-zero dm-crypt | |
| /// key, silently accepted on the non-FIPS kernel and rejected on the FIPS kernel as | |
| /// `crypt: Error decoding and setting key (-EINVAL)`, which failed | |
| /// `encrypt-unlock-local-fs.service` and took `preconfigured.target` with it. | |
| /// The key is 64 raw bytes from /dev/random handed to cryptsetup on stdin. Without | |
| /// `--key-file=-` cryptsetup reads stdin as an interactive passphrase and stops at the first | |
| /// newline, and `--hash plain` then zero-pads whatever it got to `--key-size`. |
Description of changes:
Testing done:
Containers run with containerd:
nvidia-smoke-test- bothnvidia-smiand CUDA Workloaddotnet-testworkload.FIPS test:
lsblk output
keystore for datastore encryption is correctly labeled and the key is ephemeral
systemctl status output
older services were removed
Stress test:
Ran reboot loop on 3 nvidia instances with bootstrap command setting up ephemeral storage with a large data partition. Didn't get any bricked device across 300 boots.
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.