Skip to content

Commit 14f16fa

Browse files
authored
Merge pull request #717 from bcressey/add-rottweiler
add rottweiler to manage storage encryption
2 parents bf503d5 + a39fdd9 commit 14f16fa

File tree

24 files changed

+1814
-0
lines changed

24 files changed

+1814
-0
lines changed

Cargo.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kits/bottlerocket-core-kit/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ procps = { path = "../../packages/procps" }
128128
rdma-core = { path = "../../packages/rdma-core" }
129129
readline = { path = "../../packages/readline" }
130130
release = { path = "../../packages/release" }
131+
rottweiler = { path = "../../packages/rottweiler" }
131132
runc = { path = "../../packages/runc" }
132133
selinux-policy = { path = "../../packages/selinux-policy" }
133134
socat = { path = "../../packages/socat" }

packages/rottweiler/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "rottweiler"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
build = "../build.rs"
7+
8+
[lib]
9+
path = "../packages.rs"
10+
11+
[package.metadata.build-package]
12+
source-groups = [
13+
"rottweiler",
14+
"generate-readme",
15+
]
16+
17+
[build-dependencies]
18+
glibc = { path = "../glibc" }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
%global _cross_first_party 1
2+
%undefine _debugsource_packages
3+
4+
Name: %{_cross_os}rottweiler
5+
Version: 0.1.0
6+
Release: 1%{?dist}
7+
Summary: Bottlerocket storage encryption helper
8+
License: Apache-2.0 OR MIT
9+
URL: https://github.com/bottlerocket-os/bottlerocket
10+
11+
BuildRequires: %{_cross_os}glibc-devel
12+
Requires: %{_cross_os}cryptsetup
13+
Requires: %{_cross_os}systemd-cryptsetup
14+
Requires: %{_cross_os}tpm2-tools
15+
16+
%description
17+
%{summary}.
18+
19+
%prep
20+
%setup -T -c
21+
%cargo_prep
22+
23+
%build
24+
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
25+
-p rottweiler
26+
27+
%install
28+
install -d %{buildroot}%{_cross_bindir}
29+
install -p -m 0755 %{__cargo_outdir}/rottweiler %{buildroot}%{_cross_bindir}
30+
ln -s rottweiler %{buildroot}%{_cross_bindir}/rw
31+
32+
%files
33+
%{_cross_bindir}/rottweiler
34+
%{_cross_bindir}/rw

packages/selinux-policy/fs.cil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
(filecon "/.*/usr/bin/apiserver" file api_exec)
4747
(filecon "/.*/usr/bin/early-boot-config" file api_exec)
4848
(filecon "/.*/usr(/fips)?/bin/migrator" file api_exec)
49+
(filecon "/.*/usr/bin/rottweiler" file api_exec)
4950
(filecon "/.*/usr/bin/storewolf" file api_exec)
5051
(filecon "/.*/usr(/fips)?/bin/cfsignal" file api_exec)
5152
(filecon "/.*/usr/bin/thar-be-settings" file api_exec)

sources/Cargo.lock

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sources/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ members = [
2626

2727
"bootstrap-commands",
2828

29+
"bottlerocket-image-features",
30+
2931
"bottlerocket-release",
3032

3133
"brush",
@@ -69,6 +71,8 @@ members = [
6971

7072
"retry-read",
7173

74+
"rottweiler",
75+
7276
"updater/block-party",
7377
"updater/signpost",
7478
"updater/update_metadata",
@@ -85,6 +89,7 @@ members = [
8589
apiclient = { version = "0.1", path = "api/apiclient", default-features = false }
8690
aws-smithy-experimental = { version = "0.1", path = "aws-smithy-experimental" }
8791
block-party = { version = "0.1", path = "updater/block-party" }
92+
bottlerocket-image-features = { version = "0.1", path = "bottlerocket-image-features" }
8893
bottlerocket-release = { version = "0.1", path = "bottlerocket-release" }
8994
constants = { version = "0.1", path = "constants" }
9095
datastore = { version = "0.1", path = "api/datastore" }
@@ -144,7 +149,9 @@ gptman = { version = "1", default-features = false }
144149
handlebars = "4"
145150
h2 = "0.4"
146151
headers = "0.4"
152+
hex = "0.4"
147153
hex-literal = "0.4"
154+
hkdf = { version = "0.12", default-features = false }
148155
http = "0.2"
149156
httparse = "1"
150157
httptest = "0.15"
@@ -187,6 +194,7 @@ serde_json = "1"
187194
serde_plain = "1"
188195
serde_yaml = "0.9"
189196
serde_repr = "0.1"
197+
sha2 = "0.10"
190198
shell-words = "1"
191199
shlex = "1"
192200
signal-hook = "0.3"
@@ -210,6 +218,7 @@ url = "2"
210218
walkdir = "2.5"
211219
which = "4"
212220
zbus = { version = "5.11", default-features = false }
221+
zeroize = { version = "1", default-features = false }
213222
zvariant = "5.7"
214223
x509-parser = "0.16"
215224
base64 = "0.22"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "bottlerocket-image-features"
3+
version = "0.1.0"
4+
edition = "2024"
5+
license = "Apache-2.0 OR MIT"
6+
publish = false
7+
8+
[dependencies]
9+
envy.workspace = true
10+
serde = { workspace = true, features = ["derive"] }
11+
snafu.workspace = true
12+
13+
[build-dependencies]
14+
generate-readme.workspace = true
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# bottlerocket-image-features
2+
3+
Current version: 0.1.0
4+
5+
## Introduction
6+
7+
*bottlerocket-image-features* is a library for parsing Bottlerocket image feature flags
8+
from the system configuration file.
9+
10+
### Overview
11+
12+
This crate provides functionality to read and parse the `/usr/share/bottlerocket/image-features.env`
13+
file, which contains feature flags that control various aspects of the Bottlerocket system.
14+
15+
### Features
16+
17+
Currently supported feature flags:
18+
19+
- `IN_PLACE_UPDATES` - Controls whether in-place updates are enabled (default: true)
20+
- `ENCRYPTED_STORAGE` - Controls whether encrypted storage is enabled (default: false)
21+
22+
### Usage
23+
24+
```rust
25+
use bottlerocket_image_features::parse_image_features;
26+
27+
let features = parse_image_features()?;
28+
if features.in_place_updates {
29+
println!("In-place updates are enabled");
30+
}
31+
```
32+
33+
### File Format
34+
35+
The image features file uses a simple key=value format with support for:
36+
- Comments (lines starting with `#`)
37+
- Empty lines (ignored)
38+
- Quoted or unquoted values
39+
- Boolean values ("true" or "false")
40+
41+
Example:
42+
```
43+
# Image feature configuration
44+
IN_PLACE_UPDATES="true"
45+
```
46+
47+
## Colophon
48+
49+
This text was generated using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# {{crate}}
2+
3+
Current version: {{version}}
4+
5+
{{readme}}
6+
7+
## Colophon
8+
9+
This text was generated using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`.

0 commit comments

Comments
 (0)