Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,200 changes: 1,785 additions & 415 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ anyhow = "1.0.102"
chrono = "0.4.44"
clap = { version = "4.6.0", features = ["derive"] }
clevis-pin-trustee-lib = { git = "https://github.com/latchset/clevis-pin-trustee" }
compute-pcrs-lib = { git = "https://github.com/trusted-execution-clusters/compute-pcrs" }
compute-pcrs-lib = { git = "https://github.com/trusted-execution-clusters/compute-pcrs", rev = "1e7b9f74206e436d1426c335e30b2f1a6bd1681e"}
env_logger = { version = "0.11.10", default-features = false }
http = "1.4.0"
ignition-config = "0.6.1"
Expand Down
2 changes: 2 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ RUN sed -i 's/members = .*/members = ["lib", "operator"]/' Cargo.toml && \
# In debug builds, build dependencies to avoid full rebuild.
RUN if [ "$build_type" = debug ]; then cargo build -p operator; fi

RUN dnf install -y perl-FindBin perl-core

# Target build stage
COPY operator/src operator/src
RUN cargo build -p operator $(if [ "$build_type" = release ]; then echo --release; fi)
Expand Down
1 change: 1 addition & 0 deletions lib/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

pub const TRUSTEE_SERVICE: &str = "kbs-service";
pub const TRUSTEE_DEPLOYMENT: &str = "trustee-deployment";
pub const KBS_LABEL_SELECTOR: &str = "kbs";
pub const TRUSTEE_PORT: i32 = 8080;
pub const REGISTER_SERVER_SERVICE: &str = "register-server";
pub const REGISTER_SERVER_DEPLOYMENT: &str = "register-server";
Expand Down
1 change: 1 addition & 0 deletions operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ serde.workspace = true
serde_json.workspace = true
thiserror = "2.0.18"
tokio.workspace = true
kbs-client = {git = "https://github.com/confidential-containers/trustee.git", rev="54d10fdb80ce249b56d5b15bd0f6e44746fd3e20"}

[dev-dependencies]
http.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions operator/src/kbs-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ insecure_http = true

[admin]
insecure_api = true
auth_public_key="/key/public.pub"
type = "InsecureAllowAll"

[attestation_token]
Expand Down Expand Up @@ -32,8 +33,7 @@ policy_engine = "opa"

[[plugins]]
name = "resource"
type = "LocalFs"
dir_path = "/opt/trustee/kbs-repository"
type = "kvstorage"

[policy_engine]
policy_path = "/opt/trustee/policy.rego"
9 changes: 8 additions & 1 deletion operator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ async fn install_trustee_configuration(
Err(e) => error!("Failed to create the attestation policy configmap: {e}"),
}

match trustee::generate_trustee_auth_keys_secret(client.clone(), owner_reference.clone()).await
{
Ok(_) => info!("Generate auth keys for the KBS API",),
Err(e) => error!("Failed to create the auth keys: {e}"),
}

let kbs_port = cluster.spec.trustee_kbs_port;
match trustee::generate_kbs_service(client.clone(), owner_reference.clone(), kbs_port).await {
Ok(_) => info!("Generate the KBS service"),
Expand All @@ -190,7 +196,7 @@ async fn install_trustee_configuration(
"RELATED_IMAGE_TRUSTEE",
"quay.io/trusted-execution-clusters/key-broker-service:20260106",
);
match trustee::generate_kbs_deployment(client, owner_reference, &trustee_image).await {
match trustee::generate_kbs_deployment(client.clone(), owner_reference, &trustee_image).await {
Ok(_) => info!("Generate the KBS deployment"),
Err(e) => error!("Failed to create the KBS deployment: {e}"),
}
Expand Down Expand Up @@ -278,6 +284,7 @@ async fn main() -> Result<()> {
attestation_key_register::launch_ak_controller(kube_client.clone()).await;
attestation_key_register::launch_machine_ak_controller(kube_client.clone()).await;
attestation_key_register::launch_secret_ak_controller(kube_client.clone()).await;
trustee::launch_trustee_sync_controller(kube_client.clone()).await;

let ctx = Arc::new(ClusterContext {
client: kube_client,
Expand Down
12 changes: 7 additions & 5 deletions operator/src/register_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async fn keygen_reconcile(
async {
let owner_reference = generate_owner_reference(&Arc::unwrap_or_clone(machine))?;
trustee::generate_secret(kube_client.clone(), id, owner_reference).await?;
trustee::mount_secret(kube_client, id).await
trustee::send_secret(kube_client, id).await
}
.await
.map(|_| Action::await_change())
Expand Down Expand Up @@ -178,10 +178,12 @@ async fn keygen_reconcile(
}
}

trustee::unmount_secret(kube_client, id)
.await
.map(|_| Action::await_change())
.map_err(|e| finalizer::Error::<ControllerError>::CleanupFailed(e.into()))
trustee::delete_secret(kube_client, id).await.map_err(|e| {
finalizer::Error::<ControllerError>::CleanupFailed(
anyhow!("failed to delete secret for machine {id}: {e}").into(),
)
})?;
Ok(Action::await_change())
}
}
})
Expand Down
Loading
Loading