Skip to content

Commit 38db4c9

Browse files
committed
feat(gateway): configure provider workload identity
Add the gateway setting that turns on per-sandbox SPIFFE provider grants for dedicated supervisors, and document the mode. - [openshell.gateway.spiffe_workload_identity] sets the SPIFFE ID prefix and the gateway's Workload API socket. It needs a positive gateway_jwt.ttl_secs and excludes spiffe_broker. - Preflight and startup require an explicit compute driver, reject the Kubernetes driver, and check the selected Docker, Podman, or VM table for a Workload API Unix socket and a supervisor endpoint that uses HTTPS or numeric loopback. A socket value that is set but invalid is reported with the rule it broke. Diagnostics carry no configuration values. - The gateway tells managed Docker, Podman, and VM drivers that the mode is selected through one Configure field. - The docs cover issuer registration for both identities, the evidence each runtime gives an attestor, turning the mode on and off, what an extension driver must implement, and a two-sandbox verification procedure. Signed-off-by: Shiju <shiju@nvidia.com>
1 parent 92f4f84 commit 38db4c9

9 files changed

Lines changed: 625 additions & 24 deletions

File tree

‎crates/openshell-gateway/src/launcher.rs‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ pub struct ConfigureInputs<'a> {
765765
pub admission: Option<&'a openshell_core::resource_admission::DriverAdmissionConfig>,
766766
pub sandbox_runtime_image: Option<String>,
767767
pub supervisor_image: Option<String>,
768+
verified_provider_workload_identity: Option<bool>,
768769
/// How long the driver has to answer `Configure`.
769770
pub configure_timeout: Duration,
770771
}
@@ -790,6 +791,7 @@ impl<'a> ConfigureInputs<'a> {
790791
sandbox_runtime_image: std::env::var(openshell_core::config::SANDBOX_RUNTIME_IMAGE_ENV)
791792
.ok(),
792793
supervisor_image: std::env::var(openshell_core::config::SUPERVISOR_IMAGE_ENV).ok(),
794+
verified_provider_workload_identity: None,
793795
configure_timeout: DEFAULT_CONFIGURE_TIMEOUT,
794796
}
795797
}
@@ -802,6 +804,17 @@ impl<'a> ConfigureInputs<'a> {
802804
self
803805
}
804806

807+
#[cfg(any(
808+
feature = "compute-driver-docker",
809+
feature = "compute-driver-podman",
810+
feature = "compute-driver-vm"
811+
))]
812+
#[must_use]
813+
pub fn with_verified_provider_workload_identity(mut self, enabled: bool) -> Self {
814+
self.verified_provider_workload_identity = Some(enabled);
815+
self
816+
}
817+
805818
/// The `Configure` call for these inputs: the request and its deadline.
806819
#[must_use]
807820
pub fn configure_call(&self) -> ConfigureCall {
@@ -872,7 +885,7 @@ impl<'a> ConfigureInputs<'a> {
872885
.admission
873886
.and_then(|policy| serde_json::to_string(policy).ok())
874887
.unwrap_or_default(),
875-
verified_provider_workload_identity: None,
888+
verified_provider_workload_identity: self.verified_provider_workload_identity,
876889
}
877890
}
878891
}

‎crates/openshell-gateway/src/launcher/tests.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,15 @@ fn configure_carries_the_gateway_metadata_the_argv_used_to() {
598598
admission: Some(&admission),
599599
sandbox_runtime_image: Some("runtime:1".to_string()),
600600
supervisor_image: None,
601+
verified_provider_workload_identity: Some(true),
601602
configure_timeout: DEFAULT_CONFIGURE_TIMEOUT,
602603
};
603604

604605
let request = inputs.request();
605606

606607
assert_eq!(request.protocol_version, PROTOCOL_VERSION);
608+
assert_eq!(request.verified_provider_workload_identity, Some(true));
609+
assert!(request.required_features.is_empty());
607610
let gateway = request.gateway.unwrap();
608611
assert_eq!(gateway.gateway_port, 8080);
609612
assert_eq!(gateway.bind_address, "127.0.0.1:8080");
@@ -645,6 +648,7 @@ fn configure_omits_what_the_gateway_does_not_have() {
645648
admission: None,
646649
sandbox_runtime_image: None,
647650
supervisor_image: None,
651+
verified_provider_workload_identity: None,
648652
configure_timeout: DEFAULT_CONFIGURE_TIMEOUT,
649653
};
650654

@@ -654,6 +658,7 @@ fn configure_omits_what_the_gateway_does_not_have() {
654658
assert!(request.network_trust.is_none());
655659
assert!(request.telemetry.is_none());
656660
assert!(request.resource_admission_policy_json.is_empty());
661+
assert_eq!(request.verified_provider_workload_identity, None);
657662
}
658663

659664
#[tokio::test]

‎crates/openshell-gateway/src/lib.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ impl openshell_server::ComputeDriverFactory for DockerFactory {
423423
context.otlp_config(),
424424
Some(&admission),
425425
)
426-
.with_configure_timeout(context.image_preparation_timeout());
426+
.with_configure_timeout(context.image_preparation_timeout())
427+
.with_verified_provider_workload_identity(context.requires_provider_workload_identity());
427428
// Auto-detection already started the driver; configure that process.
428429
let detected = context.take_detected_driver::<launcher::Started>();
429430
let endpoint = docker::DOCKER
@@ -488,7 +489,8 @@ impl openshell_server::ComputeDriverFactory for PodmanFactory {
488489
context.otlp_config(),
489490
Some(&admission),
490491
)
491-
.with_configure_timeout(context.image_preparation_timeout());
492+
.with_configure_timeout(context.image_preparation_timeout())
493+
.with_verified_provider_workload_identity(context.requires_provider_workload_identity());
492494
let endpoint = podman::PODMAN
493495
.spawn(
494496
&plan,
@@ -559,7 +561,8 @@ impl openshell_server::ComputeDriverFactory for VmFactory {
559561
context.otlp_config(),
560562
Some(&admission),
561563
)
562-
.with_configure_timeout(context.image_preparation_timeout());
564+
.with_configure_timeout(context.image_preparation_timeout())
565+
.with_verified_provider_workload_identity(context.requires_provider_workload_identity());
563566
let endpoint = vm::spawn(&plan, context.gateway_log_level(), &inputs).await?;
564567
Ok(openshell_server::ComputeDriverInstance::ManagedRemote(
565568
endpoint,

0 commit comments

Comments
 (0)