rottweiler: add directory protection#883
Draft
bcressey wants to merge 4 commits intobottlerocket-os:developfrom
Draft
rottweiler: add directory protection#883bcressey wants to merge 4 commits intobottlerocket-os:developfrom
bcressey wants to merge 4 commits intobottlerocket-os:developfrom
Conversation
Contributor
Author
|
Keeping this in draft as there's a significant blocker: the system fails to boot if I'm also unsure whether the recursive remount under |
added 3 commits
March 26, 2026 23:29
After locking a directory, its key is no longer present in the kernel and can no longer be unsealed from the TPM2 device. This is done to prevent further modifications to persisted settings in the datastore. A higher-level goal is to block changes to the effective settings on the running system. To accomplish this, it's necessary to make `/etc` and its child mounts read-only - so that configuration files cannot be modified directly - and to make `/.bottlerocket` read-only, so the datastore cannot be replaced by a directory with different contents. To block the filesystems from being mounted read-write again, install a BPF LSM hook that blocks remounting, unmounting, or mounting over the protected directories. Signed-off-by: Ben Cressey <bcressey@amazon.com>
Add rottweiler protect command to lockdown sequence to apply BPF LSM write protection to /.bottlerocket/datastore and /etc before locking the datastore encryption key. Signed-off-by: Ben Cressey <bcressey@amazon.com>
Label rottweiler's BPF maps with "private_t" so that only API-related processes can alter them. Otherwise, entries could be removed from the "protected_devices" map to bypass the intended protection. Signed-off-by: Ben Cressey <bcressey@amazon.com>
8f3f3f5 to
a19b7ab
Compare
When running `cargo` builds outside the SDK, e.g. to run unit tests, rottweiler needs libbpf available. Signed-off-by: Ben Cressey <bcressey@amazon.com>
613d754 to
514c3d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number:
Related: bottlerocket-os/bottlerocket#4680
Description of changes:
Extend
rottweilerwith the ability to lock down directories by remounting the underlying filesystem read-only, and installing a BPF LSM hook to prevent subsequent remounts, unmounts, or overmounts.Label the directory on
bpffssuch that only API processes can modify the map used by the BPF LSM hook.Update the lockdown API to also lock
/etcand/.bottlerocket/datastore.Testing done:
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.