mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-17 08:53:26 +00:00
agent:rpc: initialize trusted storage device
Initialize the trusted stroage when the device is defined as "/dev/trusted_store" with shell script as first step. Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com> Co-authored-by: Wang, Arron <arron.wang@intel.com>
This commit is contained in:
parent
94347e2537
commit
df993b0f88
15
src/agent/Cargo.lock
generated
15
src/agent/Cargo.lock
generated
@ -398,11 +398,12 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "attester"
|
name = "attester"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
|
"hex",
|
||||||
"kbs-types",
|
"kbs-types",
|
||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1156,7 +1157,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "crypto"
|
name = "crypto"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -2462,7 +2463,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "image-rs"
|
name = "image-rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-compression",
|
"async-compression",
|
||||||
@ -2888,7 +2889,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kbc"
|
name = "kbc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -2917,7 +2918,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kbs_protocol"
|
name = "kbs_protocol"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -3671,7 +3672,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ocicrypt-rs"
|
name = "ocicrypt-rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -4676,7 +4677,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "resource_uri"
|
name = "resource_uri"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/confidential-containers/guest-components?rev=2c5ac6b01aafcb0be3875f5743c77d654a548146#2c5ac6b01aafcb0be3875f5743c77d654a548146"
|
source = "git+https://github.com/confidential-containers/guest-components?rev=51e967045296570abb4ad8bef215e92323306ed4#51e967045296570abb4ad8bef215e92323306ed4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -77,7 +77,7 @@ strum = "0.26.2"
|
|||||||
strum_macros = "0.26.2"
|
strum_macros = "0.26.2"
|
||||||
|
|
||||||
# Image pull/decrypt
|
# Image pull/decrypt
|
||||||
image-rs = { git = "https://github.com/confidential-containers/guest-components", rev = "2c5ac6b01aafcb0be3875f5743c77d654a548146", default-features = false, optional = true }
|
image-rs = { git = "https://github.com/confidential-containers/guest-components", rev = "51e967045296570abb4ad8bef215e92323306ed4", default-features = false, optional = true }
|
||||||
|
|
||||||
# Agent Policy
|
# Agent Policy
|
||||||
regorus = { version = "0.1.4", default-features = false, features = [
|
regorus = { version = "0.1.4", default-features = false, features = [
|
||||||
|
@ -106,6 +106,8 @@ use kata_types::k8s;
|
|||||||
|
|
||||||
pub const CONTAINER_BASE: &str = "/run/kata-containers";
|
pub const CONTAINER_BASE: &str = "/run/kata-containers";
|
||||||
const MODPROBE_PATH: &str = "/sbin/modprobe";
|
const MODPROBE_PATH: &str = "/sbin/modprobe";
|
||||||
|
const INIT_TRUSTED_STORAGE: &str = "/usr/bin/kata-init-trusted-storage";
|
||||||
|
const TRUSTED_IMAGE_STORAGE_DEVICE: &str = "/dev/trusted_store";
|
||||||
|
|
||||||
/// the iptables seriers binaries could appear either in /sbin
|
/// the iptables seriers binaries could appear either in /sbin
|
||||||
/// or /usr/sbin, we need to check both of them
|
/// or /usr/sbin, we need to check both of them
|
||||||
@ -243,6 +245,31 @@ impl AgentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let linux = oci
|
||||||
|
.linux()
|
||||||
|
.as_ref()
|
||||||
|
.ok_or_else(|| anyhow!("Spec didn't contain linux field"))?;
|
||||||
|
if let Some(devices) = linux.devices() {
|
||||||
|
for specdev in devices.iter() {
|
||||||
|
if specdev.path().as_path().to_str() == Some(TRUSTED_IMAGE_STORAGE_DEVICE) {
|
||||||
|
let dev_major_minor = format!("{}:{}", specdev.major(), specdev.minor());
|
||||||
|
let secure_storage_integrity =
|
||||||
|
AGENT_CONFIG.secure_storage_integrity.to_string();
|
||||||
|
info!(
|
||||||
|
sl(),
|
||||||
|
"trusted_store device major:min {}, enable data integrity {}",
|
||||||
|
dev_major_minor,
|
||||||
|
secure_storage_integrity
|
||||||
|
);
|
||||||
|
|
||||||
|
Command::new(INIT_TRUSTED_STORAGE)
|
||||||
|
.args([dev_major_minor.as_str(), &secure_storage_integrity])
|
||||||
|
.output()
|
||||||
|
.expect("Failed to initialize trusted storage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Both rootfs and volumes (invoked with --volume for instance) will
|
// Both rootfs and volumes (invoked with --volume for instance) will
|
||||||
// be processed the same way. The idea is to always mount any provided
|
// be processed the same way. The idea is to always mount any provided
|
||||||
// storage to the specified MountPoint, so that it will match what's
|
// storage to the specified MountPoint, so that it will match what's
|
||||||
|
Loading…
Reference in New Issue
Block a user