Skip to content

Commit 506140c

Browse files
committed
kbs/resource: Add splitapi plugin
This plugin (based on the Nebula plugin interface) delivers credentials (keys and certificates) to a sandbox (i.e., confidential PODs or VMs), specifically to the kata agent to initiate the SplitAPI proxy server so that a workload owner can communicate with the proxy server using a secure tunnel. The proxy server's credentials can be requested using the kbs-client: kbs-client --url http://127.0.0.1:8080 \ get-resource \ --path 'plugin/splitapi/credential?ip=60.11.12.13&name=pod6&id=32348' The IPv4 address, name, and the ID of the sandbox must be provided in the query string to obtain the credential resources from the kbs. After receiving the credential request, the splitapi plugin will create a key pair for the server and client and sign them using the self-signed CA. The generated ca.crt, server.crt, and server.key are stored in a directory specific to the sandbox (the caller) and returned to the caller. In addition, ca.key, client.key, and client.crt are also generated and stored to that particular directory specific to the sandbox (i.e., caller) During the credential generation, a directory manager creates a unique directory specific to the sandbox (i.e., the caller). The manager creates the unique directory using the sandbox parameters passed in the query string. A mapping file is also maintained to store the mapping between the sandbox name and the unique directory created for the sandbox. The splitapi plugin itself is not initialized by default. To initialize it, you need to add 'splitapi' to 'manager_plugin_config.enabled_plugins' in the kbs-config.toml. Depends on: confidential-containers#451 Signed-off-by: Salman Ahmed <sahmed@ibm.com>
1 parent baf0bd6 commit 506140c

5 files changed

Lines changed: 662 additions & 2 deletions

File tree

kbs/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ rustls = ["actix-web/rustls", "dep:rustls", "dep:rustls-pemfile"]
4242
# Use openssl crypto stack for KBS
4343
openssl = ["actix-web/openssl", "dep:openssl"]
4444
nebula-plugin = []
45+
splitapi-plugin = []
4546

4647
# Use aliyun KMS as KBS backend
4748
aliyun = ["kms/aliyun"]

kbs/config/kbs-config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dir_path = "/opt/confidential-containers/kbs/storage"
1010

1111
[plugin_manager_config]
1212
work_dir = "/opt/confidential-containers/kbs/plugin"
13-
enabled_plugins = []
13+
enabled_plugins = ["splitapi"]
1414

1515
[as_config]
1616
work_dir = "/opt/confidential-containers/attestation-service"

kbs/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::path::{Path, PathBuf};
2626

2727
const DEFAULT_INSECURE_API: bool = false;
2828
const DEFAULT_INSECURE_HTTP: bool = false;
29-
const DEFAULT_SOCKET: &str = "127.0.0.1:8080";
29+
const DEFAULT_SOCKET: &str = "10.100.200.11:8068";
3030
const DEFAULT_TIMEOUT: i64 = 5;
3131

3232
/// Contains all configurable KBS properties.

kbs/src/resource/plugin/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#[cfg(feature = "nebula-plugin")]
66
mod nebula;
77

8+
#[cfg(feature = "splitapi-plugin")]
9+
mod splitapi;
10+
811
use anyhow::{anyhow, bail, Context, Result};
912
use serde::Deserialize;
1013
use std::fs;
@@ -15,6 +18,9 @@ use tokio::sync::RwLock;
1518
#[cfg(feature = "nebula-plugin")]
1619
use crate::resource::plugin::nebula::NebulaPluginConfig;
1720

21+
#[cfg(feature = "splitapi-plugin")]
22+
use crate::resource::plugin::splitapi::SplitapiPluginConfig;
23+
1824
trait PluginBuild {
1925
fn get_plugin_name(&self) -> &str;
2026
fn create_plugin(&self, work_dir: &str) -> Result<Arc<RwLock<dyn Plugin + Send + Sync>>>;
@@ -35,6 +41,9 @@ impl PluginManagerConfig {
3541
#[cfg(feature = "nebula-plugin")]
3642
p.push(Box::new(NebulaPluginConfig::default()));
3743

44+
#[cfg(feature = "splitapi-plugin")]
45+
p.push(Box::new(SplitapiPluginConfig::default()));
46+
3847
p
3948
}
4049

0 commit comments

Comments
 (0)