Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdh: add secure mount feature in cdh #345

Merged
merged 5 commits into from
Nov 21, 2023
Merged
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
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"confidential-data-hub/kms",
"confidential-data-hub/image",
"confidential-data-hub/secret",
"confidential-data-hub/storage",
"image-rs",
"ocicrypt-rs",
]
Expand Down
13 changes: 13 additions & 0 deletions confidential-data-hub/docs/SECURE_STORAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Secure Storage

## Purpose
The Purpose of this secure storage feature is:
1. Mounting external storage from guest instead of host which would then share it to guest, this is due to performance consideration.
2. The unencrypted data in storage could only be accessed within TEE, that is why we call it secure storage.

## Architecture
![architecture](./images/secure_storage.png)

First of all, the sensitive information of external storage is sealed by the key from KBS/KMS, and store in [sealed secret](https://github.com/confidential-containers/guest-components/blob/main/confidential-data-hub/docs/SEALED_SECRET.md). The sensitive information includes access key id/access key secret to storage, the encryption key of the data(such as AI model) stored in the storage, which also means we supported client encryption.
We reuse [direct block device assigned volume feature](https://github.com/kata-containers/kata-containers/blob/main/docs/design/direct-blk-device-assignment.md) to mount external storage from guest directly. CSI plugin, such as [alibaba cloud OSS CSI plugin](https://github.com/kubernetes-sigs/alibaba-cloud-csi-driver/blob/master/docs/oss.md) reads the sensitve information from sealed secret and pass it to kata agent. When secure mount service in CDH receives secure mount request, it calls sealed secret service to unseal the sensitive information mentioned above, this process could be based on remote attestation. If success, the secure mount service would use the unsealed sensitive information to mount the external storage and decrypt the data in storage.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions confidential-data-hub/hub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lazy_static.workspace = true
log.workspace = true
protobuf = { workspace = true, optional = true }
secret.path = "../secret"
storage.path = "../storage"
serde = { workspace = true, optional = true }
serde_json.workspace = true
sev = { path = "../../attestation-agent/deps/sev", optional = true }
Expand Down
17 changes: 17 additions & 0 deletions confidential-data-hub/hub/protos/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ message KeyProviderKeyWrapProtocolOutput {
bytes KeyProviderKeyWrapProtocolOutput = 1;
}

message SecureMountRequest {
string driver = 1;
repeated string driver_options = 2;
string source = 3;
string fstype = 4;
arronwy marked this conversation as resolved.
Show resolved Hide resolved
repeated string options = 5;
string mount_point = 6;
}

message SecureMountResponse {
string mount_path = 1;
}

service SealedSecretService {
rpc UnsealSecret(UnsealSecretInput) returns (UnsealSecretOutput) {};
}
Expand All @@ -37,3 +50,7 @@ service GetResourceService {
service KeyProviderService {
rpc UnWrapKey(KeyProviderKeyWrapProtocolInput) returns (KeyProviderKeyWrapProtocolOutput) {};
}

service SecureMountService {
rpc SecureMount(SecureMountRequest) returns (SecureMountResponse) {};
}
3 changes: 3 additions & 0 deletions confidential-data-hub/hub/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use async_trait::async_trait;

use crate::Result;
use storage::volume_type::Storage;

/// The APIs of the DataHub. See
/// <https://github.com/confidential-containers/documentation/issues/131> for
Expand All @@ -26,4 +27,6 @@ pub trait DataHub {
/// URI is defined in
/// <https://github.com/confidential-containers/guest-components/blob/main/attestation-agent/docs/KBS_URI.md>
async fn get_resource(&self, uri: String) -> Result<Vec<u8>>;

async fn secure_mount(&self, storage: Storage) -> Result<String>;
Xynnn007 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading
Loading