Skip to content

Commit

Permalink
cdh/kms: cckbc use AA to get evidence rather than token
Browse files Browse the repository at this point in the history
When we use one AA and multiple CDH to connect to KBSes in one
confidential VM, AATokenProvider requires the KBS be the same. If we
use AAEvidenceProvider, the different target KBS address can be
specified in CDH's config and share a same AA.

This will also make the workflow simpler. Before this commit, if we want
to get a confidential resource from KBS, AA should connect to a KBS to
get a token. Then CDH get the token from AA. Then CDH access the KBS.

After this commit, only CDH will access the KBS.

This change will require the KBS that does RCAR and stores resource be
the same in CoCo, s.t. background check model. which is up to now
nearly all the deployments we have met.

This will not break the passport model because kbs_protocol crate still
provides a way for developers to integrate either passport model or
background check model in their own code.

Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Jan 6, 2025
1 parent 198e196 commit 77fe5f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion confidential-data-hub/hub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ image-rs = { path = "../../image-rs", default-features = false, features = [
"kata-cc-rustls-tls",
] }
kbs_protocol = { path = "../../attestation-agent/kbs_protocol", default-features = false, features = [
"passport",
"background_check",
"aa_ttrpc",
"openssl",
], optional = true }
Expand Down
12 changes: 6 additions & 6 deletions confidential-data-hub/hub/src/kms/plugins/kbs/cc_kbc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::env;
use async_trait::async_trait;
use kbs_protocol::{
client::KbsClient as KbsProtocolClient,
token_provider::{AATokenProvider, TokenProvider},
evidence_provider::{AAEvidenceProvider, EvidenceProvider},
KbsClientCapabilities, ResourceUri,
};
use log::{info, warn};
Expand All @@ -18,16 +18,16 @@ use super::{Error, Result};
use super::Kbc;

pub struct CcKbc {
client: KbsProtocolClient<Box<dyn TokenProvider>>,
client: KbsProtocolClient<Box<dyn EvidenceProvider>>,
}

impl CcKbc {
pub async fn new(kbs_host_url: &str) -> Result<Self> {
let token_provider = AATokenProvider::new().await.map_err(|e| {
Error::KbsClientError(format!("create AA token provider failed: {e:?}"))
let evidence_provider = AAEvidenceProvider::new().await.map_err(|e| {
Error::KbsClientError(format!("create AA evidence provider failed: {e:?}"))
})?;
let client = kbs_protocol::KbsClientBuilder::with_token_provider(
Box::new(token_provider),
let client = kbs_protocol::KbsClientBuilder::with_evidence_provider(
Box::new(evidence_provider),
kbs_host_url,
);

Expand Down

0 comments on commit 77fe5f1

Please sign in to comment.